| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# DataTypeInfo Class Reference

`#include <GaudiKernel/DataTypeInfo.h>`

List of all members.

## Detailed Description

Small class which allows access to internal type IDs.

Definition at line 17 of file DataTypeInfo.h.

## Public Types
enum | Type { UNKNOWN = 0, UCHAR, USHORT, UINT, ULONG, CHAR, SHORT, INT, LONG, BOOL, FLOAT, DOUBLE, STRING, NTCHAR, OBJECT_REF, CONTAINED_REF, POINTER, OBJECT_ADDR, LONG_STRING, LONG_NTCHAR }
## Static Public Member Functions
static const Type | ID (const bool)
| Access to type information: bool.
static const Type | ID (const char)
| Access to type information: char.
static const Type | ID (const short)
| Access to type information: short.
static const Type | ID (const int)
| Access to type information: int.
static const Type | ID (const long)
| Access to type information: long.
static const Type | ID (const unsigned char)
| Access to type information: unsigned char.
static const Type | ID (const unsigned short)
| Access to type information: unsigned short.
static const Type | ID (const unsigned int)
| Access to type information: unsigned int.
static const Type | ID (const unsigned long)
| Access to type information: unsigned long.
static const Type | ID (const float)
| Access to type information: float.
static const Type | ID (const double)
| Access to type information: float.
static const Type | ID (const std::string &)
| Access to type information: std::string.
static const Type | ID (const char *)
| Access to type information: char* (NULL terminated).
static const Type | ID (const IOpaqueAddress *)
| Access to type information: IOpaqueAddress.
static const Type | ID (const void *)
| Access to type information: Pointers.
static const Type | ID (const SmartRef< DataObject > &)
| Access to type information: DataObject.
static const Type | ID (const SmartRef< ContainedObject > &)
| Access to type information: Contained object.
static const Type | ID (const std::type_info &typ)
| Access to type information: the reverse way.
static const std::type_info & | type (long typ)
| Access to type information: the reverse way.
static const long | size (long typ)
| Access to type information: the reverse way.
static const long | size (const std::type_info &typ)
| Access to type information: the reverse way.
static const int | copy (void *tar, const void *src, long typ, int numObj)
| Copy data.
static const std::string | name (long typ)
static const std::string | name (const std::type_info &typ)
static const Type | idByName (const std::string &typ)
| Access to type information.
static const std::type_info & | typeByName (const std::string &typ)
| Access to type information.
## Private Member Functions
| DataTypeInfo ()

## Member Enumeration Documentation

enum DataTypeInfo::Type

Enumerator:

  UNKNOWN |
  UCHAR |
  USHORT |
  UINT |
  ULONG |
  CHAR |
  SHORT |
  INT |
  LONG |
  BOOL |
  FLOAT |
  DOUBLE |
  STRING |
  NTCHAR |
  OBJECT_REF |
  CONTAINED_REF |
  POINTER |
  OBJECT_ADDR |
  LONG_STRING |
  LONG_NTCHAR |

Definition at line 23 of file DataTypeInfo.h.

    00023              {
    00024         UNKNOWN = 0,
    00025         UCHAR,        USHORT,        UINT,        ULONG,
    00026         CHAR,         SHORT,         INT,         LONG,
    00027         BOOL,         FLOAT,         DOUBLE,
    00028         STRING,       NTCHAR,
    00029         OBJECT_REF, CONTAINED_REF, POINTER, OBJECT_ADDR,
    00030         LONG_STRING,  LONG_NTCHAR
    00031   };

## Constructor & Destructor Documentation

DataTypeInfo::DataTypeInfo | ( |  | ) | `[inline, private]`

Definition at line 20 of file DataTypeInfo.h.

    00020 {}

## Member Function Documentation

static const Type DataTypeInfo::ID | ( | const | bool | ) | `[inline, static]`

Access to type information: bool.

Definition at line 33 of file DataTypeInfo.h.

References BOOL.

Referenced by NTuple::_DataImp< TYP >::_DataImp(), and size().

    00033 { return BOOL;          }

