| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# 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 Type | ID (const bool)
| Access to type information: bool.
static Type | ID (const char)
| Access to type information: char.
static Type | ID (const short)
| Access to type information: short.
static Type | ID (const int)
| Access to type information: int.
static Type | ID (const long)
| Access to type information: long.
static Type | ID (const unsigned char)
| Access to type information: unsigned char.
static Type | ID (const unsigned short)
| Access to type information: unsigned short.
static Type | ID (const unsigned int)
| Access to type information: unsigned int.
static Type | ID (const unsigned long)
| Access to type information: unsigned long.
static Type | ID (const float)
| Access to type information: float.
static Type | ID (const double)
| Access to type information: float.
static Type | ID (const std::string &)
| Access to type information: std::string.
static Type | ID (const char *)
| Access to type information: char* (NULL terminated).
static Type | ID (const IOpaqueAddress *)
| Access to type information: IOpaqueAddress.
static Type | ID (const void *)
| Access to type information: Pointers.
static Type | ID (const SmartRef< DataObject > &)
| Access to type information: DataObject.
static Type | ID (const SmartRef< ContainedObject > &)
| Access to type information: Contained object.
static 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 long | size (long typ)
| Access to type information: the reverse way.
static long | size (const std::type_info &typ)
| Access to type information: the reverse way.
static int | copy (void *tar, const void *src, long typ, int numObj)
| Copy data.
static std::string | name (long typ)
static std::string | name (const std::type_info &typ)
static 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 Type DataTypeInfo::ID | ( | const | bool | ) | `[inline, static]`

Access to type information: bool.

Definition at line 33 of file DataTypeInfo.h.

    00033 { return BOOL;          }

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

Access to type information: char.

Definition at line 35 of file DataTypeInfo.h.

    00035 { return CHAR;          }

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

Access to type information: short.

Definition at line 37 of file DataTypeInfo.h.

    00037 { return SHORT;         }

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

Access to type information: int.

Definition at line 39 of file DataTypeInfo.h.

    00039 { return INT;           }

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

Access to type information: long.

Definition at line 41 of file DataTypeInfo.h.

    00041 { return LONG;          }

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

Access to type information: unsigned char.

Definition at line 43 of file DataTypeInfo.h.

    00043 { return UCHAR;         }

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

Access to type information: unsigned short.

Definition at line 45 of file DataTypeInfo.h.

    00045 { return USHORT;        }

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

Access to type information: unsigned int.

Definition at line 47 of file DataTypeInfo.h.

    00047 { return UINT;          }

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

Access to type information: unsigned long.

Definition at line 49 of file DataTypeInfo.h.

    00049 { return ULONG;         }

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

Access to type information: float.

Definition at line 51 of file DataTypeInfo.h.

    00051 { return FLOAT;         }

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

Access to type information: float.

Definition at line 53 of file DataTypeInfo.h.

    00053 { return DOUBLE;        }

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

Access to type information: std::string.

Definition at line 55 of file DataTypeInfo.h.

    00055 { return STRING;        }

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

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

Definition at line 57 of file DataTypeInfo.h.

    00057 { return NTCHAR;        }

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

Access to type information: IOpaqueAddress.

Definition at line 59 of file DataTypeInfo.h.

    00059 { return OBJECT_ADDR;   }

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

Access to type information: Pointers.

Definition at line 61 of file DataTypeInfo.h.

    00061 { return POINTER;       }

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

Access to type information: DataObject.

Definition at line 63 of file DataTypeInfo.h.

    00063 { return OBJECT_REF;    }

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

Access to type information: Contained object.

Definition at line 65 of file DataTypeInfo.h.

    00065 { return CONTAINED_REF; }

static 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.

    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.

    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 long DataTypeInfo::size | ( | long | typ | ) | `[inline, static]`

Access to type information: the reverse way.

Definition at line 154 of file DataTypeInfo.h.

    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 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.

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

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

Copy data.

Definition at line 202 of file DataTypeInfo.h.

    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   }

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

Definition at line 105 of file DataTypeInfo.cpp.

    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 }

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

Definition at line 152 of file DataTypeInfo.cpp.

    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 }

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

Access to type information.

Definition at line 25 of file DataTypeInfo.cpp.

    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.

    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_v21r6/GaudiKernel/GaudiKernel/DataTypeInfo.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiKernel/src/Lib/DataTypeInfo.cpp