Logo ROOT   6.14/05
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 #include "TGlobal.h"
25 #include "TEnum.h"
26 
27 class TEnum;
28 
29 class TEnumConstant : public TGlobal {
30 private:
31  const TEnum *fEnum; //the enum type
32  Long64_t fValue; //the value for the constant
33 
34 public:
35  TEnumConstant(): fEnum(0), fValue(-1) {}
36  TEnumConstant(DataMemberInfo_t *info, const char* name, Long64_t value, TEnum* type);
37  virtual ~TEnumConstant();
38 
39  void *GetAddress() const override { auto valPtr = &fValue; return (void*) const_cast<Long64_t*>(valPtr); }
40  Long64_t GetValue() const { return fValue; }
41  const TEnum *GetType() const { return fEnum; }
42 
43  const char *GetTypeName() const override { return fEnum->GetQualifiedName(); }
44  const char *GetFullTypeName() const override { return GetTypeName(); }
45 
46  ClassDefOverride(TEnumConstant,2) //Enum type constant
47 };
48 
49 #endif
The TEnum class implements the enum type.
Definition: TEnum.h:31
long long Long64_t
Definition: RtypesCore.h:69
const TEnum * GetType() const
Definition: TEnumConstant.h:41
const char * GetQualifiedName() const
Definition: TEnum.h:70
const char * GetFullTypeName() const override
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TEnumConstant.h:44
const char * GetTypeName() const override
Get type of global variable, e,g.
Definition: TEnumConstant.h:43
void * GetAddress() const override
Return address of global.
Definition: TEnumConstant.h:39
The TEnumConstant class implements the constants of the enum type.
Definition: TEnumConstant.h:29
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:27
const TEnum * fEnum
Definition: TEnumConstant.h:31
int type
Definition: TGX11.cxx:120
Long64_t GetValue() const
Definition: TEnumConstant.h:40
#define ClassDefOverride(name, id)
Definition: Rtypes.h:324
Long64_t fValue
Definition: TEnumConstant.h:32
virtual ~TEnumConstant()
Destructor.
char name[80]
Definition: TGX11.cxx:109