File indexing completed on 2025-01-18 10:12:24
0001
0002
0003
0004 #ifndef ROOT_TSchemaRule
0005 #define ROOT_TSchemaRule
0006
0007 #include "TNamed.h"
0008 #include "TString.h"
0009
0010 #include <vector>
0011 #include <utility>
0012
0013 class TBuffer;
0014 class TVirtualObject;
0015 class TObjArray;
0016
0017 namespace ROOT {
0018
0019 class TSchemaRule : public TObject
0020 {
0021 public:
0022
0023 class TSources : public TNamed {
0024 private:
0025 TString fDimensions;
0026 public:
0027 TSources(const char *name = nullptr, const char *title = nullptr, const char *dims = nullptr) : TNamed(name,title), fDimensions(dims) {}
0028 const char *GetDimensions() { return fDimensions; }
0029
0030 ClassDefOverride(TSources,2);
0031 };
0032
0033 typedef enum
0034 {
0035 kReadRule = 0,
0036 kReadRawRule = 1,
0037 kNone = 99999
0038 } RuleType_t;
0039
0040 typedef void (*ReadFuncPtr_t)( char*, TVirtualObject* );
0041 typedef void (*ReadRawFuncPtr_t)( char*, TBuffer&);
0042
0043 TSchemaRule();
0044 virtual ~TSchemaRule();
0045
0046 TSchemaRule( const TSchemaRule& rhs );
0047 TSchemaRule& operator = ( const TSchemaRule& rhs );
0048 Bool_t operator == ( const TSchemaRule& rhs ) const;
0049
0050
0051 void Clear(Option_t * ="") override;
0052 Bool_t SetFromRule( const char *rule );
0053
0054 const char *GetVersion( ) const;
0055 Bool_t SetVersion( const TString& version );
0056 Bool_t TestVersion( Int_t version ) const;
0057 Bool_t SetChecksum( const TString& checksum );
0058 Bool_t TestChecksum( UInt_t checksum ) const;
0059 void SetSourceClass( const TString& classname );
0060 const char *GetSourceClass() const;
0061 void SetTargetClass( const TString& classname );
0062 const char *GetTargetClass() const;
0063 void SetTarget( const TString& target );
0064 const TObjArray* GetTarget() const;
0065 const char *GetTargetString() const;
0066 void SetSource( const TString& source );
0067 const TObjArray* GetSource() const;
0068 void SetEmbed( Bool_t embed );
0069 Bool_t GetEmbed() const;
0070 Bool_t IsAliasRule() const;
0071 Bool_t IsRenameRule() const;
0072 Bool_t IsValid() const;
0073 void SetCode( const TString& code );
0074 const char *GetCode() const;
0075 void SetAttributes( const TString& attributes );
0076 const char *GetAttributes() const;
0077 Bool_t HasTarget( const TString& target ) const;
0078
0079 Bool_t HasSource( const TString& source ) const;
0080 void SetReadFunctionPointer( ReadFuncPtr_t ptr );
0081 ReadFuncPtr_t GetReadFunctionPointer() const;
0082 void SetReadRawFunctionPointer( ReadRawFuncPtr_t ptr );
0083 ReadRawFuncPtr_t GetReadRawFunctionPointer() const;
0084 void SetInclude( const TString& include );
0085 const TObjArray* GetInclude() const;
0086 void SetRuleType( RuleType_t type );
0087 RuleType_t GetRuleType() const;
0088 Bool_t Conflicts( const TSchemaRule* rule ) const;
0089
0090 void AsString( TString &out, const char *options = "" ) const;
0091 void ls(Option_t *option="") const override;
0092
0093 private:
0094
0095 Bool_t ProcessVersion( const TString& version ) const;
0096 Bool_t ProcessChecksum( const TString& checksum ) const;
0097 UInt_t ParseChecksum( const char* checksum ) const;
0098 static void ProcessList( TObjArray* array, const TString& list );
0099 static void ProcessDeclaration( TObjArray* array, const TString& list );
0100
0101 TString fVersion;
0102 mutable std::vector<std::pair<Int_t, Int_t> >* fVersionVect;
0103 TString fChecksum;
0104 mutable std::vector<UInt_t>* fChecksumVect;
0105 TString fSourceClass;
0106 TString fTargetClass;
0107 TString fTarget;
0108 mutable TObjArray* fTargetVect;
0109 TString fSource;
0110 mutable TObjArray* fSourceVect;
0111 TString fInclude;
0112 mutable TObjArray* fIncludeVect;
0113 TString fCode;
0114 Bool_t fEmbed;
0115 ReadFuncPtr_t fReadFuncPtr;
0116 ReadRawFuncPtr_t fReadRawFuncPtr;
0117 RuleType_t fRuleType;
0118 TString fAttributes;
0119
0120 ClassDefOverride( TSchemaRule, 1 );
0121
0122 };
0123 }
0124
0125 #endif