Logo ROOT  
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 "TDataType.h"
24#include "TDictionary.h"
25#include "THashList.h"
26
27#include <string>
28
29class ClassInfo_t;
30class TClass;
31class TEnumConstant;
32
33class TEnum : public TDictionary {
34
35private:
36 THashList fConstantList; //list of constants the enum type
37 ClassInfo_t *fInfo; //!interpreter information, owned by TEnum
38 TClass *fClass; //!owning class
39 std::string fQualName; // fully qualified type name
40
41 enum EBits {
42 kBitIsScopedEnum = BIT(14) ///< The enum is an enum class.
43 };
44
45public:
46
51 };
52
53 TEnum(): fInfo(nullptr), fClass(nullptr) {}
54 TEnum(const char *name, DeclId_t declid, TClass *cls);
55 virtual ~TEnum();
56
57 void AddConstant(TEnumConstant *constant);
58 TClass *GetClass() const { return fClass; }
59 const TSeqCollection *GetConstants() const { return &fConstantList; }
60 const TEnumConstant *GetConstant(const char *name) const { return (TEnumConstant *)fConstantList.FindObject(name); }
61 DeclId_t GetDeclId() const;
64 Long_t Property() const;
65 void SetClass(TClass *cl) { fClass = cl; }
66 void Update(DeclId_t id);
67 const char* GetQualifiedName() const { return fQualName.c_str(); }
68 static TEnum *GetEnum(const std::type_info &ti, ESearchAction sa = kALoadAndInterpLookup);
69 static TEnum *GetEnum(const char *enumName, ESearchAction sa = kALoadAndInterpLookup);
70
71 ClassDef(TEnum, 2) //Enum type class
72};
73
74#endif
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define BIT(n)
Definition: Rtypes.h:83
EDataType
Definition: TDataType.h:28
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 abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:162
const void * DeclId_t
Definition: TDictionary.h:209
The TEnumConstant class implements the constants of the enum type.
Definition: TEnumConstant.h:29
The TEnum class implements the enum type.
Definition: TEnum.h:33
EDataType GetUnderlyingType() const
Get the unterlying integer type of the enum: enum E { kOne }; // ==> int enum F: long; // ==> long Re...
Definition: TEnum.cxx:107
EBits
Definition: TEnum.h:41
@ kBitIsScopedEnum
The enum is an enum class.
Definition: TEnum.h:42
THashList fConstantList
Definition: TEnum.h:36
TClass * GetClass() const
Definition: TEnum.h:58
void AddConstant(TEnumConstant *constant)
Add a EnumConstant to the list of constants of the Enum Type.
Definition: TEnum.cxx:71
const char * GetQualifiedName() const
Definition: TEnum.h:67
const TSeqCollection * GetConstants() const
Definition: TEnum.h:59
const TEnumConstant * GetConstant(const char *name) const
Definition: TEnum.h:60
ClassInfo_t * fInfo
Definition: TEnum.h:37
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TEnum.cxx:96
TClass * fClass
interpreter information, owned by TEnum
Definition: TEnum.h:38
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Definition: TEnum.cxx:143
void Update(DeclId_t id)
Definition: TEnum.cxx:126
Bool_t IsValid()
Return true if this enum object is pointing to a currently loaded enum.
Definition: TEnum.cxx:81
DeclId_t GetDeclId() const
Definition: TEnum.cxx:116
std::string fQualName
owning class
Definition: TEnum.h:39
ESearchAction
Definition: TEnum.h:47
@ kALoadAndInterpLookup
Definition: TEnum.h:50
@ kNone
Definition: TEnum.h:47
@ kAutoload
Definition: TEnum.h:48
@ kInterpLookup
Definition: TEnum.h:49
TEnum()
Definition: TEnum.h:53
virtual ~TEnum()
Destructor.
Definition: TEnum.cxx:63
void SetClass(TClass *cl)
Definition: TEnum.h:65
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
Sequenceable collection abstract base class.