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