static const Type DataTypeInfo::ID | ( | const | char | ) | `[inline, static]`

Access to type information: char.

Definition at line 35 of file DataTypeInfo.h.

References CHAR.

    00035 { return CHAR;          }

static const Type DataTypeInfo::ID | ( | const | short | ) | `[inline, static]`

Access to type information: short.

Definition at line 37 of file DataTypeInfo.h.

References SHORT.

    00037 { return SHORT;         }

static const Type DataTypeInfo::ID | ( | const | int | ) | `[inline, static]`

Access to type information: int.

Definition at line 39 of file DataTypeInfo.h.

References INT.

    00039 { return INT;           }

static const Type DataTypeInfo::ID | ( | const | long | ) | `[inline, static]`

Access to type information: long.

Definition at line 41 of file DataTypeInfo.h.

References LONG.

    00041 { return LONG;          }

static const Type DataTypeInfo::ID | ( | const unsigned | char | ) | `[inline, static]`

Access to type information: unsigned char.

Definition at line 43 of file DataTypeInfo.h.

References UCHAR.

    00043 { return UCHAR;         }

static const Type DataTypeInfo::ID | ( | const unsigned | short | ) | `[inline, static]`

Access to type information: unsigned short.

Definition at line 45 of file DataTypeInfo.h.

References USHORT.

    00045 { return USHORT;        }

static const Type DataTypeInfo::ID | ( | const unsigned | int | ) | `[inline, static]`

Access to type information: unsigned int.

Definition at line 47 of file DataTypeInfo.h.

References UINT.

    00047 { return UINT;          }

static const Type DataTypeInfo::ID | ( | const unsigned | long | ) | `[inline, static]`

Access to type information: unsigned long.

Definition at line 49 of file DataTypeInfo.h.

References ULONG.

    00049 { return ULONG;         }

static const Type DataTypeInfo::ID | ( | const | float | ) | `[inline, static]`

Access to type information: float.

Definition at line 51 of file DataTypeInfo.h.

References FLOAT.

    00051 { return FLOAT;         }

static const Type DataTypeInfo::ID | ( | const | double | ) | `[inline, static]`

Access to type information: float.

Definition at line 53 of file DataTypeInfo.h.

References DOUBLE.

    00053 { return DOUBLE;        }

static const Type DataTypeInfo::ID | ( | const std::string & |  | ) | `[inline, static]`

Access to type information: std::string.

Definition at line 55 of file DataTypeInfo.h.

References STRING.

    00055 { return STRING;        }

static const Type DataTypeInfo::ID | ( | const char * |  | ) | `[inline, static]`

Access to type information: char* (NULL terminated).

Definition at line 57 of file DataTypeInfo.h.

References NTCHAR.

    00057 { return NTCHAR;        }

static const Type DataTypeInfo::ID | ( | const IOpaqueAddress * |  | ) | `[inline, static]`

Access to type information: IOpaqueAddress.

Definition at line 59 of file DataTypeInfo.h.

References OBJECT_ADDR.

    00059 { return OBJECT_ADDR;   }

static const Type DataTypeInfo::ID | ( | const void * |  | ) | `[inline, static]`

Access to type information: Pointers.

Definition at line 61 of file DataTypeInfo.h.

References POINTER.

    00061 { return POINTER;       }

static const Type DataTypeInfo::ID | ( | const SmartRef< DataObject > & |  | ) | `[inline, static]`

Access to type information: DataObject.

Definition at line 63 of file DataTypeInfo.h.

References OBJECT_REF.

    00063 { return OBJECT_REF;    }

static const Type DataTypeInfo::ID | ( | const SmartRef< ContainedObject > & |  | ) | `[inline, static]`

Access to type information: Contained object.

Definition at line 65 of file DataTypeInfo.h.

References CONTAINED_REF.

    00065 { return CONTAINED_REF; }

static const Type DataTypeInfo::ID | ( | const std::type_info & | typ | ) | `[inline, static]`

Access to type information: the reverse way.

Definition at line 68 of file DataTypeInfo.h.

