Logo ROOT   6.08/07
Reference Guide
TListOfEnums.h
Go to the documentation of this file.
1 // @(#)root/cont
2 // Author: Bianca-Cristina Cristescu February 2014
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_TListOfEnums
13 #define ROOT_TListOfEnums
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TListOfEnums //
18 // //
19 // A collection of TEnum objects designed for fast access given a //
20 // DeclId_t and for keep track of TEnum that were described //
21 // unloaded enum. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_THastList
26 #include "THashList.h"
27 #endif
28 
29 #ifndef ROOT_TDictionary
30 #include "TDictionary.h"
31 #endif
32 
33 class TExMap;
34 class TEnum;
35 
36 class TListOfEnums : public THashList
37 {
38 private:
39  friend class TCling;
40  friend class TClass;
41  friend class TProtoClass;
42  friend class TROOT;
43 
44  TClass *fClass; //! Context of this list. Not owned.
45 
46  TExMap *fIds; //! Map from DeclId_t to TEnum*
47  THashList *fUnloaded; //! Holder of TEnum for unloaded Enums.
48  Bool_t fIsLoaded; //! Mark whether Load was executed.
49  ULong64_t fLastLoadMarker; //! Represent interpreter state when we last did a full load.
50 
51  TListOfEnums(const TListOfEnums&) = delete;
52  TListOfEnums& operator=(const TListOfEnums&) = delete;
53 
54  void MapObject(TObject *obj);
55  void UnmapObject(TObject *obj);
56 
57  void Load();
58  void Unload();
59  void Unload(TEnum *e);
60  void SetClass(TClass* cl) { fClass = cl; }
61 
62 public:
64 
65 protected:
66  TClass *GetClass() const {return fClass;}
67  TExMap *GetIds() { return fIds;}
68  TEnum *FindUnloaded(const char* name) { return (TEnum*)fUnloaded->FindObject(name);}
69  TEnum *Get(DeclId_t id, const char *name);
70 
71 public:
72  TListOfEnums(TClass *cl = 0);
73  ~TListOfEnums() override;
74 
75  TEnum *Find(DeclId_t id) const;
76  virtual TEnum *GetObject(const char*) const;
77 
78  void Clear(Option_t *option) override;
79  void Delete(Option_t *option="") override;
80 
81  Bool_t IsLoaded() const { return fIsLoaded; }
82  void AddFirst(TObject *obj) override;
83  void AddFirst(TObject *obj, Option_t *opt) override;
84  void AddLast(TObject *obj) override;
85  void AddLast(TObject *obj, Option_t *opt) override;
86  void AddAt(TObject *obj, Int_t idx) override;
87  void AddAfter(const TObject *after, TObject *obj) override;
88  void AddAfter(TObjLink *after, TObject *obj) override;
89  void AddBefore(const TObject *before, TObject *obj) override;
90  void AddBefore(TObjLink *before, TObject *obj) override;
91 
92  void RecursiveRemove(TObject *obj) override;
93  TObject *Remove(TObject *obj) override;
94  TObject *Remove(TObjLink *lnk) override;
95 
96  ClassDefOverride(TListOfEnums,2); // List of TDataMembers for a class
97 };
98 
99 #endif // ROOT_TListOfEnums
void MapObject(TObject *obj)
Add pair<id, object> to the map of functions and their ids.
The TEnum class implements the enum type.
Definition: TEnum.h:42
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
ROOT top level object description.
Definition: TROOT.h:104
Bool_t fIsLoaded
Holder of TEnum for unloaded Enums.
Definition: TListOfEnums.h:48
TListOfEnums & operator=(const TListOfEnums &)=delete
THashList * fUnloaded
Map from DeclId_t to TEnum*.
Definition: TListOfEnums.h:47
void SetClass(TClass *cl)
Definition: TListOfEnums.h:60
const char Option_t
Definition: RtypesCore.h:62
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
Persistent version of a TClass.
Definition: TProtoClass.h:37
TEnum * Get(DeclId_t id, const char *name)
Return (after creating it if necessary) the TEnum describing the enum corresponding to the Decl &#39;id&#39;...
ULong64_t fLastLoadMarker
Mark whether Load was executed.
Definition: TListOfEnums.h:49
ClassDefOverride(TListOfEnums, 2)
Bool_t IsLoaded() const
Definition: TListOfEnums.h:81
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:213
const void * DeclId_t
Definition: TDictionary.h:209
void RecursiveRemove(TObject *obj) override
Remove object from this collection and recursively remove the object from all other objects (and coll...
TListOfEnums(const TListOfEnums &)=delete
Represent interpreter state when we last did a full load.
TExMap * fIds
Context of this list. Not owned.
Definition: TListOfEnums.h:46
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
TEnum * FindUnloaded(const char *name)
Definition: TListOfEnums.h:68
TClass * GetClass() const
Definition: TListOfEnums.h:66
TClass * fClass
Definition: TListOfEnums.h:44
This class defines an interface to the cling C++ interpreter.
Definition: TCling.h:92
void AddLast(TObject *obj) override
Add object at the end of the list.
TExMap * GetIds()
Definition: TListOfEnums.h:67
~TListOfEnums() override
Destructor.
virtual TEnum * GetObject(const char *) const
Return an object from the list of enums if and only if is has already been loaded in the list...
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
void UnmapObject(TObject *obj)
Remove a pair<id, object> from the map of functions and their ids.
TObject * Remove(TObject *obj) override
Remove object from the list.
TDictionary::DeclId_t DeclId_t
Definition: TListOfEnums.h:63
void Clear(Option_t *option) override
Remove all objects from the list.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
void Delete(Option_t *option="") override
Delete all TDataMember object files.
void Load()
Load all the DataMembers known to the interpreter for the scope &#39;fClass&#39; into this collection...
Mother of all ROOT objects.
Definition: TObject.h:37
void Unload()
Mark &#39;all func&#39; as being unloaded.
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
Definition: TListOfEnums.h:36
TEnum * Find(DeclId_t id) const
Return the TEnum corresponding to the Decl &#39;id&#39; or NULL if it does not exist.
char name[80]
Definition: TGX11.cxx:109
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:35
void AddAt(TObject *obj, Int_t idx) override
Insert object at location idx in the list.