Logo ROOT  
Reference Guide
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 #include "TNamed.h"
8 #include "TString.h"
9 
10 #include <vector>
11 #include <utility>
12 
13 class TBuffer;
14 class TVirtualObject;
15 class TObjArray;
16 
17 namespace ROOT {
18 
19  class TSchemaRule: public TObject
20  {
21  public:
22 
23  class TSources : public TNamed {
24  private:
26  public:
27  TSources(const char *name = 0, const char *title = 0, const char *dims = 0) : TNamed(name,title),fDimensions(dims) {}
28  const char *GetDimensions() { return fDimensions; }
29 
30  ClassDef(TSources,2);
31  };
32 
33  typedef enum
34  {
35  kReadRule = 0,
37  kNone = 99999
38  } RuleType_t;
39 
40  typedef void (*ReadFuncPtr_t)( char*, TVirtualObject* );
41  typedef void (*ReadRawFuncPtr_t)( char*, TBuffer&);
42 
43  TSchemaRule();
44  virtual ~TSchemaRule();
45 
46  TSchemaRule( const TSchemaRule& rhs );
47  TSchemaRule& operator = ( const TSchemaRule& rhs );
48  Bool_t operator == ( const TSchemaRule& rhs ) const;
49 
50 
51  void Clear(Option_t * /*option*/ ="");
52  Bool_t SetFromRule( const char *rule );
53 
54  const char *GetVersion( ) const;
55  Bool_t SetVersion( const TString& version );
56  Bool_t TestVersion( Int_t version ) const;
57  Bool_t SetChecksum( const TString& checksum );
58  Bool_t TestChecksum( UInt_t checksum ) const;
59  void SetSourceClass( const TString& classname );
60  const char *GetSourceClass() const;
61  void SetTargetClass( const TString& classname );
62  const char *GetTargetClass() const;
63  void SetTarget( const TString& target );
64  const TObjArray* GetTarget() const;
65  const char *GetTargetString() const;
66  void SetSource( const TString& source );
67  const TObjArray* GetSource() const;
68  void SetEmbed( Bool_t embed );
69  Bool_t GetEmbed() const;
70  Bool_t IsAliasRule() const;
71  Bool_t IsRenameRule() const;
72  Bool_t IsValid() const;
73  void SetCode( const TString& code );
74  const char *GetCode() const;
75  void SetAttributes( const TString& attributes );
76  const char *GetAttributes() const;
77  Bool_t HasTarget( const TString& target ) const;
78 
79  Bool_t HasSource( const TString& source ) const;
84  void SetInclude( const TString& include );
85  const TObjArray* GetInclude() const;
86  void SetRuleType( RuleType_t type );
87  RuleType_t GetRuleType() const;
88  Bool_t Conflicts( const TSchemaRule* rule ) const;
89 
90  void AsString( TString &out, const char *options = "" ) const;
91  void ls(Option_t *option="") const;
92 
93  ClassDef( TSchemaRule, 1 );
94 
95  private:
96 
97  Bool_t ProcessVersion( const TString& version ) const;
98  Bool_t ProcessChecksum( const TString& checksum ) const;
99  UInt_t ParseChecksum( const char* checksum ) const;
100  static void ProcessList( TObjArray* array, const TString& list );
101  static void ProcessDeclaration( TObjArray* array, const TString& list );
102 
103  TString fVersion; // Source version string
104  mutable std::vector<std::pair<Int_t, Int_t> >* fVersionVect; //! Source version vector (for searching purposes)
105  TString fChecksum; // Source checksum string
106  mutable std::vector<UInt_t>* fChecksumVect; //! Source checksum vector (for searching purposes)
107  TString fSourceClass; // Source class
108  TString fTargetClass; // Target class, this is the owner of this rule object.
109  TString fTarget; // Target data mamber string
110  mutable TObjArray* fTargetVect; //! Target data member vector (for searching purposes)
111  TString fSource; // Source data member string
112  mutable TObjArray* fSourceVect; //! Source data member vector (for searching purposes)
113  TString fInclude; // Includes string
114  mutable TObjArray* fIncludeVect; //! Includes vector
115  TString fCode; // User specified code snippet
116  Bool_t fEmbed; // Value determining if the rule should be embedded
117  ReadFuncPtr_t fReadFuncPtr; //! Conversion function pointer for read rule
118  ReadRawFuncPtr_t fReadRawFuncPtr; //! Conversion function pointer for readraw rule
119  RuleType_t fRuleType; // Type of the rule
120  TString fAttributes; // Attributes to be applied to the member (like Owner/NotOwner)
121  };
122 } // End of namespace ROOT
123 
124 #endif // ROOT_TSchemaRule
ROOT::TSchemaRule::SetReadFunctionPointer
void SetReadFunctionPointer(ReadFuncPtr_t ptr)
Set the pointer to the function to be run for the rule (if it is a read rule).
Definition: TSchemaRule.cxx:708
TVirtualObject
Definition: TVirtualObject.h:26
ROOT::TSchemaRule::HasSource
Bool_t HasSource(const TString &source) const
Return true if one of the rule's data member source is 'source'.
Definition: TSchemaRule.cxx:690
TObjArray
Definition: TObjArray.h:37
ROOT::TSchemaRule::fVersion
TString fVersion
Definition: TSchemaRule.h:103
ROOT::TSchemaRule::ProcessChecksum
Bool_t ProcessChecksum(const TString &checksum) const
Check if specified checksum string is correct and build checksum vector.
Definition: TSchemaRule.cxx:887
ROOT::TSchemaRule::GetTarget
const TObjArray * GetTarget() const
Get the target data members of this rule (i.e. the in memory data member).
Definition: TSchemaRule.cxx:520
ROOT::TSchemaRule::ProcessList
static void ProcessList(TObjArray *array, const TString &list)
Split the list as a comma separated list into a TObjArray of TObjString.
Definition: TSchemaRule.cxx:953
ROOT::TSchemaRule::fInclude
TString fInclude
Source data member vector (for searching purposes)
Definition: TSchemaRule.h:113
ROOT::TSchemaRule::TSchemaRule
TSchemaRule()
Default Constructor.
Definition: TSchemaRule.cxx:89
ROOT::TSchemaRule::GetInclude
const TObjArray * GetInclude() const
Return the list of header files to include to be able to compile this rule as a TObjArray of TObjStri...
Definition: TSchemaRule.cxx:599
ROOT::TSchemaRule::ProcessVersion
Bool_t ProcessVersion(const TString &version) const
Check if specified version string is correct and build version vector.
Definition: TSchemaRule.cxx:842
ROOT::TSchemaRule::fEmbed
Bool_t fEmbed
Definition: TSchemaRule.h:116
ROOT::TSchemaRule::fSourceClass
TString fSourceClass
Source checksum vector (for searching purposes)
Definition: TSchemaRule.h:107
ROOT::TSchemaRule::GetSourceClass
const char * GetSourceClass() const
Get the source class of this rule (i.e. the onfile class).
Definition: TSchemaRule.cxx:466
ROOT::TSchemaRule::GetSource
const TObjArray * GetSource() const
Get the list of source members as a TObjArray of TNamed object, with the name being the member name a...
Definition: TSchemaRule.cxx:560
ROOT::TSchemaRule::TestVersion
Bool_t TestVersion(Int_t version) const
Check if given version number is defined in this rule.
Definition: TSchemaRule.cxx:402
ROOT::TSchemaRule::SetTargetClass
void SetTargetClass(const TString &classname)
Set the target class of this rule (i.e. the in memory class).
Definition: TSchemaRule.cxx:474
TNamed.h
ROOT::TSchemaRule::fRuleType
RuleType_t fRuleType
Conversion function pointer for readraw rule.
Definition: TSchemaRule.h:119
ROOT::TSchemaRule::ReadFuncPtr_t
void(* ReadFuncPtr_t)(char *, TVirtualObject *)
Definition: TSchemaRule.h:40
ROOT::TSchemaRule::IsAliasRule
Bool_t IsAliasRule() const
Return kTRUE if the rule is a strict renaming of one of the data member of the class.
Definition: TSchemaRule.cxx:748
ROOT::TSchemaRule::fReadRawFuncPtr
ReadRawFuncPtr_t fReadRawFuncPtr
Conversion function pointer for read rule.
Definition: TSchemaRule.h:118
ROOT::TSchemaRule::SetTarget
void SetTarget(const TString &target)
Set the target member of this rule (i.e. the in memory data member).
Definition: TSchemaRule.cxx:492
ROOT::TSchemaRule::SetFromRule
Bool_t SetFromRule(const char *rule)
Set the content fot this object from the rule See TClass::AddRule for details on the syntax.
Definition: TSchemaRule.cxx:321
TBuffer
Definition: TBuffer.h:43
TString
Definition: TString.h:136
ROOT::TSchemaRule::ls
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TSchemaRule.cxx:177
TString.h
ROOT::TSchemaRule::kReadRawRule
@ kReadRawRule
Definition: TSchemaRule.h:36
ROOT::TSchemaRule::ReadRawFuncPtr_t
void(* ReadRawFuncPtr_t)(char *, TBuffer &)
Definition: TSchemaRule.h:41
bool
ROOT::TSchemaRule::SetVersion
Bool_t SetVersion(const TString &version)
Set the version string - returns kFALSE if the format is incorrect.
Definition: TSchemaRule.cxx:381
ROOT::TSchemaRule::kNone
@ kNone
Definition: TSchemaRule.h:37
ROOT::TSchemaRule::SetSource
void SetSource(const TString &source)
Set the list of source members.
Definition: TSchemaRule.cxx:538
ROOT::TSchemaRule::RuleType_t
RuleType_t
Definition: TSchemaRule.h:33
ROOT::TSchemaRule
Definition: TSchemaRule.h:19
ROOT::TSchemaRule::fIncludeVect
TObjArray * fIncludeVect
Definition: TSchemaRule.h:114
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
ROOT::TSchemaRule::fTargetClass
TString fTargetClass
Definition: TSchemaRule.h:108
ROOT::TSchemaRule::SetChecksum
Bool_t SetChecksum(const TString &checksum)
Set the checksum string - returns kFALSE if the format is incorrect.
Definition: TSchemaRule.cxx:425
ROOT::TSchemaRule::AsString
void AsString(TString &out, const char *options="") const
Add to the string 'out' the string representation of the rule.
Definition: TSchemaRule.cxx:218
ROOT::TSchemaRule::fChecksumVect
std::vector< UInt_t > * fChecksumVect
Definition: TSchemaRule.h:106
ROOT::TSchemaRule::GetVersion
const char * GetVersion() const
Get the version string.
Definition: TSchemaRule.cxx:393
ROOT::TSchemaRule::~TSchemaRule
virtual ~TSchemaRule()
Destructor.
Definition: TSchemaRule.cxx:100
ROOT::TSchemaRule::SetSourceClass
void SetSourceClass(const TString &classname)
Set the source class of this rule (i.e. the onfile class).
Definition: TSchemaRule.cxx:456
ROOT::TSchemaRule::Clear
void Clear(Option_t *="")
Zero out this rule object.
Definition: TSchemaRule.cxx:297
ROOT::TSchemaRule::fSource
TString fSource
Target data member vector (for searching purposes)
Definition: TSchemaRule.h:111
TNamed
Definition: TNamed.h:29
ROOT::TSchemaRule::HasTarget
Bool_t HasTarget(const TString &target) const
Return true if one of the rule's data member target is 'target'.
Definition: TSchemaRule.cxx:672
ROOT::TSchemaRule::GetReadRawFunctionPointer
ReadRawFuncPtr_t GetReadRawFunctionPointer() const
Get the pointer to the function to be run for the rule (if it is a raw read rule).
Definition: TSchemaRule.cxx:732
ROOT::TSchemaRule::GetEmbed
Bool_t GetEmbed() const
Return true if this rule should be saved in the ROOT File.
Definition: TSchemaRule.cxx:624
ROOT::TSchemaRule::TestChecksum
Bool_t TestChecksum(UInt_t checksum) const
Check if given checksum is defined in this rule.
Definition: TSchemaRule.cxx:437
ROOT::TSchemaRule::TSources::GetDimensions
const char * GetDimensions()
Definition: TSchemaRule.h:28
ROOT::TSchemaRule::GetTargetString
const char * GetTargetString() const
Get the target data members of this rule as a simple string (i.e. the in memory data member).
Definition: TSchemaRule.cxx:512
ROOT::TSchemaRule::ParseChecksum
UInt_t ParseChecksum(const char *checksum) const
Parse the checksum in the given string.
Definition: TSchemaRule.cxx:933
ROOT::TSchemaRule::SetAttributes
void SetAttributes(const TString &attributes)
Set the attributes code of this rule.
Definition: TSchemaRule.cxx:656
void
typedef void((*Func_t)())
ROOT::TSchemaRule::TSources::fDimensions
TString fDimensions
Definition: TSchemaRule.h:25
unsigned int
ROOT::TSchemaRule::kReadRule
@ kReadRule
Definition: TSchemaRule.h:35
ROOT::TSchemaRule::fChecksum
TString fChecksum
Source version vector (for searching purposes)
Definition: TSchemaRule.h:105
ROOT::TSchemaRule::SetCode
void SetCode(const TString &code)
Set the source code of this rule.
Definition: TSchemaRule.cxx:640
ROOT::TSchemaRule::TSources
Definition: TSchemaRule.h:23
ROOT::TSchemaRule::operator==
Bool_t operator==(const TSchemaRule &rhs) const
Return true if the rule have the same effects.
Definition: TSchemaRule.cxx:147
ROOT::TSchemaRule::GetAttributes
const char * GetAttributes() const
Get the attributes code of this rule.
Definition: TSchemaRule.cxx:664
ROOT::TSchemaRule::fSourceVect
TObjArray * fSourceVect
Definition: TSchemaRule.h:112
ROOT::TSchemaRule::ProcessDeclaration
static void ProcessDeclaration(TObjArray *array, const TString &list)
Split the list as a declaration into as a TObjArray of TNamed(name,type).
Definition: TSchemaRule.cxx:974
ROOT::TSchemaRule::fReadFuncPtr
ReadFuncPtr_t fReadFuncPtr
Definition: TSchemaRule.h:117
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
ROOT::TSchemaRule::SetInclude
void SetInclude(const TString &include)
Set the comma separated list of header files to include to be able to compile this rule.
Definition: TSchemaRule.cxx:577
name
char name[80]
Definition: TGX11.cxx:110
ROOT::TSchemaRule::GetCode
const char * GetCode() const
Get the source code of this rule.
Definition: TSchemaRule.cxx:648
ROOT::TSchemaRule::GetTargetClass
const char * GetTargetClass() const
Get the targte class of this rule (i.e. the in memory class).
Definition: TSchemaRule.cxx:484
ROOT::TSchemaRule::SetRuleType
void SetRuleType(RuleType_t type)
Set the type of the rule.
Definition: TSchemaRule.cxx:740
type
int type
Definition: TGX11.cxx:121
ROOT::TSchemaRule::fVersionVect
std::vector< std::pair< Int_t, Int_t > > * fVersionVect
Definition: TSchemaRule.h:104
ROOT::TSchemaRule::IsValid
Bool_t IsValid() const
Return kTRUE if this rule is valid.
Definition: TSchemaRule.cxx:632
ROOT::TSchemaRule::SetEmbed
void SetEmbed(Bool_t embed)
Set whether this rule should be save in the ROOT file (if true)
Definition: TSchemaRule.cxx:616
ROOT::TSchemaRule::fCode
TString fCode
Includes vector.
Definition: TSchemaRule.h:115
ROOT::TSchemaRule::GetReadFunctionPointer
ReadFuncPtr_t GetReadFunctionPointer() const
Get the pointer to the function to be run for the rule (if it is a read rule).
Definition: TSchemaRule.cxx:716
ROOT::TSchemaRule::GetRuleType
RuleType_t GetRuleType() const
Return the type of the rule.
Definition: TSchemaRule.cxx:764
ROOT::TSchemaRule::fTargetVect
TObjArray * fTargetVect
Definition: TSchemaRule.h:110
ROOT::TSchemaRule::Conflicts
Bool_t Conflicts(const TSchemaRule *rule) const
Check if this rule conflicts with the given one.
Definition: TSchemaRule.cxx:772
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::TSchemaRule::SetReadRawFunctionPointer
void SetReadRawFunctionPointer(ReadRawFuncPtr_t ptr)
Set the pointer to the function to be run for the rule (if it is a raw read rule).
Definition: TSchemaRule.cxx:724
ROOT::TSchemaRule::fTarget
TString fTarget
Definition: TSchemaRule.h:109
ROOT::TSchemaRule::fAttributes
TString fAttributes
Definition: TSchemaRule.h:120
ROOT::TSchemaRule::operator=
TSchemaRule & operator=(const TSchemaRule &rhs)
Copy operator.
Definition: TSchemaRule.cxx:125
int
ROOT::TSchemaRule::IsRenameRule
Bool_t IsRenameRule() const
Return kTRUE if the rule is a strict renaming of the class to a new name.
Definition: TSchemaRule.cxx:756
ROOT::TSchemaRule::TSources::TSources
TSources(const char *name=0, const char *title=0, const char *dims=0)
Definition: TSchemaRule.h:27