00001
00002
00003
00004 #ifndef ROOT_TSchemaRule
00005 #define ROOT_TSchemaRule
00006
00007 class TBuffer;
00008 class TVirtualObject;
00009 class TObjArray;
00010
00011 #include "TObject.h"
00012 #include "TNamed.h"
00013 #include "Rtypes.h"
00014 #include "TString.h"
00015
00016 #include <vector>
00017 #include <utility>
00018
00019 namespace ROOT {
00020
00021 class TSchemaRule: public TObject
00022 {
00023 public:
00024
00025 class TSources : public TNamed {
00026 private:
00027 TString fDimensions;
00028 public:
00029 TSources(const char *name = 0, const char *title = 0, const char *dims = 0) : TNamed(name,title),fDimensions(dims) {}
00030 const char *GetDimensions() { return fDimensions; }
00031
00032 ClassDef(TSources,2);
00033 };
00034
00035 typedef enum
00036 {
00037 kReadRule = 0,
00038 kReadRawRule = 1,
00039 kNone = 99999
00040 } RuleType_t;
00041
00042 typedef void (*ReadFuncPtr_t)( char*, TVirtualObject* );
00043 typedef void (*ReadRawFuncPtr_t)( char*, TBuffer&);
00044
00045 TSchemaRule();
00046 virtual ~TSchemaRule();
00047
00048 TSchemaRule( const TSchemaRule& rhs );
00049 TSchemaRule& operator = ( const TSchemaRule& rhs );
00050 Bool_t operator == ( const TSchemaRule& rhs );
00051
00052
00053 void Clear(Option_t * ="");
00054 Bool_t SetFromRule( const char *rule );
00055
00056 const char *GetVersion( ) const;
00057 Bool_t SetVersion( const TString& version );
00058 Bool_t TestVersion( Int_t version ) const;
00059 Bool_t SetChecksum( const TString& checksum );
00060 Bool_t TestChecksum( UInt_t checksum ) const;
00061 void SetSourceClass( const TString& classname );
00062 const char *GetSourceClass() const;
00063 void SetTargetClass( const TString& classname );
00064 const char *GetTargetClass() const;
00065 void SetTarget( const TString& target );
00066 const TObjArray* GetTarget() const;
00067 const char *GetTargetString() const;
00068 void SetSource( const TString& source );
00069 const TObjArray* GetSource() const;
00070 void SetEmbed( Bool_t embed );
00071 Bool_t GetEmbed() const;
00072 Bool_t IsAliasRule() const;
00073 Bool_t IsRenameRule() const;
00074 Bool_t IsValid() const;
00075 void SetCode( const TString& code );
00076 const char *GetCode() const;
00077 void SetAttributes( const TString& attributes );
00078 const char *GetAttributes() const;
00079 Bool_t HasTarget( const TString& target ) const;
00080
00081 Bool_t HasSource( const TString& source ) const;
00082 void SetReadFunctionPointer( ReadFuncPtr_t ptr );
00083 ReadFuncPtr_t GetReadFunctionPointer() const;
00084 void SetReadRawFunctionPointer( ReadRawFuncPtr_t ptr );
00085 ReadRawFuncPtr_t GetReadRawFunctionPointer() const;
00086 void SetInclude( const TString& include );
00087 const TObjArray* GetInclude() const;
00088 void SetRuleType( RuleType_t type );
00089 RuleType_t GetRuleType() const;
00090 Bool_t Conflicts( const TSchemaRule* rule ) const;
00091
00092 void AsString( TString &out, const char *options = "" ) const;
00093 void ls(Option_t *option="") const;
00094
00095 ClassDef( TSchemaRule, 1 );
00096
00097 private:
00098
00099 Bool_t ProcessVersion( const TString& version ) const;
00100 Bool_t ProcessChecksum( const TString& checksum ) const;
00101 static void ProcessList( TObjArray* array, const TString& list );
00102 static void ProcessDeclaration( TObjArray* array, const TString& list );
00103
00104 TString fVersion;
00105 mutable std::vector<std::pair<Int_t, Int_t> >* fVersionVect;
00106 TString fChecksum;
00107 mutable std::vector<UInt_t>* fChecksumVect;
00108 TString fSourceClass;
00109 TString fTargetClass;
00110 TString fTarget;
00111 mutable TObjArray* fTargetVect;
00112 TString fSource;
00113 mutable TObjArray* fSourceVect;
00114 TString fInclude;
00115 mutable TObjArray* fIncludeVect;
00116 TString fCode;
00117 Bool_t fEmbed;
00118 ReadFuncPtr_t fReadFuncPtr;
00119 ReadRawFuncPtr_t fReadRawFuncPtr;
00120 RuleType_t fRuleType;
00121 TString fAttributes;
00122 };
00123 }
00124
00125 #endif // ROOT_TSchemaRule