Logo ROOT  
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 #include "THashList.h"
26 
27 #include "TDictionary.h"
28 
29 class TExMap;
30 class TEnum;
31 
32 class TListOfEnums : public THashList
33 {
34 private:
35  friend class TCling;
36  friend class TClass;
37  friend class TProtoClass;
38  friend class TROOT;
39 
40  TClass *fClass; //! Context of this list. Not owned.
41 
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.
46 
47  TListOfEnums(const TListOfEnums&) = delete;
48  TListOfEnums& operator=(const TListOfEnums&) = delete;
49 
50  void MapObject(TObject *obj);
51  void UnmapObject(TObject *obj);
52 
53  void Load();
54  void Unload();
55  void Unload(TEnum *e);
56  void SetClass(TClass* cl) { fClass = cl; }
57 
58 public:
60 
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);
66 
67 public:
68  TListOfEnums(TClass *cl = 0);
69  ~TListOfEnums() override;
70 
71  TEnum *Find(DeclId_t id) const;
72  virtual TEnum *GetObject(const char*) const;
73 
74  void Clear(Option_t *option) override;
75  void Delete(Option_t *option="") override;
76 
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;
87 
88  void RecursiveRemove(TObject *obj) override;
89  TObject *Remove(TObject *obj) override;
90  TObject *Remove(TObjLink *lnk) override;
91 
92  ClassDefOverride(TListOfEnums,2); // List of TDataMembers for a class
93 };
94 
95 #endif // ROOT_TListOfEnums
TListOfEnums::UnmapObject
void UnmapObject(TObject *obj)
Remove a pair<id, object> from the map of functions and their ids.
Definition: TListOfEnums.cxx:261
TListOfEnums::AddAt
void AddAt(TObject *obj, Int_t idx) override
Insert object at location idx in the list.
Definition: TListOfEnums.cxx:111
e
#define e(i)
Definition: RSha256.hxx:121
TListOfEnums::AddLast
void AddLast(TObject *obj) override
Add object at the end of the list.
Definition: TListOfEnums.cxx:89
TListOfEnums::operator=
TListOfEnums & operator=(const TListOfEnums &)=delete
TListOfEnums::Load
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' into this collection.
Definition: TListOfEnums.cxx:322
TListOfEnums::SetClass
void SetClass(TClass *cl)
Definition: TListOfEnums.h:56
TListOfEnums::TListOfEnums
TListOfEnums(const TListOfEnums &)=delete
Represent interpreter state when we last did a full load.
TListOfEnums::Get
TEnum * Get(DeclId_t id, const char *name)
Return (after creating it if necessary) the TEnum describing the enum corresponding to the Decl 'id'.
Definition: TListOfEnums.cxx:190
TListOfEnums::~TListOfEnums
~TListOfEnums() override
Destructor.
Definition: TListOfEnums.cxx:45
TListOfEnums::IsLoaded
Bool_t IsLoaded() const
Definition: TListOfEnums.h:77
Int_t
int Int_t
Definition: RtypesCore.h:45
TListOfEnums::FindUnloaded
TEnum * FindUnloaded(const char *name)
Definition: TListOfEnums.h:64
TDictionary::DeclId_t
const typedef void * DeclId_t
Definition: TDictionary.h:209
TCling
Definition: TCling.h:101
bool
TROOT
Definition: TROOT.h:94
TListOfEnums::AddBefore
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
Definition: TListOfEnums.cxx:138
TListOfEnums::Unload
void Unload()
Mark 'all func' as being unloaded.
Definition: TListOfEnums.cxx:382
TListOfEnums::Clear
void Clear(Option_t *option) override
Remove all objects from the list.
Definition: TListOfEnums.cxx:157
TDictionary.h
TProtoClass
Definition: TProtoClass.h:38
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TListOfEnums::ClassDefOverride
ClassDefOverride(TListOfEnums, 2)
TListOfEnums::DeclId_t
TDictionary::DeclId_t DeclId_t
Definition: TListOfEnums.h:59
THashList
Definition: THashList.h:34
THashList::FindObject
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
TEnum
Definition: TEnum.h:33
TListOfEnums::GetIds
TExMap * GetIds()
Definition: TListOfEnums.h:63
THashList.h
TListOfEnums::Remove
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition: TListOfEnums.cxx:290
TListOfEnums
Definition: TListOfEnums.h:32
ULong64_t
unsigned long long ULong64_t
Definition: RtypesCore.h:74
TListOfEnums::fIsLoaded
Bool_t fIsLoaded
Holder of TEnum for unloaded Enums.
Definition: TListOfEnums.h:44
TListOfEnums::GetClass
TClass * GetClass() const
Definition: TListOfEnums.h:62
TListOfEnums::AddFirst
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
Definition: TListOfEnums.cxx:67
TClass
Definition: TClass.h:80
TListOfEnums::fClass
TClass * fClass
Definition: TListOfEnums.h:40
TObject
Definition: TObject.h:37
TListOfEnums::fIds
TExMap * fIds
Context of this list. Not owned.
Definition: TListOfEnums.h:42
TListOfEnums::GetObject
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.
Definition: TListOfEnums.cxx:253
name
char name[80]
Definition: TGX11.cxx:110
TListOfEnums::Find
TEnum * Find(DeclId_t id) const
Return the TEnum corresponding to the Decl 'id' or NULL if it does not exist.
Definition: TListOfEnums.cxx:179
TExMap
Definition: TExMap.h:33
TListOfEnums::fLastLoadMarker
ULong64_t fLastLoadMarker
Mark whether Load was executed.
Definition: TListOfEnums.h:45
TListOfEnums::RecursiveRemove
void RecursiveRemove(TObject *obj) override
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition: TListOfEnums.cxx:278
TListOfEnums::Delete
void Delete(Option_t *option="") override
Delete all TDataMember object files.
Definition: TListOfEnums.cxx:168
TListOfEnums::MapObject
void MapObject(TObject *obj)
Add pair<id, object> to the map of functions and their ids.
Definition: TListOfEnums.cxx:56
TListOfEnums::fUnloaded
THashList * fUnloaded
Map from DeclId_t to TEnum*.
Definition: TListOfEnums.h:43
TListOfEnums::AddAfter
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
Definition: TListOfEnums.cxx:120