38 if (!dtTypeName.
EndsWith(
"*"))
return 0;
48 Ssiz_t GetNumSet()
const {
return fNumSet; }
61 fDMInfo(dmInfo), fOutputList(output), fNumSet(0), fOwner(owner)
73 void TSetSelDataMembers::Inspect(
TClass *cl,
const char* parent,
const char *
name,
const void *addr,
Bool_t )
75 while (name[0] ==
'*') ++
name;
80 PDB(kOutput,1) fOwner.
Info("SetDataMembers()",
86 PDB(kOutput,1) fOwner.
Warning("SetDataMembers()",
87 "
object `%s' not found in
output list!",
94 TClass* cldt = IsSettableDataMember(dm);
96 PDB(kOutput,1) fOwner.
Warning("SetDataMembers()",
97 "unusable
data member `%s' should have been detected by TCollectDataMembers!",
102 char *pointer = (
char*)addr;
103 char **ppointer = (
char**)(pointer);
106 fOwner.Warning(
"SetDataMembers()",
"potential memory leak: replacing data member `%s' != 0. " 107 "Please initialize %s to 0 in constructor %s::%s()",
110 *ppointer = (
char*)outputObj;
119 ~TCollectDataMembers();
121 void Inspect(
TClass *cl,
const char *parent,
const char *name,
const void *addr,
Bool_t isTransient);
122 TExMap& GetMemberPointers() {
return fMap; }
138 void TCollectDataMembers::Inspect(
TClass *cl,
const char* ,
const char *name,
const void *addr,
Bool_t )
141 if (!IsSettableDataMember(dm))
return;
143 char *pointer = (
char*)addr;
144 char **ppointer = (
char**)(pointer);
145 char **p3pointer = (
char**)(*ppointer);
153 fMap.Remove((
Long64_t)(ptrdiff_t)p3pointer);
165 if (name[0] ==
'*') ++
name;
166 PDB(kOutput,1) fOwner.
Info("
Init()", "considering
data member `%s'", name);
170 TCollectDataMembers::~TCollectDataMembers() {
177 while (iMembers.Next(key, value)) {
201 return "PROOF_TOutputListSelectorDataMap_object";
210 PDB(kOutput,1)
Warning(
"Init",
"Leave (no selector!)");
215 PDB(kOutput,1)
Info(
"Init()",
"Leave (no output)");
221 PDB(kOutput,1)
Warning(
"Init",
"Mapping already exists!");
229 TCollectDataMembers cdm(*
this);
230 if (!sel->IsA()->CallShowMembers(sel, cdm)) {
232 PDB(kOutput,1)
Warning(
"Init",
"Failed to determine mapping!");
235 PDB(kOutput,1)
Info(
"Init()",
"Found %d data members.",
236 cdm.GetMemberPointers().GetSize());
240 TIter iOutput(outList);
243 while ((output = iOutput())) {
252 addAllDM = (
TList*) obj;
258 PDB(kOutput,1)
Info(
"Init()",
"Data member `%s' corresponds to output `%s'",
259 dm->
GetName(), output->GetName());
276 TSetSelDataMembers ssdm(*
this,
fMap, output);
277 Bool_t res = sel->IsA()->CallShowMembers(sel, ssdm);
278 PDB(kOutput,1)
Info(
"SetDataMembers()",
"%s, set %d data members.",
279 (res ?
"success" :
"failure"), ssdm.GetNumSet());
290 if (!other)
return kFALSE;
295 while ((mapping = (
TNamed*)iMapping())) {
300 if (strcmp(oldMap->
GetTitle(), mapping->GetTitle())) {
304 "contradicting mapping for data member `%s' (output list entry `%s' vs. `%s'). " 305 "Cancelling automatic TSelector data member setting!",
306 mapping->GetName(), oldMap->
GetTitle(), mapping->GetTitle());
323 while ((out = iOutput())) {
virtual const char * GetName() const
Returns name of object.
virtual void Clear(Option_t *option="")=0
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
All ROOT classes may have RTTI (run time type identification) support added.
TOutputListSelectorDataMap(TSelector *sel=0)
Create a mapper between output list items and TSelector data members.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Bool_t Merge(TObject *obj)
Merge another TOutputListSelectorDataMap object, check consistency.
Abstract base class for accessing the data-members of a class.
TCollection * GetMap() const
Bool_t Init(TSelector *sel)
Initialize the data member <-> output list mapping from a selector.
static TOutputListSelectorDataMap * FindInList(TCollection *coll)
Find a TOutputListSelectorDataMap in a collection.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
THashTable implements a hash table to store TObject's.
The TNamed class is the base class for all named ROOT classes.
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Bool_t SetDataMembers(TSelector *sel) const
Given an output list, set the data members of a TSelector.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
const char * GetName() const
Return static name for TOutputListSelectorDataMap objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
Collection abstract base class.
The ROOT global object gROOT contains a list of all defined classes.
TString & Remove(Ssiz_t pos)
virtual Bool_t IsEmpty() const
Set the selector's data members to the corresponding elements of the output list. ...
static constexpr double s
virtual void Add(TObject *obj)=0
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.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Mother of all ROOT objects.
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
virtual const char * GetTitle() const
Returns title of object.
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
virtual const char * GetName() const
Returns name of object.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Bool_t IsaPointer() const
Return true if data member is a pointer.
This class stores a (key,value) pair using an external hash.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TList * GetOutputList() const