Logo ROOT   6.14/05
Reference Guide
Go to the documentation of this file.
1 // @(#)root/core:$Id$
2 // author: Lukasz Janyst <ljanyst@cern.ch>
4 #ifndef ROOT_TSchemaRuleSet
5 #define ROOT_TSchemaRuleSet
7 class TClass;
9 #include "TObject.h"
10 #include "TObjArray.h"
11 #include "Rtypes.h"
12 #include "TString.h"
13 #include "TClassRef.h"
15 namespace ROOT {
17 class TSchemaRule;
19 namespace Detail {
20  class TSchemaRuleSet: public TObject
21  {
22  public:
24  class TMatches: public std::vector<const TSchemaRule*>
25  {
26  public:
27  operator bool() { return !empty(); }
28  const TSchemaRule* GetRuleWithSource( const TString& name ) const;
29  const TSchemaRule* GetRuleWithTarget( const TString& name ) const;
30  Bool_t HasRuleWithSource( const TString& name, Bool_t needingAlloc ) const;
31  Bool_t HasRuleWithTarget( const TString& name, Bool_t willset ) const;
32  };
35  kNoCheck = 0,
36  kCheckAll = 1,
38  };
41  virtual ~TSchemaRuleSet();
43  Bool_t AddRule( TSchemaRule* rule, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = 0 );
44  Bool_t AddRules( TSchemaRuleSet* rules, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = 0);
45  Bool_t HasRuleWithSourceClass( const TString &source) const;
46  const TMatches FindRules( const TString &source ) const;
47  const TMatches FindRules( const TString &source, Int_t version ) const;
48  const TMatches FindRules( const TString &source, UInt_t checksum ) const;
49  const TMatches FindRules( const TString &source, Int_t version, UInt_t checksum ) const;
50  TClass* GetClass();
51  UInt_t GetClassCheckSum() const;
52  TString GetClassName() const;
53  Int_t GetClassVersion() const;
54  const TObjArray* GetRules() const;
55  const TObjArray* GetPersistentRules() const;
56  void RemoveRule( TSchemaRule* rule );
57  void RemoveRules( TObjArray* rules );
58  void SetClass( TClass* cls );
60  void ls(Option_t *option="") const;
61  void AsString(TString &out) const;
65  private:
66  TObjArray* fPersistentRules; // Array of the rules that will be embeded in the file
67  TObjArray* fRemainingRules; //! Array of non-persisten rules - just for cleanup purposes - owns the elements
68  TObjArray* fAllRules; //! Array of all rules
69  TClassRef fClass; //! Target class pointer (for consistency checking)
70  TString fClassName; // Target class name
71  Int_t fVersion; // Target class version
72  UInt_t fCheckSum; // Target class checksum
73  };
75 } // End of Namespace Detail
76 } // End of Namespace ROOT
78 #endif // ROOT_TSchemaRuleSet
Bool_t HasRuleWithSourceClass(const TString &source) const
Return True if we have any rule whose source class is &#39;source&#39;.
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...
An array of TObjects.
Definition: TObjArray.h:37
TClassRef fClass
Array of all rules.
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
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 &#39;name&#39; as a targ...
const char Option_t
Definition: RtypesCore.h:62
void RemoveRule(TSchemaRule *rule)
Remove given rule from the set - the rule is not being deleted!
const TSchemaRule * GetRuleWithTarget(const TString &name) const
Return the rule that has &#39;name&#39; as a target.
virtual ~TSchemaRuleSet()
Default constructor.
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void RemoveRules(TObjArray *rules)
remove given array of rules from the set - the rules are not being deleted!
void AsString(TString &out) const
Fill the string &#39;out&#39; with the string representation of the rule.
#define ClassDef(name, id)
Definition: Rtypes.h:320
Bool_t AddRules(TSchemaRuleSet *rules, EConsistencyCheck checkConsistency=kCheckAll, TString *errmsg=0)
const TObjArray * GetRules() const
const TMatches FindRules(const TString &source) const
Return all the rules that are about the given &#39;source&#39; class.
TString fClassName
Target class pointer (for consistency checking)
void SetClass(TClass *cls)
Set the TClass associated with this rule set.
unsigned int UInt_t
Definition: RtypesCore.h:42
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
TObjArray * fAllRules
Array of non-persisten rules - just for cleanup purposes - owns the elements.
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 &#39;name&#39; as a sour...
const TSchemaRule * GetRuleWithSource(const TString &name) const
Return the rule that has &#39;name&#39; as a source.
Mother of all ROOT objects.
Definition: TObject.h:37
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:29
char name[80]
Definition: TGX11.cxx:109
const TObjArray * GetPersistentRules() const