References BOOL, CHAR, CONTAINED_REF, DOUBLE, FLOAT, INT, LONG, NTCHAR, OBJECT_ADDR, OBJECT_REF, POINTER, SHORT, STRING, UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

    00068                                                     {
    00069     if ( typ == typeid(unsigned char) )
    00070       return UCHAR;
    00071     else if ( typ == typeid(unsigned short) )
    00072       return USHORT;
    00073     else if ( typ == typeid(unsigned int) )
    00074       return UINT;
    00075     else if ( typ == typeid(unsigned long) )
    00076       return ULONG;
    00077     else if ( typ == typeid(char) )
    00078       return CHAR;
    00079     else if ( typ == typeid(short) )
    00080       return SHORT;
    00081     else if ( typ == typeid(int) )
    00082       return INT;
    00083     else if ( typ == typeid(long) )
    00084       return LONG;
    00085     else if ( typ == typeid(bool) )
    00086       return BOOL;
    00087     else if ( typ == typeid(float) )
    00088       return FLOAT;
    00089     else if ( typ == typeid(double) )
    00090       return DOUBLE;
    00091     else if ( typ == typeid(std::string) )
    00092       return STRING;
    00093     else if ( typ == typeid(char*) )
    00094       return NTCHAR;
    00095     else if ( typ == typeid(SmartRef<DataObject>) )
    00096       return OBJECT_REF;
    00097     else if ( typ == typeid(SmartRef<ContainedObject>) )
    00098       return CONTAINED_REF;
    00099     else if ( typ == typeid(IOpaqueAddress*) )
    00100       return OBJECT_ADDR;
    00101     else if ( typ == typeid(void*) )
    00102       return POINTER;
    00103     else
    00104       return UNKNOWN;
    00105   }

static const std::type_info& DataTypeInfo::type | ( | long | typ | ) | `[inline, static]`

Access to type information: the reverse way.

Definition at line 108 of file DataTypeInfo.h.

References BOOL, CHAR, CONTAINED_REF, DOUBLE, FLOAT, INT, int(), LONG, LONG_NTCHAR, LONG_STRING, NTCHAR, OBJECT_ADDR, OBJECT_REF, POINTER, SHORT, STRING, UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

    00108                                                 {
    00109     switch(typ)   {
    00110     case UCHAR:
    00111       return typeid(unsigned char);
    00112     case USHORT:
    00113       return typeid(unsigned short);
    00114     case UINT:
    00115       return typeid(unsigned int);
    00116     case ULONG:
    00117       return typeid(unsigned long);
    00118     case CHAR:
    00119       return typeid(char);
    00120     case SHORT:
    00121       return typeid(short);
    00122     case INT:
    00123       return typeid(int);
    00124     case LONG:
    00125       return typeid(long);
    00126     case BOOL:
    00127       return typeid(bool);
    00128     case FLOAT:
    00129       return typeid(float);
    00130     case DOUBLE:
    00131       return typeid(double);
    00132     case LONG_STRING:
    00133       return typeid(std::string);
    00134     case STRING:
    00135       return typeid(std::string);
    00136     case NTCHAR:
    00137       return typeid(char*);
    00138     case LONG_NTCHAR:
    00139       return typeid(char*);
    00140     case OBJECT_REF:
    00141       return typeid(SmartRef<DataObject>);
    00142     case CONTAINED_REF:
    00143       return typeid(SmartRef<ContainedObject>);
    00144     case OBJECT_ADDR:
    00145       return typeid(IOpaqueAddress*);
    00146     case POINTER:
    00147     case UNKNOWN:
    00148     default:
    00149       return typeid(void*);
    00150     }
    00151   }

static const long DataTypeInfo::size | ( | long | typ | ) | `[inline, static]`

Access to type information: the reverse way.

Definition at line 154 of file DataTypeInfo.h.

References BOOL, CHAR, CONTAINED_REF, DOUBLE, FLOAT, INT, int(), LONG, LONG_NTCHAR, LONG_STRING, NTCHAR, OBJECT_ADDR, OBJECT_REF, POINTER, SHORT, STRING, UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

