Logo ROOT  
Reference Guide
TSchemaRuleSet.h
Go to the documentation of this file.
1 // @(#)root/core:$Id$
2 // author: Lukasz Janyst <ljanyst@cern.ch>
3 
4 #ifndef ROOT_TSchemaRuleSet
5 #define ROOT_TSchemaRuleSet
6 
7 #include "TObject.h"
8 #include "TString.h"
9 #include "TClassRef.h"
10 #include <vector>
11 
12 #ifdef R__LESS_INCLUDES
13 class TObjArray;
14 #else
15 #include "TObjArray.h"
16 #endif
17 
18 
19 namespace ROOT {
20 
21 class TSchemaRule;
22 
23 namespace Detail {
24  class TSchemaRuleSet: public TObject
25  {
26  public:
27 
28  class TMatches: public std::vector<const TSchemaRule*>
29  {
30  public:
31  operator bool() { return !empty(); }
32  const TSchemaRule* GetRuleWithSource( const TString& name ) const;
33  const TSchemaRule* GetRuleWithTarget( const TString& name ) const;
34  Bool_t HasRuleWithSource( const TString& name, Bool_t needingAlloc ) const;
35  Bool_t HasRuleWithTarget( const TString& name, Bool_t willset ) const;
36  };
37 
39  kNoCheck = 0,
40  kCheckAll = 1,
42  };
43 
45  virtual ~TSchemaRuleSet();
46 
47  Bool_t AddRule( TSchemaRule* rule, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = 0 );
48  Bool_t AddRules( TSchemaRuleSet* rules, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = 0);
49  Bool_t HasRuleWithSourceClass( const TString &source) const;
50  const TMatches FindRules( const TString &source ) const;
51  const TMatches FindRules( const TString &source, Int_t version ) const;
52  const TMatches FindRules( const TString &source, UInt_t checksum ) const;
53  const TMatches FindRules( const TString &source, Int_t version, UInt_t checksum ) const;
54  TClass* GetClass();
55  UInt_t GetClassCheckSum() const;
56  TString GetClassName() const;
57  Int_t GetClassVersion() const;
58  const TObjArray* GetRules() const;
59  const TObjArray* GetPersistentRules() const;
60  void RemoveRule( TSchemaRule* rule );
61  void RemoveRules( TObjArray* rules );
62  void SetClass( TClass* cls );
63 
64  void ls(Option_t *option="") const;
65  void AsString(TString &out) const;
66 
68 
69  private:
70  TObjArray* fPersistentRules; // Array of the rules that will be embeded in the file
71  TObjArray* fRemainingRules; //! Array of non-persisten rules - just for cleanup purposes - owns the elements
72  TObjArray* fAllRules; //! Array of all rules
73  TClassRef fClass; //! Target class pointer (for consistency checking)
74  TString fClassName; // Target class name
75  Int_t fVersion; // Target class version
76  UInt_t fCheckSum; // Target class checksum
77  };
78 
79 } // End of Namespace Detail
80 } // End of Namespace ROOT
81 
82 #endif // ROOT_TSchemaRuleSet
ROOT::Detail::TSchemaRuleSet::ls
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TSchemaRuleSet.cxx:51
TObjArray
Definition: TObjArray.h:37
ROOT::Detail::TSchemaRuleSet::~TSchemaRuleSet
virtual ~TSchemaRuleSet()
Destructor.
Definition: TSchemaRuleSet.cxx:40
ROOT::Detail::TSchemaRuleSet::fCheckSum
UInt_t fCheckSum
Definition: TSchemaRuleSet.h:76
ROOT::Detail::TSchemaRuleSet::AddRules
Bool_t AddRules(TSchemaRuleSet *rules, EConsistencyCheck checkConsistency=kCheckAll, TString *errmsg=0)
Definition: TSchemaRuleSet.cxx:66
ROOT::Detail::TSchemaRuleSet::TMatches::HasRuleWithSource
Bool_t HasRuleWithSource(const TString &name, Bool_t needingAlloc) const
Return true if the set of rules has at least one rule that has the data member named 'name' as a sour...
Definition: TSchemaRuleSet.cxx:492
ROOT::Detail::TSchemaRuleSet::fClass
TClassRef fClass
Array of all rules.
Definition: TSchemaRuleSet.h:73
ROOT::Detail::TSchemaRuleSet::HasRuleWithSourceClass
Bool_t HasRuleWithSourceClass(const TString &source) const
Return True if we have any rule whose source class is 'source'.
Definition: TSchemaRuleSet.cxx:198
TString
Definition: TString.h:136
TString.h
ROOT::Detail::TSchemaRuleSet::fPersistentRules
TObjArray * fPersistentRules
Definition: TSchemaRuleSet.h:70
bool
ROOT::Detail::TSchemaRuleSet::FindRules
const TMatches FindRules(const TString &source) const
Return all the rules that are about the given 'source' class.
Definition: TSchemaRuleSet.cxx:288
ROOT::TSchemaRule
Definition: TSchemaRule.h:19
ROOT::Detail::TSchemaRuleSet::kNoCheck
@ kNoCheck
Definition: TSchemaRuleSet.h:39
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
ROOT::Detail::TSchemaRuleSet::TMatches::HasRuleWithTarget
Bool_t HasRuleWithTarget(const TString &name, Bool_t willset) const
Return true if the set of rules has at least one rule that has the data member named 'name' as a targ...
Definition: TSchemaRuleSet.cxx:522
ROOT::Detail::TSchemaRuleSet::AsString
void AsString(TString &out) const
Fill the string 'out' with the string representation of the rule.
Definition: TSchemaRuleSet.cxx:185
ROOT::Detail::TSchemaRuleSet::GetPersistentRules
const TObjArray * GetPersistentRules() const
Definition: TSchemaRuleSet.cxx:423
ROOT::Detail::TSchemaRuleSet::GetClassVersion
Int_t GetClassVersion() const
Definition: TSchemaRuleSet.cxx:409
ROOT::Detail::TSchemaRuleSet::SetClass
void SetClass(TClass *cls)
Set the TClass associated with this rule set.
Definition: TSchemaRuleSet.cxx:456
ROOT::Detail::TSchemaRuleSet::GetClassName
TString GetClassName() const
Definition: TSchemaRuleSet.cxx:402
unsigned int
ROOT::Detail::TSchemaRuleSet::TMatches::GetRuleWithTarget
const TSchemaRule * GetRuleWithTarget(const TString &name) const
Return the rule that has 'name' as a target.
Definition: TSchemaRuleSet.cxx:478
ROOT::Detail::TSchemaRuleSet::EConsistencyCheck
EConsistencyCheck
Definition: TSchemaRuleSet.h:38
ROOT::Detail::TSchemaRuleSet::TMatches::GetRuleWithSource
const TSchemaRule * GetRuleWithSource(const TString &name) const
Return the rule that has 'name' as a source.
Definition: TSchemaRuleSet.cxx:467
ROOT::Detail::TSchemaRuleSet::GetClass
TClass * GetClass()
Definition: TSchemaRuleSet.cxx:385
ROOT::Detail::TSchemaRuleSet::fRemainingRules
TObjArray * fRemainingRules
Definition: TSchemaRuleSet.h:71
TClassRef.h
TObject.h
TObjArray.h
ROOT::Detail::TSchemaRuleSet::kCheckAll
@ kCheckAll
Definition: TSchemaRuleSet.h:40
ROOT::Detail::TSchemaRuleSet::GetClassCheckSum
UInt_t GetClassCheckSum() const
Definition: TSchemaRuleSet.cxx:392
TClass
Definition: TClass.h:80
ROOT::Detail::TSchemaRuleSet::RemoveRule
void RemoveRule(TSchemaRule *rule)
Remove given rule from the set - the rule is not being deleted!
Definition: TSchemaRuleSet.cxx:431
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Detail::TSchemaRuleSet::GetRules
const TObjArray * GetRules() const
Definition: TSchemaRuleSet.cxx:416
TClassRef
Definition: TClassRef.h:28
ROOT::Detail::TSchemaRuleSet::kCheckConflict
@ kCheckConflict
Definition: TSchemaRuleSet.h:41
ROOT::Detail::TSchemaRuleSet::fVersion
Int_t fVersion
Definition: TSchemaRuleSet.h:75
ROOT::Detail::TSchemaRuleSet::TMatches
Definition: TSchemaRuleSet.h:28
ROOT::Detail::TSchemaRuleSet::AddRule
Bool_t AddRule(TSchemaRule *rule, EConsistencyCheck checkConsistency=kCheckAll, TString *errmsg=0)
The consistency check always fails if the TClass object was not set! if checkConsistency is: kNoCheck...
Definition: TSchemaRuleSet.cxx:81
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Detail::TSchemaRuleSet::RemoveRules
void RemoveRules(TObjArray *rules)
remove given array of rules from the set - the rules are not being deleted!
Definition: TSchemaRuleSet.cxx:441
ROOT::Detail::TSchemaRuleSet::fClassName
TString fClassName
Target class pointer (for consistency checking)
Definition: TSchemaRuleSet.h:74
ROOT::Detail::TSchemaRuleSet
Definition: TSchemaRuleSet.h:24
int
ROOT::Detail::TSchemaRuleSet::fAllRules
TObjArray * fAllRules
Array of non-persisten rules - just for cleanup purposes - owns the elements.
Definition: TSchemaRuleSet.h:72
ROOT::Detail::TSchemaRuleSet::TSchemaRuleSet
TSchemaRuleSet()
Default constructor.
Definition: TSchemaRuleSet.cxx:28