Logo ROOT  
Reference Guide
TDataType.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Rene Brun 04/02/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TDataType
13 #define ROOT_TDataType
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TDataType //
19 // //
20 // Basic data type descriptor (datatype information is obtained from //
21 // CINT). //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TDictionary.h"
26 
27 
28 enum EDataType {
29  kChar_t = 1, kUChar_t = 11, kShort_t = 2, kUShort_t = 12,
30  kInt_t = 3, kUInt_t = 13, kLong_t = 4, kULong_t = 14,
31  kFloat_t = 5, kDouble_t = 8, kDouble32_t = 9, kchar = 10,
32  kBool_t = 18, kLong64_t = 16, kULong64_t = 17, kOther_t = -1,
34  kCounter = 6, kCharStar = 7, kBits = 15 /* for compatibility with TStreamerInfo */,
35  kVoid_t = 20,
36 
39  // could add "long int" etc
41 };
42 
43 
44 class TDataType : public TDictionary {
45 
46 private:
47  TypedefInfo_t *fInfo; //!pointer to CINT typedef info
48  Int_t fSize; //size of type
49  EDataType fType; //type id
50  Long_t fProperty; //The property information for the (potential) underlying class
51  TString fTrueName; //Qualified name of the (potential) underlying class, e.g. "MyClass*const*"
52  Int_t fTypeNameIdx; //Start of class name part of the (potential) underlying class in fTrueName
53  Int_t fTypeNameLen; //Strlen of class name part of the (potential) underlying class in fTrueName
54  static TDataType* fgBuiltins[kNumDataTypes]; //Array of builtins
55 
56  void CheckInfo();
57  void SetType(const char *name);
58 
59 protected:
60  TDataType(const TDataType&);
61  TDataType& operator=(const TDataType&);
62 
63 public:
64  TDataType(TypedefInfo_t *info = 0);
65  TDataType(const char *typenam);
66  virtual ~TDataType();
67  Int_t Size() const;
68  Int_t GetType() const { return (Int_t)fType; }
70  const char *GetFullTypeName() const;
71  const char *AsString(void *buf) const;
72  Long_t Property() const;
73 
74  static const char *GetTypeName(EDataType type);
76  static EDataType GetType(const std::type_info &typeinfo);
77  static void AddBuiltins(TCollection* types);
78 
79  ClassDef(TDataType,2) //Basic data type descriptor
80 };
81 
82 #endif
kULong64_t
@ kULong64_t
Definition: TDataType.h:32
kDouble_t
@ kDouble_t
Definition: TDataType.h:31
kUChar_t
@ kUChar_t
Definition: TDataType.h:29
kInt_t
@ kInt_t
Definition: TDataType.h:30
TDataType::fSize
Int_t fSize
pointer to CINT typedef info
Definition: TDataType.h:48
kNoType_t
@ kNoType_t
Definition: TDataType.h:33
TDataType::fTypeNameIdx
Int_t fTypeNameIdx
Definition: TDataType.h:52
kCharStar
@ kCharStar
Definition: TDataType.h:34
kLong_t
@ kLong_t
Definition: TDataType.h:30
kChar_t
@ kChar_t
Definition: TDataType.h:29
kULong_t
@ kULong_t
Definition: TDataType.h:30
TDataType::GetFullTypeName
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Definition: TDataType.cxx:175
TDataType::GetType
Int_t GetType() const
Definition: TDataType.h:68
TDataType::fType
EDataType fType
Definition: TDataType.h:49
kNumDataTypes
@ kNumDataTypes
Definition: TDataType.h:40
TDataType::fProperty
Long_t fProperty
Definition: TDataType.h:50
TDataType::AsString
const char * AsString(void *buf) const
Return string containing value in buffer formatted according to the basic data type.
Definition: TDataType.cxx:235
kUInt_t
@ kUInt_t
Definition: TDataType.h:30
TDataType::Property
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TDataType.cxx:287
TDataType::fTrueName
TString fTrueName
Definition: TDataType.h:51
TDataType::operator=
TDataType & operator=(const TDataType &)
assignment operator
Definition: TDataType.cxx:86
TDataType::TDataType
TDataType(const TDataType &)
copy constructor
Definition: TDataType.cxx:72
kchar
@ kchar
Definition: TDataType.h:31
TString
Basic string class.
Definition: TString.h:136
TDataType::fInfo
TypedefInfo_t * fInfo
Definition: TDataType.h:47
TDataType::fTypeNameLen
Int_t fTypeNameLen
Definition: TDataType.h:53
TDataType::GetDataType
static TDataType * GetDataType(EDataType type)
Given a EDataType type, get the TDataType* that represents it.
Definition: TDataType.cxx:440
kFloat16_t
@ kFloat16_t
Definition: TDataType.h:33
TDataType::SetType
void SetType(const char *name)
Set type id depending on name.
Definition: TDataType.cxx:296
TDictionary.h
kDouble32_t
@ kDouble32_t
Definition: TDataType.h:31
kCounter
@ kCounter
Definition: TDataType.h:34
TDataType::AddBuiltins
static void AddBuiltins(TCollection *types)
Create the TDataType objects for builtins.
Definition: TDataType.cxx:408
kDataTypeAliasUnsigned_t
@ kDataTypeAliasUnsigned_t
Definition: TDataType.h:37
TDataType
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
kUShort_t
@ kUShort_t
Definition: TDataType.h:29
Long_t
long Long_t
Definition: RtypesCore.h:54
kLong64_t
@ kLong64_t
Definition: TDataType.h:32
kFloat_t
@ kFloat_t
Definition: TDataType.h:31
kVoid_t
@ kVoid_t
Definition: TDataType.h:35
TDictionary
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:162
kOther_t
@ kOther_t
Definition: TDataType.h:32
TDataType::CheckInfo
void CheckInfo()
Refresh the underlying information.
Definition: TDataType.cxx:375
EDataType
EDataType
Definition: TDataType.h:28
kBits
@ kBits
Definition: TDataType.h:34
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TDataType::GetTypeName
TString GetTypeName()
Get basic type of typedef, e,g.
Definition: TDataType.cxx:149
name
char name[80]
Definition: TGX11.cxx:110
kDataTypeAliasSignedChar_t
@ kDataTypeAliasSignedChar_t
Definition: TDataType.h:38
TCollection
Collection abstract base class.
Definition: TCollection.h:63
TDataType::fgBuiltins
static TDataType * fgBuiltins[kNumDataTypes]
Definition: TDataType.h:54
type
int type
Definition: TGX11.cxx:121
kShort_t
@ kShort_t
Definition: TDataType.h:29
kBool_t
@ kBool_t
Definition: TDataType.h:32
TDataType::~TDataType
virtual ~TDataType()
TDataType dtor deletes adopted CINT TypedefInfo object.
Definition: TDataType.cxx:105
TDataType::Size
Int_t Size() const
Get size of basic typedef'ed type.
Definition: TDataType.cxx:366
int