Referenced by PoolDbNTupleCnv::createRep(), and size().

    00154                                        {
    00155     switch(typ)   {
    00156     case UCHAR:
    00157       return sizeof(unsigned char);
    00158     case USHORT:
    00159       return sizeof(unsigned short);
    00160     case UINT:
    00161       return sizeof(unsigned int);
    00162     case ULONG:
    00163       return sizeof(unsigned long);
    00164     case CHAR:
    00165       return sizeof(char);
    00166     case SHORT:
    00167       return sizeof(short);
    00168     case INT:
    00169       return sizeof(int);
    00170     case LONG:
    00171       return sizeof(long);
    00172     case BOOL:
    00173       return sizeof(bool);
    00174     case FLOAT:
    00175       return sizeof(float);
    00176     case DOUBLE:
    00177       return sizeof(double);
    00178     case STRING:
    00179       return sizeof(std::string);
    00180     case LONG_STRING:
    00181       return sizeof(std::string);
    00182     case NTCHAR:
    00183       return sizeof(char*);
    00184     case LONG_NTCHAR:
    00185       return sizeof(char*);
    00186     case OBJECT_ADDR:
    00187     case POINTER:
    00188     case OBJECT_REF:
    00189     case CONTAINED_REF:
    00190     case UNKNOWN:
    00191     default:
    00192       return 0;
    00193     }
    00194   }

static const long DataTypeInfo::size | ( | const std::type_info & | typ | ) | `[inline, static]`

Access to type information: the reverse way.

Definition at line 197 of file DataTypeInfo.h.

References ID(), and size().

    00197                                                       {
    00198     return size( ID(typ) );
    00199   }

static const int DataTypeInfo::copy | ( | void * | tar,
|  | const void * | src,
|  | long | typ,
|  | int | numObj |
| ) |  |  | `[inline, static]`

Copy data.

Definition at line 202 of file DataTypeInfo.h.

References BOOL, CHAR, DOUBLE, FLOAT, INT, int(), LONG, SHORT, UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

    00202                                                                               {
    00203     switch(typ)   {
    00204     case UCHAR:      numObj *= sizeof(unsigned char);       break;
    00205     case USHORT:     numObj *= sizeof(unsigned short);      break;
    00206     case UINT:       numObj *= sizeof(unsigned int);        break;
    00207     case ULONG:      numObj *= sizeof(unsigned long);       break;
    00208     case CHAR:       numObj *= sizeof(char);                break;
    00209     case SHORT:      numObj *= sizeof(short);               break;
    00210     case INT:        numObj *= sizeof(int);                 break;
    00211     case LONG:       numObj *= sizeof(long);                break;
    00212     case BOOL:       numObj *= sizeof(bool);                break;
    00213     case FLOAT:      numObj *= sizeof(float);               break;
    00214     case DOUBLE:     numObj *= sizeof(double);              break;
    00215     case UNKNOWN:
    00216     default:         numObj *= 0;                           break;
    00217     }
    00218     memcpy(tar, src, numObj);
    00219     return numObj;
    00220   }

const std::string DataTypeInfo::name | ( | long | typ | ) | `[static]`

Definition at line 105 of file DataTypeInfo.cpp.

References BOOL, CHAR, CONTAINED_REF, DOUBLE, FLOAT, INT, LONG, LONG_NTCHAR, LONG_STRING, NTCHAR, OBJECT_ADDR, OBJECT_REF, POINTER, SHORT, STRING, System::typeinfoName(), UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

