39 if (!dtTypeName.
EndsWith(
"*"))
return 0;
48 void Inspect(
TClass *cl,
const char *parent,
const char *name,
const void *addr,
Bool_t isTransient);
49 Ssiz_t GetNumSet()
const {
return fNumSet; }
62 fDMInfo(dmInfo), fOutputList(output), fNumSet(0), fOwner(owner)
76 while (name[0] ==
'*') ++
name;
81 PDB(kOutput,1) fOwner.
Info("SetDataMembers()",
82 "data member `%s%s::%s' maps to
output list
object `%s'",
83 cl->GetName(), parent, name, mapping->GetTitle());
85 TObject* outputObj = fOutputList->FindObject(mapping->GetTitle());
87 PDB(kOutput,1) fOwner.
Warning("SetDataMembers()",
88 "
object `%s' not found in
output list!",
95 TClass* cldt = IsSettableDataMember(dm);
97 PDB(kOutput,1) fOwner.
Warning("SetDataMembers()",
98 "unusable data member `%s' should have been detected by TCollectDataMembers!",
103 char *pointer = (
char*)addr;
104 char **ppointer = (
char**)(pointer);
107 fOwner.Warning(
"SetDataMembers()",
"potential memory leak: replacing data member `%s' != 0. "
108 "Please initialize %s to 0 in constructor %s::%s()",
111 *ppointer = (
char*)outputObj;
120 ~TCollectDataMembers();
122 void Inspect(
TClass *cl,
const char *parent,
const char *name,
const void *addr,
Bool_t isTransient);
123 TExMap& GetMemberPointers() {
return fMap; }
142 if (!IsSettableDataMember(dm))
return;
144 char *pointer = (
char*)addr;
145 char **ppointer = (
char**)(pointer);
146 char **p3pointer = (
char**)(*ppointer);
154 fMap.Remove((
Long64_t)(ptrdiff_t)p3pointer);
166 if (name[0] ==
'*') ++
name;
167 PDB(kOutput,1) fOwner.
Info("Init()", "considering data member `%s'", name);
171 TCollectDataMembers::~TCollectDataMembers() {
178 while (iMembers.Next(key, value)) {
202 return "PROOF_TOutputListSelectorDataMap_object";
211 PDB(kOutput,1)
Warning(
"Init",
"Leave (no selector!)");
216 PDB(kOutput,1)
Info(
"Init()",
"Leave (no output)");
222 PDB(kOutput,1)
Warning(
"Init",
"Mapping already exists!");
230 TCollectDataMembers cdm(*
this);
241 Error(
"Init",
"failed to get TSelectorCint interpreted class!");
246 PDB(kOutput,1)
Warning(
"Init",
"Failed to determine mapping!");
249 PDB(kOutput,1)
Info(
"Init()",
"Found %d data members.",
250 cdm.GetMemberPointers().GetSize());
254 TIter iOutput(outList);
257 while ((output = iOutput())) {
266 addAllDM = (
TList*) obj;
272 PDB(kOutput,1)
Info(
"Init()",
"Data member `%s' corresponds to output `%s'",
273 dm->
GetName(), output->GetName());
291 TSetSelDataMembers ssdm(*
this,
fMap, output);
303 Error(
"Init",
"failed to get TSelectorCint interpreted class!");
308 PDB(kOutput,1)
Info(
"SetDataMembers()",
"%s, set %d data members.",
309 (res ?
"success" :
"failure"), ssdm.GetNumSet());
311 PDB(kOutput,1)
Warning(
"SetDataMembers",
"Failed to determine selector TClass!");
323 if (!other)
return kFALSE;
328 while ((mapping = (
TNamed*)iMapping())) {
333 if (strcmp(oldMap->
GetTitle(), mapping->GetTitle())) {
337 "contradicting mapping for data member `%s' (output list entry `%s' vs. `%s'). "
338 "Cancelling automatic TSelector data member setting!",
339 mapping->GetName(), oldMap->
GetTitle(), mapping->GetTitle());
356 while ((out = iOutput())) {
virtual void Clear(Option_t *option="")=0
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
virtual TList * GetOutputList() const
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.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Bool_t IsaPointer() const
Return true if data member is a pointer.
Abstract base class for accessing the data-members of a class.
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
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.
ClassImp(TOutputListSelectorDataMap)
THashTable implements a hash table to store TObject's.
The TNamed class is the base class for all named ROOT classes.
virtual Bool_t IsEmpty() const
if(pyself &&pyself!=Py_None)
void Info(const char *location, const char *msgfmt,...)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * GetName() const
Return static name for TOutputListSelectorDataMap objects.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Collection abstract base class.
Bool_t SetDataMembers(TSelector *sel) const
Given an output list, set the data members of a TSelector.
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
TCollection * GetMap() const
void Warning(const char *location, const char *msgfmt,...)
Bool_t CallShowMembers(const void *obj, TMemberInspector &insp, Bool_t isTransient=kFALSE) const
Call ShowMembers() on the obj of this class type, passing insp and parent.
TString & Remove(Ssiz_t pos)
virtual TClass * GetInterpretedClass() const
Retrieve the TClass object for the interpreted class.
Set the selector's data members to the corresponding elements of the output list. ...
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.
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
Mother of all ROOT objects.
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
virtual void Add(TObject *obj)
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
This class is a special version of TSelector for user interpreted classes.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
static void output(int code)
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual TSelector * GetInterpretedSelector() const
This class stores a (key,value) pair using an external hash.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.