22 using namespace ROOT::
Detail;
28 fAllRules( 0 ), fVersion(-3), fCheckSum( 0 )
33 fAllRules->SetOwner(
kTRUE );
39 TSchemaRuleSet::~TSchemaRuleSet()
41 delete fPersistentRules;
53 std::cout <<
"TSchemaRuleSet for " <<
fClassName <<
":\n";
57 while ((
object =
next())) {
58 object->ls(fClassName);
98 fPersistentRules->Add( rule );
112 bool streamerInfosTest;
120 while( (obj = titer.Next()) ) {
145 for(
auto r : rules) {
152 *errmsg =
"it conflicts with one of the other rules";
158 *errmsg =
"The existing rule is:\n ";
159 r->AsString(*errmsg,
"s");
160 *errmsg +=
"\nand the ignored rule is:\n ";
173 fPersistentRules->Add( rule );
201 while( (obj = it.
Next()) ) {
233 if (!strncmp(source,
"std::pair<",10) || !strncmp(source,
"pair<",5)) {
238 Error(
"HasRuleWithSourceClass",
"Can not find the TClass for %s when matching with %s\n",source.
Data(),
fClass->
GetName());
244 Error(
"HasRuleWithSourceClass",
"Can not find the StreamerInfo for %s when matching with %s\n",source.
Data(),
fClass->
GetName());
248 Error(
"HasRuleWithSourceClass",
"Can not find the StreamerInfo for target class %s\n",
fClass->
GetName());
251 for(
int i = 0 ; i<2 ; ++i) {
265 }
else if (targetElement->
GetClass()) {
294 while( (obj = it.
Next()) ) {
297 arr.push_back( rule );
333 while( (obj = it.
Next()) ) {
336 arr.push_back( rule );
353 while( (obj = it.
Next()) ) {
356 arr.push_back( rule );
373 while( (obj = it.
Next()) ) {
376 arr.push_back( rule );
424 return fPersistentRules;
432 fPersistentRules->Remove( rule );
445 while( (obj = it.
Next()) ) {
446 fPersistentRules->Remove( obj );
468 for(
auto rule : *
this ) {
469 if( rule->HasSource( name ) )
return rule;
479 for(
auto rule : *
this ) {
480 if( rule->HasTarget( name ) )
return rule;
493 for(
auto rule : *
this ) {
494 if( rule->HasSource( name ) ) {
496 const TObjArray *targets = rule->GetTarget();
505 if (rule->GetReadFunctionPointer() || rule->GetReadRawFunctionPointer()) {
523 for(
auto rule : *
this) {
524 if( rule->HasTarget( name ) ) {
526 const TObjArray *targets = rule->GetTarget();
530 const TObjArray *sources = rule->GetSource();
539 if (rule->GetReadFunctionPointer() || rule->GetReadRawFunctionPointer()) {
553 void TSchemaRuleSet::Streamer(
TBuffer &R__b)
virtual Int_t GetCollectionType() const =0
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...
void AsString(TString &out) const
Fill the string 'out' with the string representation of the rule.
TClassRef fClass
Array of all rules.
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
const TSchemaRule * GetRuleWithTarget(const TString &name) const
Return the rule that has 'name' as a target.
virtual Int_t GetProperties() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Bool_t TestVersion(Int_t version) const
Check if given version number is defined in this rule.
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...
Namespace for new ROOT classes and functions.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Bool_t GetEmbed() const
Return true if this rule should be saved in the ROOT File.
Collectable string class.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
virtual TClass * GetValueClass() const =0
R__EXTERN TVirtualMutex * gInterpreterMutex
void RemoveRule(TSchemaRule *rule)
Remove given rule from the set - the rule is not being deleted!
ClassImp(TSchemaRule) using namespace ROOT
void AsString(TString &out, const char *options="") const
Add to the string 'out' the string representation of the rule.
Buffer base class used for serializing objects.
virtual TObject * Remove(TObject *obj)
Remove object from array.
const TObjArray * GetRules() const
void RemoveRules(TObjArray *rules)
remove given array of rules from the set - the rules are not being deleted!
Iterator of object array.
Bool_t SetVersion(const TString &version)
Set the version string - returns kFALSE if the format is incorrect.
void SetTargetClass(const TString &classname)
Set the target class of this rule (i.e. the in memory class).
const char * Data() const
const TObjArray * GetPersistentRules() const
UInt_t GetClassCheckSum() const
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
virtual void AddAll(const TCollection *col)
TObject * Next()
Return next object in array. Returns 0 when no more objects in array.
const TSchemaRule * GetRuleWithSource(const TString &name) const
Return the rule that has 'name' as a source.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Bool_t AddRules(TSchemaRuleSet *rules, EConsistencyCheck checkConsistency=kCheckAll, TString *errmsg=0)
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
void SetSourceClass(const TString &classname)
Set the source class of this rule (i.e. the onfile class).
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
TObject * UncheckedAt(Int_t i) const
Bool_t HasRuleWithSourceClass(const TString &source) const
Return True if we have any rule whose source class is 'source'.
Bool_t TestChecksum(UInt_t checksum) const
Check if given checksum is defined in this rule.
TString GetString() const
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
virtual Bool_t HasPointers() const =0
TString fClassName
Target class pointer (for consistency checking)
void SetClass(TClass *cls)
Set the TClass associated with this rule set.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t TestBit(UInt_t f) const
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
TObjArray * fAllRules
Array of non-persisten rules - just for cleanup purposes - owns the elements.
ClassDef(TSchemaRuleSet, 1) private TObjArray * fRemainingRules
Version_t GetClassVersion() const
Int_t GetClassVersion() const
const char * GetSourceClass() const
Get the source class of this rule (i.e. the onfile class).
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
virtual const char * GetName() const
Returns name of object.
virtual TObjArray * GetElements() const =0
const TObjArray * GetTarget() const
Get the target data members of this rule (i.e. the in memory data member).
Bool_t IsValid() const
Return kTRUE if this rule is valid.
TString GetClassName() const
Int_t GetEntries() const
Return the number of objects in array (i.e.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
const TMatches FindRules(const TString &source) const
Return all the rules that are about the given 'source' class.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
TClass * GetClass() const
Mother of all ROOT objects.
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Bool_t Conflicts(const TSchemaRule *rule) const
Check if this rule conflicts with the given one.
const ROOT::Detail::TSchemaRuleSet * GetSchemaRules() const
Return the set of the schema rules if any.
const TObjArray * GetStreamerInfos() const
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
TObject * At(Int_t idx) const
Abstract Interface class describing Streamer information for one class.
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...