Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
13class TObjArray;
14#else
15#include "TObjArray.h"
16#endif
17
18
19namespace ROOT {
20
21class TSchemaRule;
22
23namespace 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
42 };
43
45 virtual ~TSchemaRuleSet();
46
47 Bool_t AddRule(TSchemaRule *rule, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = nullptr);
48 Bool_t AddRules(TSchemaRuleSet *rules, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = nullptr);
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;
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 override;
65 void AsString(TString &out) const;
66
67 private:
68 TObjArray* fPersistentRules; // Array of the rules that will be embeded in the file
69 TObjArray* fRemainingRules; //! Array of non-persistent rules - just for cleanup purposes - owns the elements
70 TObjArray* fAllRules; //! Array of all rules
71 TClassRef fClass; //! Target class pointer (for consistency checking)
72 TString fClassName; // Target class name
73 Int_t fVersion; // Target class version
74 UInt_t fCheckSum; // Target class checksum
75
77
78 };
79
80} // End of Namespace Detail
81} // End of Namespace ROOT
82
83#endif // ROOT_TSchemaRuleSet
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
const TSchemaRule * GetRuleWithSource(const TString &name) const
Return the rule that has 'name' as a source.
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...
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...
const TSchemaRule * GetRuleWithTarget(const TString &name) const
Return the rule that has 'name' as a target.
TClassRef fClass
Array of all rules.
TString fClassName
Target class pointer (for consistency checking)
void RemoveRule(TSchemaRule *rule)
Remove given rule from the set - the rule is not being deleted!
const TMatches FindRules(const TString &source) const
Return all the rules that are about the given 'source' class.
const TObjArray * GetPersistentRules() const
Bool_t AddRule(TSchemaRule *rule, EConsistencyCheck checkConsistency=kCheckAll, TString *errmsg=nullptr)
The consistency check always fails if the TClass object was not set! if checkConsistency is: kNoCheck...
void AsString(TString &out) const
Fill the string 'out' with the string representation of the rule.
Bool_t AddRules(TSchemaRuleSet *rules, EConsistencyCheck checkConsistency=kCheckAll, TString *errmsg=nullptr)
void ls(Option_t *option="") const override
The ls function lists the contents of a class on stdout.
TObjArray * fAllRules
Array of non-persistent rules - just for cleanup purposes - owns the elements.
void SetClass(TClass *cls)
Set the TClass associated with this rule set.
void RemoveRules(TObjArray *rules)
remove given array of rules from the set - the rules are not being deleted!
const TObjArray * GetRules() const
Bool_t HasRuleWithSourceClass(const TString &source) const
Return True if we have any rule whose source class is 'source'.
virtual ~TSchemaRuleSet()
Destructor.
TSchemaRuleSet()
Default constructor.
TClassRef is used to implement a permanent reference to a TClass object.
Definition TClassRef.h:28
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.