Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:37:31

0001 // @(#)root/meta:$Id$
0002 // Author: Rene Brun   04/02/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TDataType
0013 #define ROOT_TDataType
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TDataType                                                            //
0019 //                                                                      //
0020 // Basic data type descriptor (datatype information is obtained from    //
0021 // CINT).                                                               //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "TDictionary.h"
0026 #include <cstddef>
0027 
0028 enum EDataType {
0029    kChar_t   = 1,  kUChar_t  = 11, kShort_t    = 2,  kUShort_t = 12,
0030    kInt_t    = 3,  kUInt_t   = 13, kLong_t     = 4,  kULong_t  = 14,
0031    kFloat_t  = 5,  kDouble_t =  8, kDouble32_t = 9,  kchar     = 10,
0032    kBool_t   = 18, kLong64_t = 16, kULong64_t  = 17, kOther_t  = -1,
0033    kNoType_t = 0,  kFloat16_t= 19,
0034    kCounter  =  6, kCharStar = 7,  kBits     = 15 /* for compatibility with TStreamerInfo */,
0035    kVoid_t   = 20,
0036 
0037    kDataTypeAliasUnsigned_t = 21,
0038    kDataTypeAliasSignedChar_t = 22,
0039    // could add "long int" etc
0040    kNumDataTypes
0041 };
0042 
0043 
0044 class TDataType : public TDictionary {
0045 
0046 private:
0047    TypedefInfo_t    *fInfo;     ///<!pointer to CINT typedef info
0048    Int_t             fSize;     // size of type
0049    UInt_t            fAlignOf;  // alignment of type (0 if unknown)
0050    EDataType         fType;     //type id
0051    Long_t            fProperty; //The property information for the (potential) underlying class
0052    TString           fTrueName; //Qualified name of the (potential) underlying class, e.g. "MyClass*const*"
0053    Int_t             fTypeNameIdx; //Start of class name part of the (potential) underlying class in fTrueName
0054    Int_t             fTypeNameLen; //Strlen of class name part of the (potential) underlying class in fTrueName
0055    static TDataType* fgBuiltins[kNumDataTypes]; //Array of builtins
0056 
0057    void CheckInfo();
0058    void SetType(const char *name);
0059 
0060 protected:
0061    TDataType(const TDataType&);
0062    TDataType& operator=(const TDataType&);
0063 
0064 public:
0065    TDataType(TypedefInfo_t *info = nullptr);
0066    TDataType(const char *typenam);
0067    virtual       ~TDataType();
0068    Int_t          Size() const;
0069    /// Return the alignment of the type in bytes, or 0 if unknown.
0070    std::size_t    GetAlignOf() const { return fAlignOf; }
0071    Int_t          GetType() const { return (Int_t)fType; }
0072    TString        GetTypeName();
0073    const char    *GetFullTypeName() const;
0074    const char    *AsString(void *buf) const;
0075    Long_t         Property() const override;
0076 
0077    static const char *GetTypeName(EDataType type);
0078    static TDataType  *GetDataType(EDataType type);
0079    static EDataType GetType(const std::type_info &typeinfo);
0080    static void AddBuiltins(TCollection* types);
0081 
0082    ClassDefOverride(TDataType,3)  //Basic data type descriptor
0083 };
0084 
0085 #endif