Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TSchemaRule.h
Go to the documentation of this file.
1 // @(#)root/core:$Id$
2 // author: Lukasz Janyst <ljanyst@cern.ch>
3 
4 #ifndef ROOT_TSchemaRule
5 #define ROOT_TSchemaRule
6 
7 class TBuffer;
8 class TVirtualObject;
9 class TObjArray;
10 
11 #include "TObject.h"
12 #include "TNamed.h"
13 #include "Rtypes.h"
14 #include "TString.h"
15 
16 #include <vector>
17 #include <utility>
18 
19 namespace ROOT {
20 
21  class TSchemaRule: public TObject
22  {
23  public:
24 
25  class TSources : public TNamed {
26  private:
27  TString fDimensions;
28  public:
29  TSources(const char *name = 0, const char *title = 0, const char *dims = 0) : TNamed(name,title),fDimensions(dims) {}
30  const char *GetDimensions() { return fDimensions; }
31 
32  ClassDef(TSources,2);
33  };
34 
35  typedef enum
36  {
37  kReadRule = 0,
38  kReadRawRule = 1,
39  kNone = 99999
40  } RuleType_t;
41 
42  typedef void (*ReadFuncPtr_t)( char*, TVirtualObject* );
43  typedef void (*ReadRawFuncPtr_t)( char*, TBuffer&);
44 
45  TSchemaRule();
46  virtual ~TSchemaRule();
47 
48  TSchemaRule( const TSchemaRule& rhs );
49  TSchemaRule& operator = ( const TSchemaRule& rhs );
50  Bool_t operator == ( const TSchemaRule& rhs ) const;
51 
52 
53  void Clear(Option_t * /*option*/ ="");
54  Bool_t SetFromRule( const char *rule );
55 
56  const char *GetVersion( ) const;
57  Bool_t SetVersion( const TString& version );
58  Bool_t TestVersion( Int_t version ) const;
59  Bool_t SetChecksum( const TString& checksum );
60  Bool_t TestChecksum( UInt_t checksum ) const;
61  void SetSourceClass( const TString& classname );
62  const char *GetSourceClass() const;
63  void SetTargetClass( const TString& classname );
64  const char *GetTargetClass() const;
65  void SetTarget( const TString& target );
66  const TObjArray* GetTarget() const;
67  const char *GetTargetString() const;
68  void SetSource( const TString& source );
69  const TObjArray* GetSource() const;
70  void SetEmbed( Bool_t embed );
71  Bool_t GetEmbed() const;
72  Bool_t IsAliasRule() const;
73  Bool_t IsRenameRule() const;
74  Bool_t IsValid() const;
75  void SetCode( const TString& code );
76  const char *GetCode() const;
77  void SetAttributes( const TString& attributes );
78  const char *GetAttributes() const;
79  Bool_t HasTarget( const TString& target ) const;
80 
81  Bool_t HasSource( const TString& source ) const;
82  void SetReadFunctionPointer( ReadFuncPtr_t ptr );
83  ReadFuncPtr_t GetReadFunctionPointer() const;
84  void SetReadRawFunctionPointer( ReadRawFuncPtr_t ptr );
85  ReadRawFuncPtr_t GetReadRawFunctionPointer() const;
86  void SetInclude( const TString& include );
87  const TObjArray* GetInclude() const;
88  void SetRuleType( RuleType_t type );
89  RuleType_t GetRuleType() const;
90  Bool_t Conflicts( const TSchemaRule* rule ) const;
91 
92  void AsString( TString &out, const char *options = "" ) const;
93  void ls(Option_t *option="") const;
94 
95  ClassDef( TSchemaRule, 1 );
96 
97  private:
98 
99  Bool_t ProcessVersion( const TString& version ) const;
100  Bool_t ProcessChecksum( const TString& checksum ) const;
101  UInt_t ParseChecksum( const char* checksum ) const;
102  static void ProcessList( TObjArray* array, const TString& list );
103  static void ProcessDeclaration( TObjArray* array, const TString& list );
104 
105  TString fVersion; // Source version string
106  mutable std::vector<std::pair<Int_t, Int_t> >* fVersionVect; //! Source version vector (for searching purposes)
107  TString fChecksum; // Source checksum string
108  mutable std::vector<UInt_t>* fChecksumVect; //! Source checksum vector (for searching purposes)
109  TString fSourceClass; // Source class
110  TString fTargetClass; // Target class, this is the owner of this rule object.
111  TString fTarget; // Target data mamber string
112  mutable TObjArray* fTargetVect; //! Target data member vector (for searching purposes)
113  TString fSource; // Source data member string
114  mutable TObjArray* fSourceVect; //! Source data member vector (for searching purposes)
115  TString fInclude; // Includes string
116  mutable TObjArray* fIncludeVect; //! Includes vector
117  TString fCode; // User specified code snippet
118  Bool_t fEmbed; // Value determining if the rule should be embedded
119  ReadFuncPtr_t fReadFuncPtr; //! Conversion function pointer for read rule
120  ReadRawFuncPtr_t fReadRawFuncPtr; //! Conversion function pointer for readraw rule
121  RuleType_t fRuleType; // Type of the rule
122  TString fAttributes; // Attributes to be applied to the member (like Owner/NotOwner)
123  };
124 } // End of namespace ROOT
125 
126 #endif // ROOT_TSchemaRule