ROOT  6.06/09
Reference Guide
TEnumConstant.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_TEnumConstant
13 #define ROOT_TEnumConstant
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TEnumConstant //
19 // //
20 // TEnumConstant class defines a constant in the TEnum type. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TGlobal
25 #include "TGlobal.h"
26 #endif
27 #ifndef ROOT_TEnum
28 #include "TEnum.h"
29 #endif
30 
31 class TEnum;
32 
33 class TEnumConstant : public TGlobal {
34 private:
35  const TEnum *fEnum; //the enum type
36  Long64_t fValue; //the value for the constant
37 
38 public:
39  TEnumConstant(): fEnum(0), fValue(-1) {}
40  TEnumConstant(DataMemberInfo_t *info, const char* name, Long64_t value, TEnum* type);
41  virtual ~TEnumConstant();
42 
43  void *GetAddress() const override { auto valPtr = &fValue; return (void*) const_cast<Long64_t*>(valPtr); }
44  Long64_t GetValue() const { return fValue; }
45  const TEnum *GetType() const { return fEnum; }
46 
47  const char *GetTypeName() const override { return fEnum->GetQualifiedName(); }
48  const char *GetFullTypeName() const override { return GetTypeName(); }
49 
50  ClassDefOverride(TEnumConstant,2) //Enum type constant
51 };
52 
53 #endif
The TEnum class implements the enum type.
Definition: TEnum.h:42
long long Long64_t
Definition: RtypesCore.h:69
const char * GetQualifiedName() const
Definition: TEnum.h:81
const TEnum * GetType() const
Definition: TEnumConstant.h:45
const char * GetFullTypeName() const override
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TEnumConstant.h:48
const char * GetTypeName() const override
Get type of global variable, e,g.
Definition: TEnumConstant.h:47
void * GetAddress() const override
Return address of global.
Definition: TEnumConstant.h:43
The TEnumConstant class implements the constants of the enum type.
Definition: TEnumConstant.h:33
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:29
Long64_t GetValue() const
Definition: TEnumConstant.h:44
const TEnum * fEnum
Definition: TEnumConstant.h:35
int type
Definition: TGX11.cxx:120
#define name(a, b)
Definition: linkTestLib0.cpp:5
#define ClassDefOverride(name, id)
Definition: Rtypes.h:258
Long64_t fValue
Definition: TEnumConstant.h:36
float value
Definition: math.cpp:443
virtual ~TEnumConstant()
Destructor.