Logo ROOT   6.10/09
Reference Guide
TEnum.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Bianca-Cristina Cristescu 09/07/13
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_TEnum
13 #define ROOT_TEnum
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TEnum //
18 // //
19 // TEnum class defines enum type. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TNamed.h"
24 #include "THashList.h"
25 #include "TString.h"
26 #include "TDictionary.h"
27 
28 class TClass;
29 class TEnumConstant;
30 
31 class TEnum : public TDictionary {
32 
33 private:
34  THashList fConstantList; //list of constants the enum type
35  void *fInfo; //!interpreter implementation provided declaration
36  TClass *fClass; //!owning class
37  std::string fQualName; // fully qualified type name
38 
39 public:
40 
41  enum ESearchAction {kNone = 0,
42  kAutoload = 1,
45  };
46 
47  TEnum(): fInfo(0), fClass(0) {}
48  TEnum(const char *name, void *info, TClass *cls);
49  virtual ~TEnum();
50 
51  void AddConstant(TEnumConstant *constant);
52  TClass *GetClass() const {
53  return fClass;
54  }
55  const TSeqCollection *GetConstants() const {
56  return &fConstantList;
57  }
58  const TEnumConstant *GetConstant(const char *name) const {
59  return (TEnumConstant *) fConstantList.FindObject(name);
60  }
61  DeclId_t GetDeclId() const {
62  return (DeclId_t)fInfo;
63  }
64  Bool_t IsValid();
65  Long_t Property() const;
66  void SetClass(TClass *cl) {
67  fClass = cl;
68  }
69  void Update(DeclId_t id);
70  const char* GetQualifiedName() const { return fQualName.c_str(); }
71  static TEnum *GetEnum(const std::type_info &ti, ESearchAction sa = kALoadAndInterpLookup);
72  static TEnum *GetEnum(const char *enumName, ESearchAction sa = kALoadAndInterpLookup);
73 
74  ClassDef(TEnum, 2) //Enum type class
75 };
76 
77 #endif
The TEnum class implements the enum type.
Definition: TEnum.h:31
void Update(DeclId_t id)
Definition: TEnum.cxx:101
TEnum()
Definition: TEnum.h:47
bool Bool_t
Definition: RtypesCore.h:59
TClass * fClass
interpreter implementation provided declaration
Definition: TEnum.h:36
const char * GetQualifiedName() const
Definition: TEnum.h:70
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:213
const TSeqCollection * GetConstants() const
Definition: TEnum.h:55
const void * DeclId_t
Definition: TDictionary.h:205
DeclId_t GetDeclId() const
Definition: TEnum.h:61
virtual ~TEnum()
Destructor.
Definition: TEnum.cxx:61
Sequenceable collection abstract base class.
#define ClassDef(name, id)
Definition: Rtypes.h:297
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
The TEnumConstant class implements the constants of the enum type.
Definition: TEnumConstant.h:29
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
void SetClass(TClass *cl)
Definition: TEnum.h:66
void AddConstant(TEnumConstant *constant)
Add a EnumConstant to the list of constants of the Enum Type.
Definition: TEnum.cxx:68
std::string fQualName
owning class
Definition: TEnum.h:37
long Long_t
Definition: RtypesCore.h:50
Bool_t IsValid()
Return true if this enum object is pointing to a currently loaded enum.
Definition: TEnum.cxx:78
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Definition: TEnum.cxx:108
void * fInfo
Definition: TEnum.h:35
TClass * GetClass() const
Definition: TEnum.h:52
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TEnum.cxx:94
ESearchAction
Definition: TEnum.h:41
THashList fConstantList
Definition: TEnum.h:34
const TEnumConstant * GetConstant(const char *name) const
Definition: TEnum.h:58