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, 35 kNoType_t = 0, kFloat16_t= 19, 36 kCounter = 6, kCharStar = 7, kBits = 15 /* for compatibility with TStreamerInfo */, 37 kVoid_t = 20, 38 39 kDataTypeAliasUnsigned_t = 21, 40 // could add "long int" etc 41 kNumDataTypes 42 }; 43 44 45 class TDataType : public TDictionary { 46 47 private: 48 TypedefInfo_t *fInfo; //pointer to CINT typedef info 49 Int_t fSize; //size of type 50 EDataType fType; //type id 51 Long_t fProperty; //The property information for the (potential) underlying class 52 TString fTrueName; //True name of the (potential) underlying class 53 static TDataType* fgBuiltins[kNumDataTypes]; //Array of builtins 54 55 void CheckInfo(); 56 void SetType(const char *name); 57 58 protected: 59 TDataType(const TDataType&); 60 TDataType& operator=(const TDataType&); 61 62 public: 63 TDataType(TypedefInfo_t *info = 0); 64 TDataType(const char *typenam); 65 virtual ~TDataType(); 66 Int_t Size() const; 67 Int_t GetType() const { return (Int_t)fType; } 68 const char *GetTypeName() const; 69 const char *GetFullTypeName() const; 70 const char *AsString(void *buf) const; 71 Long_t Property() const; 72 73 static const char *GetTypeName(EDataType type); 74 static TDataType *GetDataType(EDataType type); 75 static EDataType GetType(const type_info &typeinfo); 76 static void AddBuiltins(TCollection* types); 77 78 ClassDef(TDataType,0) //Basic data type descriptor 79 }; 80 81 #endif 82 83