Logo ROOT   6.18/05
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
29class TExMap;
30class TEnum;
31
32class TListOfEnums : public THashList
33{
34private:
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;
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
58public:
60
61protected:
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
67public:
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
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
unsigned long long ULong64_t
Definition: RtypesCore.h:70
const char Option_t
Definition: RtypesCore.h:62
char name[80]
Definition: TGX11.cxx:109
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
This class defines an interface to the cling C++ interpreter.
Definition: TCling.h:89
const void * DeclId_t
Definition: TDictionary.h:206
The TEnum class implements the enum type.
Definition: TEnum.h:33
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 TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
Definition: TListOfEnums.h:33
TEnum * FindUnloaded(const char *name)
Definition: TListOfEnums.h:64
TEnum * Find(DeclId_t id) const
Return the TEnum corresponding to the Decl 'id' or NULL if it does not exist.
~TListOfEnums() override
Destructor.
TExMap * fIds
Context of this list. Not owned.
Definition: TListOfEnums.h:42
TClass * fClass
Definition: TListOfEnums.h:40
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
TDictionary::DeclId_t DeclId_t
Definition: TListOfEnums.h:59
TEnum * Get(DeclId_t id, const char *name)
Return (after creating it if necessary) the TEnum describing the enum corresponding to the Decl 'id'.
void Delete(Option_t *option="") override
Delete all TDataMember object files.
TListOfEnums(const TListOfEnums &)=delete
Represent interpreter state when we last did a full load.
Bool_t fIsLoaded
Holder of TEnum for unloaded Enums.
Definition: TListOfEnums.h:44
ULong64_t fLastLoadMarker
Mark whether Load was executed.
Definition: TListOfEnums.h:45
void AddAt(TObject *obj, Int_t idx) override
Insert object at location idx in the list.
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
TListOfEnums & operator=(const TListOfEnums &)=delete
TClass * GetClass() const
Definition: TListOfEnums.h:62
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.
void SetClass(TClass *cl)
Definition: TListOfEnums.h:56
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' into this collection.
Bool_t IsLoaded() const
Definition: TListOfEnums.h:77
TObject * Remove(TObject *obj) override
Remove object from the list.
THashList * fUnloaded
Map from DeclId_t to TEnum*.
Definition: TListOfEnums.h:43
void MapObject(TObject *obj)
Add pair<id, object> to the map of functions and their ids.
void AddLast(TObject *obj) override
Add object at the end of the list.
void UnmapObject(TObject *obj)
Remove a pair<id, object> from the map of functions and their ids.
void RecursiveRemove(TObject *obj) override
Remove object from this collection and recursively remove the object from all other objects (and coll...
TExMap * GetIds()
Definition: TListOfEnums.h:63
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
ClassDefOverride(TListOfEnums, 2)
void Clear(Option_t *option) override
Remove all objects from the list.
void Unload()
Mark 'all func' as being unloaded.
Mother of all ROOT objects.
Definition: TObject.h:37
Persistent version of a TClass.
Definition: TProtoClass.h:35
ROOT top level object description.
Definition: TROOT.h:102