Referenced by name().

    00105                                              {
    00106   switch(typ)   {
    00107   case UCHAR:
    00108     return System::typeinfoName(typeid(unsigned char));
    00109   case USHORT:
    00110     return System::typeinfoName(typeid(unsigned short));
    00111   case UINT:
    00112     return System::typeinfoName(typeid(unsigned int));
    00113   case ULONG:
    00114     return System::typeinfoName(typeid(unsigned long));
    00115   case CHAR:
    00116     return System::typeinfoName(typeid(char));
    00117   case SHORT:
    00118     return System::typeinfoName(typeid(short));
    00119   case INT:
    00120     return System::typeinfoName(typeid(int));
    00121   case LONG:
    00122     return System::typeinfoName(typeid(long));
    00123   case BOOL:
    00124     return System::typeinfoName(typeid(bool));
    00125   case FLOAT:
    00126     return System::typeinfoName(typeid(float));
    00127   case DOUBLE:
    00128     return System::typeinfoName(typeid(double));
    00129   case STRING:
    00130     return System::typeinfoName(typeid(std::string));
    00131   case LONG_STRING:
    00132     return System::typeinfoName(typeid(std::string));
    00133   case NTCHAR:
    00134     return System::typeinfoName(typeid(char*));
    00135   case LONG_NTCHAR:
    00136     return System::typeinfoName(typeid(char*));
    00137   case OBJECT_ADDR:
    00138     return System::typeinfoName(typeid(IOpaqueAddress*));
    00139   case OBJECT_REF:
    00140     return System::typeinfoName(typeid(SmartRef<DataObject>));
    00141   case CONTAINED_REF:
    00142     return System::typeinfoName(typeid(SmartRef<ContainedObject>));
    00143   case POINTER:
    00144     return System::typeinfoName(typeid(void*));
    00145   case UNKNOWN:
    00146   default:
    00147     return "";
    00148   }
    00149 }

const std::string DataTypeInfo::name | ( | const std::type_info & | typ | ) | `[static]`

Definition at line 152 of file DataTypeInfo.cpp.

References BOOL, CHAR, CONTAINED_REF, DOUBLE, FLOAT, INT, LONG, name(), NTCHAR, OBJECT_ADDR, OBJECT_REF, POINTER, SHORT, STRING, UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

    00152                                                              {
    00153   if ( typ == typeid(unsigned char) )
    00154     return DataTypeInfo::name(UCHAR);
    00155   else if ( typ == typeid(unsigned short) )
    00156     return DataTypeInfo::name(USHORT);
    00157   else if ( typ == typeid(unsigned int) )
    00158     return DataTypeInfo::name(UINT);
    00159   else if ( typ == typeid(unsigned long) )
    00160     return DataTypeInfo::name(ULONG);
    00161   else if ( typ == typeid(char) )
    00162     return DataTypeInfo::name(CHAR);
    00163   else if ( typ == typeid(short) )
    00164     return DataTypeInfo::name(SHORT);
    00165   else if ( typ == typeid(int) )
    00166     return DataTypeInfo::name(INT);
    00167   else if ( typ == typeid(long) )
    00168     return DataTypeInfo::name(LONG);
    00169   else if ( typ == typeid(bool) )
    00170     return DataTypeInfo::name(BOOL);
    00171   else if ( typ == typeid(float) )
    00172     return DataTypeInfo::name(FLOAT);
    00173   else if ( typ == typeid(double) )
    00174     return DataTypeInfo::name(DOUBLE);
    00175   else if ( typ == typeid(std::string) )
    00176     return DataTypeInfo::name(STRING);
    00177   else if ( typ == typeid(char*) )
    00178     return DataTypeInfo::name(NTCHAR);
    00179   else if ( typ == typeid(IOpaqueAddress*) )
    00180     return DataTypeInfo::name(OBJECT_ADDR);
    00181   else if ( typ == typeid(SmartRef<DataObject>) )
    00182     return DataTypeInfo::name(OBJECT_REF);
    00183   else if ( typ == typeid(SmartRef<ContainedObject>) )
    00184     return DataTypeInfo::name(CONTAINED_REF);
    00185   else if ( typ == typeid(void*) )
    00186     return DataTypeInfo::name(POINTER);
    00187   else
    00188     return DataTypeInfo::name(UNKNOWN);
    00189 }

const DataTypeInfo::Type DataTypeInfo::idByName | ( | const std::string & | typ | ) | `[static]`

Access to type information.

Definition at line 25 of file DataTypeInfo.cpp.

