38 if (!dtTypeName.
EndsWith(
"*"))
return 0;
48 Ssiz_t GetNumSet()
const {
return fNumSet; }
61 fDMInfo(dmInfo), fOutputList(
output), fNumSet(0), fOwner(owner)
73void TSetSelDataMembers::Inspect(
TClass *cl,
const char* parent,
const char *
name,
const void *addr,
Bool_t )
80 PDB(kOutput,1) fOwner.
Info("SetDataMembers()",
81 "data member `%
s%
s::%
s' maps to
output list
object `%
s'",
84 TObject* outputObj = fOutputList->FindObject(mapping->GetTitle());
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();
122 TExMap& GetMemberPointers() {
return fMap; }
138void 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);
170TCollectDataMembers::~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'",
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())) {
304 "contradicting mapping for data member `%s' (output list entry `%s' vs. `%s'). "
305 "Cancelling automatic TSelector data member setting!",
323 while ((out = iOutput())) {
void Info(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
TClass instances represent classes, structs and namespaces in the ROOT type system.
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
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.
Collection abstract base class.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
virtual void Clear(Option_t *option="")=0
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void Add(TObject *obj)=0
All ROOT classes may have RTTI (run time type identification) support added.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Bool_t IsaPointer() const
Return true if data member is a pointer.
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
This class stores a (key,value) pair using an external hash.
THashTable implements a hash table to store TObject's.
virtual void Add(TObject *obj)
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Abstract base class for accessing the data-members of a class.
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Set the selector's data members to the corresponding elements of the output list.
Bool_t Merge(TObject *obj)
Merge another TOutputListSelectorDataMap object, check consistency.
static TOutputListSelectorDataMap * FindInList(TCollection *coll)
Find a TOutputListSelectorDataMap in a collection.
TOutputListSelectorDataMap(TSelector *sel=0)
Create a mapper between output list items and TSelector data members.
Bool_t SetDataMembers(TSelector *sel) const
Given an output list, set the data members of a TSelector.
TCollection * GetMap() const
Bool_t Init(TSelector *sel)
Initialize the data member <-> output list mapping from a selector.
const char * GetName() const
Return static name for TOutputListSelectorDataMap objects.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
virtual TList * GetOutputList() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TString & Remove(Ssiz_t pos)
std::string GetName(const std::string &scope_name)
void Init(TClassEdit::TInterpreterLookupHelper *helper)
static constexpr double s
static void output(int code)