Logo ROOT   6.14/05
Reference Guide
Go to the documentation of this file.
1 // @(#)root/cont
2 // Author: Bianca-Cristina Cristescu February 2014
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  *************************************************************************/
12 #ifndef ROOT_TListOfEnums
13 #define ROOT_TListOfEnums
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 //////////////////////////////////////////////////////////////////////////
25 #include "THashList.h"
27 #include "TDictionary.h"
29 class TExMap;
30 class TEnum;
32 class TListOfEnums : public THashList
33 {
34 private:
35  friend class TCling;
36  friend class TClass;
37  friend class TProtoClass;
38  friend class TROOT;
40  TClass *fClass; //! Context of this list. Not owned.
42  TExMap *fIds; //! Map from DeclId_t to TEnum*
43  THashList *fUnloaded; //! Holder of TEnum for unloaded Enums.
44  Bool_t fIsLoaded; //! Mark whether Load was executed.
45  ULong64_t fLastLoadMarker; //! Represent interpreter state when we last did a full load.
47  TListOfEnums(const TListOfEnums&) = delete;
48  TListOfEnums& operator=(const TListOfEnums&) = delete;
50  void MapObject(TObject *obj);
51  void UnmapObject(TObject *obj);
53  void Load();
54  void Unload();
55  void Unload(TEnum *e);
56  void SetClass(TClass* cl) { fClass = cl; }
58 public:
61 protected:
62  TClass *GetClass() const {return fClass;}
63  TExMap *GetIds() { return fIds;}
64  TEnum *FindUnloaded(const char* name) { return (TEnum*)fUnloaded->FindObject(name);}
65  TEnum *Get(DeclId_t id, const char *name);
67 public:
68  TListOfEnums(TClass *cl = 0);
69  ~TListOfEnums() override;
71  TEnum *Find(DeclId_t id) const;
72  virtual TEnum *GetObject(const char*) const;
74  void Clear(Option_t *option) override;
75  void Delete(Option_t *option="") override;
77  Bool_t IsLoaded() const { return fIsLoaded; }
78  void AddFirst(TObject *obj) override;
79  void AddFirst(TObject *obj, Option_t *opt) override;
80  void AddLast(TObject *obj) override;
81  void AddLast(TObject *obj, Option_t *opt) override;
82  void AddAt(TObject *obj, Int_t idx) override;
83  void AddAfter(const TObject *after, TObject *obj) override;
84  void AddAfter(TObjLink *after, TObject *obj) override;
85  void AddBefore(const TObject *before, TObject *obj) override;
86  void AddBefore(TObjLink *before, TObject *obj) override;
88  void RecursiveRemove(TObject *obj) override;
89  TObject *Remove(TObject *obj) override;
90  TObject *Remove(TObjLink *lnk) override;
92  ClassDefOverride(TListOfEnums,2); // List of TDataMembers for a class
93 };
95 #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:31
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
ROOT top level object description.
Definition: TROOT.h:100
Bool_t fIsLoaded
Holder of TEnum for unloaded Enums.
Definition: TListOfEnums.h:44
TListOfEnums & operator=(const TListOfEnums &)=delete
THashList * fUnloaded
Map from DeclId_t to TEnum*.
Definition: TListOfEnums.h:43
void SetClass(TClass *cl)
Definition: TListOfEnums.h:56
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:35
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:45
ClassDefOverride(TListOfEnums, 2)
Bool_t IsLoaded() const
Definition: TListOfEnums.h:77
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:262
const void * DeclId_t
Definition: TDictionary.h:205
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:42
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:34
TEnum * FindUnloaded(const char *name)
Definition: TListOfEnums.h:64
TClass * GetClass() const
Definition: TListOfEnums.h:62
friend class TCling
Definition: TListOfEnums.h:35
TClass * fClass
Definition: TListOfEnums.h:40
void AddLast(TObject *obj) override
Add object at the end of the list.
TExMap * GetIds()
Definition: TListOfEnums.h:63
~TListOfEnums() override
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:75
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:59
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:32
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:33
void AddAt(TObject *obj, Int_t idx) override
Insert object at location idx in the list.