Logo ROOT   6.18/05
Reference Guide
TListOfDataMembers.h
Go to the documentation of this file.
1// @(#)root/cont
2// Author: Philippe Canal Aug 2013
3
4/*************************************************************************
5 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TListOfDataMembers
13#define ROOT_TListOfDataMembers
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TListOfDataMembers //
18// //
19// A collection of TDataMember objects designed for fast access given a //
20// DeclId_t and for keep track of TDataMember that were described //
21// unloaded member. //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "THashList.h"
26
27#include "TDictionary.h"
28
29class TExMap;
30class TDataMember;
31
33{
34private:
35 TClass *fClass; //! Context of this list. Not owned.
36
37 TExMap *fIds; //! Map from DeclId_t to TDataMember*
38 THashList *fUnloaded; //! Holder of TDataMember for unloaded DataMembers.
39 Bool_t fIsLoaded; //! Mark whether Load was executed.
40 ULong64_t fLastLoadMarker; //! Represent interpreter state when we last did a full load.
41
42 TListOfDataMembers(const TListOfDataMembers&); // not implemented
43 TListOfDataMembers& operator=(const TListOfDataMembers&); // not implemented
44
45 void MapObject(TObject *obj);
46 void UnmapObject(TObject *obj);
47
48public:
50
52 // construct from a generic collection of data members objects
53 template<class DataMemberList>
54 TListOfDataMembers(DataMemberList & dmlist) :
55 fClass(0),fIds(0),fUnloaded(0),
57 {
58 for (auto * dataMember : dmlist)
59 Add(dataMember);
60 }
61
63
64 virtual void Clear(Option_t *option);
65 virtual void Delete(Option_t *option="");
66
68 virtual TObject *FindObject(const char *name) const;
69
70 TDictionary *Find(DeclId_t id) const;
72 TDictionary *Get(DataMemberInfo_t *info, bool skipChecks=kFALSE);
73
74 Bool_t IsLoaded() const { return fIsLoaded; }
75 void AddFirst(TObject *obj);
76 void AddFirst(TObject *obj, Option_t *opt);
77 void AddLast(TObject *obj);
78 void AddLast(TObject *obj, Option_t *opt);
79 void AddAt(TObject *obj, Int_t idx);
80 void AddAfter(const TObject *after, TObject *obj);
81 void AddAfter(TObjLink *after, TObject *obj);
82 void AddBefore(const TObject *before, TObject *obj);
83 void AddBefore(TObjLink *before, TObject *obj);
84
85 TClass *GetClass() const { return fClass; }
86 void SetClass(TClass* cl) { fClass = cl; }
87 void Update(TDictionary *member);
88
89 void RecursiveRemove(TObject *obj);
90 TObject *Remove(TObject *obj);
91 TObject *Remove(TObjLink *lnk);
92
93 void Load();
94 void Unload();
95 void Unload(TDictionary *member);
96
97 ClassDef(TListOfDataMembers,2); // List of TDataMembers for a class
98};
99
100#endif // ROOT_TListOfDataMembers
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
unsigned long long ULong64_t
Definition: RtypesCore.h:70
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:159
const void * DeclId_t
Definition: TDictionary.h:206
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
A collection of TDataMember objects designed for fast access given a DeclId_t and for keep track of T...
void AddAt(TObject *obj, Int_t idx)
Insert object at location idx in the list.
Bool_t fIsLoaded
Holder of TDataMember for unloaded DataMembers.
TDictionary::DeclId_t DeclId_t
void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
TDictionary * Find(DeclId_t id) const
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
Bool_t IsLoaded() const
void SetClass(TClass *cl)
void Update(TDictionary *member)
Move the member or data member to the expect set of list.
void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
ULong64_t fLastLoadMarker
Mark whether Load was executed.
void AddLast(TObject *obj)
Add object at the end of the list.
~TListOfDataMembers()
Destructor.
void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
TObject * Remove(TObject *obj)
Remove object from the list.
TExMap * fIds
Context of this list. Not owned.
TListOfDataMembers & operator=(const TListOfDataMembers &)
void AddFirst(TObject *obj)
Add object at the beginning of the list.
TListOfDataMembers(DataMemberList &dmlist)
void UnmapObject(TObject *obj)
Remove a pair<id, object> from the map of data members and their ids.
virtual void Clear(Option_t *option)
Remove all objects from the list.
TListOfDataMembers(const TListOfDataMembers &)
Represent interpreter state when we last did a full load.
virtual void Delete(Option_t *option="")
Delete all TDataMember object files.
TClass * GetClass() const
void MapObject(TObject *obj)
Add a pair<id, object> to the map of data members and their ids.
void Unload()
Mark 'all func' as being unloaded.
THashList * fUnloaded
Map from DeclId_t to TDataMember*.
virtual TObject * FindObject(const char *name) const
Specialize FindObject to do search for the a data member just by name or create it if its not already...
TDictionary * Get(DeclId_t id)
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' into this collection.
virtual void Add(TObject *obj)
Definition: TList.h:87
Mother of all ROOT objects.
Definition: TObject.h:37