References BOOL, CHAR, CONTAINED_REF, DOUBLE, FLOAT, INT, LONG, NTCHAR, OBJECT_ADDR, OBJECT_REF, POINTER, SHORT, STRING, UCHAR, UINT, ULONG, UNKNOWN, and USHORT.

    00025                                                                       {
    00026   if ( typ == "unsigned char"         || typ == "const unsigned char" )
    00027     return UCHAR;
    00028   else if ( typ == "unsigned short"   || typ == "const unsigned short" )
    00029     return USHORT;
    00030   else if ( typ == "unsigned int"     || typ == "const unsigned int" )
    00031     return UINT;
    00032   else if ( typ == "unsigned long"    || typ == "const unsigned long" )
    00033     return ULONG;
    00034   else if ( typ == "char"             || typ == "const char" )
    00035     return CHAR;
    00036   else if ( typ == "short"            || typ == "const short" )
    00037     return SHORT;
    00038   else if ( typ == "int"              || typ == "const int" )
    00039     return INT;
    00040   else if ( typ == "long"             || typ == "const long" )
    00041     return LONG;
    00042   else if ( typ == "bool"             || typ == "const bool" )
    00043     return BOOL;
    00044   else if ( typ == "float"            || typ == "const float" )
    00045     return FLOAT;
    00046   else if ( typ == "double"           || typ == "const double" )
    00047     return DOUBLE;
    00048   else if ( typ == "std::string"      || typ == "const std::string" )
    00049     return STRING;
    00050   else if ( typ == "char*"            || typ == "const char*" )
    00051     return NTCHAR;
    00052   else if ( typ == "IOpaqueAddress*"  || typ == "const IOpaqueAddress*" )
    00053     return OBJECT_ADDR;
    00054   else if ( typ == "SmartRef<DataObject>"      || typ == "const SmartRef<DataObject>" )
    00055     return OBJECT_REF;
    00056   else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
    00057     return CONTAINED_REF;
    00058   else if ( typ == "void*"            || typ == "const void*" )
    00059     return POINTER;
    00060   else
    00061     return UNKNOWN;
    00062 }

const std::type_info & DataTypeInfo::typeByName | ( | const std::string & | typ | ) | `[static]`

Access to type information.

Definition at line 65 of file DataTypeInfo.cpp.

References int().

    00065                                                                      {
    00066   if ( typ == "unsigned char"         || typ == "const unsigned char" )
    00067     return typeid(unsigned char);
    00068   else if ( typ == "unsigned short"   || typ == "const unsigned short" )
    00069     return typeid(unsigned short);
    00070   else if ( typ == "unsigned int"     || typ == "const unsigned int" )
    00071     return typeid(unsigned int);
    00072   else if ( typ == "unsigned long"    || typ == "const unsigned long" )
    00073     return typeid(unsigned long);
    00074   else if ( typ == "char"             || typ == "const char" )
    00075     return typeid(char);
    00076   else if ( typ == "short"            || typ == "const short" )
    00077     return typeid(short);
    00078   else if ( typ == "int"              || typ == "const int" )
    00079     return typeid(int);
    00080   else if ( typ == "long"             || typ == "const long" )
    00081     return typeid(long);
    00082   else if ( typ == "bool"             || typ == "const bool" )
    00083     return typeid(bool);
    00084   else if ( typ == "float"            || typ == "const float" )
    00085     return typeid(float);
    00086   else if ( typ == "double"           || typ == "const double" )
    00087     return typeid(double);
    00088   else if ( typ == "std::string"      || typ == "const std::string" )
    00089     return typeid(std::string);
    00090   else if ( typ == "char*"            || typ == "const char*" )
    00091     return typeid(char*);
    00092   else if ( typ == "IOpaqueAddress*"  || typ == "const IOpaqueAddress*" )
    00093     return typeid(IOpaqueAddress);
    00094   else if ( typ == "SmartRef<DataObject>"      || typ == "const SmartRef<DataObject>" )
    00095     return typeid(DataObject*);
    00096   else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
    00097     return typeid(SmartRef<ContainedObject>);
    00098   else if ( typ == "void*"            || typ == "const void*" )
    00099     return typeid(void*);
    00100   else
    00101     return typeid(void*);
    00102 }

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/DataTypeInfo.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/src/Lib/DataTypeInfo.cpp