Logo ROOT   6.12/07
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);
75  static TDataType *GetDataType(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
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
void SetType(const char *name)
Set type id depending on name.
Definition: TDataType.cxx:296
static TDataType * fgBuiltins[kNumDataTypes]
Definition: TDataType.h:54
Basic string class.
Definition: TString.h:125
TypedefInfo_t * fInfo
Definition: TDataType.h:47
int Int_t
Definition: RtypesCore.h:41
Long_t fProperty
Definition: TDataType.h:50
#define ClassDef(name, id)
Definition: Rtypes.h:320
Int_t GetType() const
Definition: TDataType.h:68
virtual ~TDataType()
TDataType dtor deletes adopted CINT TypedefInfo object.
Definition: TDataType.cxx:105
Int_t fSize
pointer to CINT typedef info
Definition: TDataType.h:48
TDataType(const TDataType &)
copy constructor
Definition: TDataType.cxx:72
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
Collection abstract base class.
Definition: TCollection.h:63
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TDataType.cxx:287
Int_t fTypeNameLen
Definition: TDataType.h:53
long Long_t
Definition: RtypesCore.h:50
TString fTrueName
Definition: TDataType.h:51
int type
Definition: TGX11.cxx:120
EDataType
Definition: TDataType.h:28
static void AddBuiltins(TCollection *types)
Create the TDataType objects for builtins.
Definition: TDataType.cxx:408
const char * AsString(void *buf) const
Return string containing value in buffer formatted according to the basic data type.
Definition: TDataType.cxx:235
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Definition: TDataType.cxx:175
TDataType & operator=(const TDataType &)
assignment operator
Definition: TDataType.cxx:86
Int_t Size() const
Get size of basic typedef'ed type.
Definition: TDataType.cxx:366
void CheckInfo()
Refresh the underlying information.
Definition: TDataType.cxx:375
EDataType fType
Definition: TDataType.h:49
char name[80]
Definition: TGX11.cxx:109
Int_t fTypeNameIdx
Definition: TDataType.h:52