File indexing completed on 2025-01-18 10:12:24
0001
0002
0003
0004 #ifndef ROOT_TSchemaRuleSet
0005 #define ROOT_TSchemaRuleSet
0006
0007 #include "TObject.h"
0008 #include "TString.h"
0009 #include "TClassRef.h"
0010 #include <vector>
0011
0012 #ifdef R__LESS_INCLUDES
0013 class TObjArray;
0014 #else
0015 #include "TObjArray.h"
0016 #endif
0017
0018
0019 namespace ROOT {
0020
0021 class TSchemaRule;
0022
0023 namespace Detail {
0024 class TSchemaRuleSet: public TObject
0025 {
0026 public:
0027
0028 class TMatches: public std::vector<const TSchemaRule*>
0029 {
0030 public:
0031 operator bool() { return !empty(); }
0032 const TSchemaRule* GetRuleWithSource( const TString& name ) const;
0033 const TSchemaRule* GetRuleWithTarget( const TString& name ) const;
0034 Bool_t HasRuleWithSource( const TString& name, Bool_t needingAlloc ) const;
0035 Bool_t HasRuleWithTarget( const TString& name, Bool_t willset ) const;
0036 };
0037
0038 enum EConsistencyCheck {
0039 kNoCheck = 0,
0040 kCheckAll = 1,
0041 kCheckConflict = 2
0042 };
0043
0044 TSchemaRuleSet();
0045 virtual ~TSchemaRuleSet();
0046
0047 Bool_t AddRule(TSchemaRule *rule, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = nullptr);
0048 Bool_t AddRules(TSchemaRuleSet *rules, EConsistencyCheck checkConsistency = kCheckAll, TString *errmsg = nullptr);
0049 Bool_t HasRuleWithSourceClass( const TString &source) const;
0050 const TMatches FindRules( const TString &source ) const;
0051 const TMatches FindRules( const TString &source, Int_t version ) const;
0052 const TMatches FindRules( const TString &source, UInt_t checksum ) const;
0053 const TMatches FindRules( const TString &source, Int_t version, UInt_t checksum ) const;
0054 TClass* GetClass();
0055 UInt_t GetClassCheckSum() const;
0056 TString GetClassName() const;
0057 Int_t GetClassVersion() const;
0058 const TObjArray* GetRules() const;
0059 const TObjArray* GetPersistentRules() const;
0060 void RemoveRule( TSchemaRule* rule );
0061 void RemoveRules( TObjArray* rules );
0062 void SetClass( TClass* cls );
0063
0064 void ls(Option_t *option="") const override;
0065 void AsString(TString &out) const;
0066
0067 private:
0068 TObjArray* fPersistentRules;
0069 TObjArray* fRemainingRules;
0070 TObjArray* fAllRules;
0071 TClassRef fClass;
0072 TString fClassName;
0073 Int_t fVersion;
0074 UInt_t fCheckSum;
0075
0076 ClassDefOverride( TSchemaRuleSet, 1 )
0077
0078 };
0079
0080 }
0081 }
0082
0083 #endif