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
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
44class TDataType : public TDictionary {
45
46private:
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
59protected:
60 TDataType(const TDataType&);
62
63public:
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
long Long_t
Definition: RtypesCore.h:52
#define ClassDef(name, id)
Definition: Rtypes.h:322
EDataType
Definition: TDataType.h:28
@ kNoType_t
Definition: TDataType.h:33
@ kFloat_t
Definition: TDataType.h:31
@ kULong64_t
Definition: TDataType.h:32
@ kInt_t
Definition: TDataType.h:30
@ kNumDataTypes
Definition: TDataType.h:40
@ kchar
Definition: TDataType.h:31
@ kLong_t
Definition: TDataType.h:30
@ kDouble32_t
Definition: TDataType.h:31
@ kShort_t
Definition: TDataType.h:29
@ kBool_t
Definition: TDataType.h:32
@ kBits
Definition: TDataType.h:34
@ kDataTypeAliasSignedChar_t
Definition: TDataType.h:38
@ kULong_t
Definition: TDataType.h:30
@ kLong64_t
Definition: TDataType.h:32
@ kVoid_t
Definition: TDataType.h:35
@ kUShort_t
Definition: TDataType.h:29
@ kDouble_t
Definition: TDataType.h:31
@ kCharStar
Definition: TDataType.h:34
@ kChar_t
Definition: TDataType.h:29
@ kUChar_t
Definition: TDataType.h:29
@ kDataTypeAliasUnsigned_t
Definition: TDataType.h:37
@ kCounter
Definition: TDataType.h:34
@ kUInt_t
Definition: TDataType.h:30
@ kFloat16_t
Definition: TDataType.h:33
@ kOther_t
Definition: TDataType.h:32
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
Collection abstract base class.
Definition: TCollection.h:63
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
Int_t GetType() const
Definition: TDataType.h:68
void CheckInfo()
Refresh the underlying information.
Definition: TDataType.cxx:378
virtual ~TDataType()
TDataType dtor deletes adopted CINT TypedefInfo object.
Definition: TDataType.cxx:105
TypedefInfo_t * fInfo
Definition: TDataType.h:47
static TDataType * fgBuiltins[kNumDataTypes]
Definition: TDataType.h:54
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TDataType.cxx:287
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Definition: TDataType.cxx:175
Int_t fTypeNameLen
Definition: TDataType.h:53
Int_t fSize
pointer to CINT typedef info
Definition: TDataType.h:48
Long_t fProperty
Definition: TDataType.h:50
const char * AsString(void *buf) const
Return string containing value in buffer formatted according to the basic data type.
Definition: TDataType.cxx:235
TString GetTypeName()
Get basic type of typedef, e,g.
Definition: TDataType.cxx:149
EDataType fType
Definition: TDataType.h:49
TDataType(const TDataType &)
copy constructor
Definition: TDataType.cxx:72
static void AddBuiltins(TCollection *types)
Create the TDataType objects for builtins.
Definition: TDataType.cxx:411
static TDataType * GetDataType(EDataType type)
Given a EDataType type, get the TDataType* that represents it.
Definition: TDataType.cxx:443
TDataType & operator=(const TDataType &)
assignment operator
Definition: TDataType.cxx:86
TString fTrueName
Definition: TDataType.h:51
void SetType(const char *name)
Set type id depending on name.
Definition: TDataType.cxx:296
Int_t Size() const
Get size of basic typedef'ed type.
Definition: TDataType.cxx:369
Int_t fTypeNameIdx
Definition: TDataType.h:52
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:166
Basic string class.
Definition: TString.h:131