Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 TObject *FindObject(const char*) const override;
76
77 void Clear(Option_t *option) override;
78 void Delete(Option_t *option="") override;
79
80 Bool_t IsLoaded() const { return fIsLoaded; }
81 void AddFirst(TObject *obj) override;
82 void AddFirst(TObject *obj, Option_t *opt) override;
83 void AddLast(TObject *obj) override;
84 void AddLast(TObject *obj, Option_t *opt) override;
85 void AddAt(TObject *obj, Int_t idx) override;
86 void AddAfter(const TObject *after, TObject *obj) override;
87 void AddAfter(TObjLink *after, TObject *obj) override;
88 void AddBefore(const TObject *before, TObject *obj) override;
89 void AddBefore(TObjLink *before, TObject *obj) override;
90
91 void RecursiveRemove(TObject *obj) override;
92 TObject *Remove(TObject *obj) override;
93 TObject *Remove(TObjLink *lnk) override;
94
95 ClassDefOverride(TListOfEnums,2); // List of TDataMembers for a class
96};
97
98#endif // ROOT_TListOfEnums
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
unsigned long long ULong64_t
Definition RtypesCore.h:81
const char Option_t
Definition RtypesCore.h:66
char name[80]
Definition TGX11.cxx:110
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
This class defines an interface to the cling C++ interpreter.
Definition TCling.h:102
const void * DeclId_t
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.
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
TEnum * FindUnloaded(const char *name)
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.
TClass * fClass
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
TDictionary::DeclId_t DeclId_t
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.
ULong64_t fLastLoadMarker
Mark whether Load was executed.
void AddAt(TObject *obj, Int_t idx) override
Insert object at location idx in the list.
TObject * FindObject(const char *) const override
Specialize FindObject to do search for the a enum just by name or create it if its not already in the...
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
TListOfEnums & operator=(const TListOfEnums &)=delete
TClass * GetClass() const
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)
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' into this collection.
Bool_t IsLoaded() const
TObject * Remove(TObject *obj) override
Remove object from the list.
THashList * fUnloaded
Map from DeclId_t to TEnum*.
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()
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:41
Persistent version of a TClass.
Definition TProtoClass.h:38
ROOT top level object description.
Definition TROOT.h:94