Gaudi Framework, version v23r0

Home   Generated: Mon Jan 30 2012
Public Types | Static Public Member Functions | Private Member Functions

DataTypeInfo Class Reference

Small class which allows access to internal type IDs. More...

#include <GaudiKernel/DataTypeInfo.h>

List of all members.

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,
  LONGLONG, ULONGLONG
}

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 long long)
 Access to type information: long 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 unsigned long long)
 Access to type information: unsigned long 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_infotype (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_infotypeByName (const std::string &typ)
 Access to type information.

Private Member Functions

 DataTypeInfo ()

Detailed Description

Small class which allows access to internal type IDs.

Definition at line 17 of file DataTypeInfo.h.


Member Enumeration Documentation

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 
LONGLONG 
ULONGLONG 

Definition at line 23 of file DataTypeInfo.h.


Constructor & Destructor Documentation

DataTypeInfo::DataTypeInfo (  ) [inline, private]

Definition at line 20 of file DataTypeInfo.h.

{}

Member Function Documentation

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

Copy data.

Definition at line 218 of file DataTypeInfo.h.

                                                                        {
    switch(typ)   {
    case UCHAR:      numObj *= sizeof(unsigned char);       break;
    case USHORT:     numObj *= sizeof(unsigned short);      break;
    case UINT:       numObj *= sizeof(unsigned int);        break;
    case ULONG:      numObj *= sizeof(unsigned long);       break;
    case ULONGLONG:  numObj *= sizeof(unsigned long long);  break;
    case CHAR:       numObj *= sizeof(char);                break;
    case SHORT:      numObj *= sizeof(short);               break;
    case INT:        numObj *= sizeof(int);                 break;
    case LONG:       numObj *= sizeof(long);                break;
    case LONGLONG:   numObj *= sizeof(long long);           break;
    case BOOL:       numObj *= sizeof(bool);                break;
    case FLOAT:      numObj *= sizeof(float);               break;
    case DOUBLE:     numObj *= sizeof(double);              break;
    case UNKNOWN:
    default:         numObj *= 0;                           break;
    }
    memcpy(tar, src, numObj);
    return numObj;
  }
static Type DataTypeInfo::ID ( const   char ) [inline, static]

Access to type information: char.

Definition at line 35 of file DataTypeInfo.h.

{ return CHAR;          }
static Type DataTypeInfo::ID ( const   int ) [inline, static]

Access to type information: int.

Definition at line 39 of file DataTypeInfo.h.

{ return INT;           }
static Type DataTypeInfo::ID ( const unsigned  short ) [inline, static]

Access to type information: unsigned short.

Definition at line 47 of file DataTypeInfo.h.

{ return USHORT;        }
static Type DataTypeInfo::ID ( const IOpaqueAddress  ) [inline, static]

Access to type information: IOpaqueAddress.

Definition at line 63 of file DataTypeInfo.h.

{ return OBJECT_ADDR;   }
static Type DataTypeInfo::ID ( const   float ) [inline, static]

Access to type information: float.

Definition at line 55 of file DataTypeInfo.h.

{ return FLOAT;         }
static Type DataTypeInfo::ID ( const void *   ) [inline, static]

Access to type information: Pointers.

Definition at line 65 of file DataTypeInfo.h.

{ return POINTER;       }
static Type DataTypeInfo::ID ( const unsigned  int ) [inline, static]

Access to type information: unsigned int.

Definition at line 49 of file DataTypeInfo.h.

{ return UINT;          }
static Type DataTypeInfo::ID ( const SmartRef< DataObject > &   ) [inline, static]

Access to type information: DataObject.

Definition at line 67 of file DataTypeInfo.h.

{ return OBJECT_REF;    }
static Type DataTypeInfo::ID ( const std::type_info typ ) [inline, static]

Access to type information: the reverse way.

Definition at line 72 of file DataTypeInfo.h.

                                              {
    if ( typ == typeid(unsigned char) )
      return UCHAR;
    else if ( typ == typeid(unsigned short) )
      return USHORT;
    else if ( typ == typeid(unsigned int) )
      return UINT;
    else if ( typ == typeid(unsigned long) )
      return ULONG;
    else if ( typ == typeid(unsigned long long) )
      return ULONGLONG;
    else if ( typ == typeid(char) )
      return CHAR;
    else if ( typ == typeid(short) )
      return SHORT;
    else if ( typ == typeid(int) )
      return INT;
    else if ( typ == typeid(long) )
      return LONG;
    else if ( typ == typeid(long long) )
      return LONGLONG;
    else if ( typ == typeid(bool) )
      return BOOL;
    else if ( typ == typeid(float) )
      return FLOAT;
    else if ( typ == typeid(double) )
      return DOUBLE;
    else if ( typ == typeid(std::string) )
      return STRING;
    else if ( typ == typeid(char*) )
      return NTCHAR;
    else if ( typ == typeid(SmartRef<DataObject>) )
      return OBJECT_REF;
    else if ( typ == typeid(SmartRef<ContainedObject>) )
      return CONTAINED_REF;
    else if ( typ == typeid(IOpaqueAddress*) )
      return OBJECT_ADDR;
    else if ( typ == typeid(void*) )
      return POINTER;
    else
      return UNKNOWN;
  }
static Type DataTypeInfo::ID ( const SmartRef< ContainedObject > &   ) [inline, static]

Access to type information: Contained object.

Definition at line 69 of file DataTypeInfo.h.

{ return CONTAINED_REF; }
static Type DataTypeInfo::ID ( const   long ) [inline, static]

Access to type information: long.

Definition at line 41 of file DataTypeInfo.h.

{ return LONG;          }
static Type DataTypeInfo::ID ( const unsigned  long ) [inline, static]

Access to type information: unsigned long.

Definition at line 51 of file DataTypeInfo.h.

{ return ULONG;         }
static Type DataTypeInfo::ID ( const unsigned long  long ) [inline, static]

Access to type information: unsigned long long.

Definition at line 53 of file DataTypeInfo.h.

{ return ULONGLONG;   }
static Type DataTypeInfo::ID ( const char *   ) [inline, static]

Access to type information: char* (NULL terminated)

Definition at line 61 of file DataTypeInfo.h.

{ return NTCHAR;        }
static Type DataTypeInfo::ID ( const std::string  ) [inline, static]

Access to type information: std::string.

Definition at line 59 of file DataTypeInfo.h.

{ return STRING;        }
static Type DataTypeInfo::ID ( const   double ) [inline, static]

Access to type information: float.

Definition at line 57 of file DataTypeInfo.h.

{ return DOUBLE;        }
static Type DataTypeInfo::ID ( const long  long ) [inline, static]

Access to type information: long long.

Definition at line 43 of file DataTypeInfo.h.

{ return LONGLONG;      }
static Type DataTypeInfo::ID ( const   bool ) [inline, static]

Access to type information: bool.

Definition at line 33 of file DataTypeInfo.h.

{ return BOOL;          }
static Type DataTypeInfo::ID ( const   short ) [inline, static]

Access to type information: short.

Definition at line 37 of file DataTypeInfo.h.

{ return SHORT;         }
static Type DataTypeInfo::ID ( const unsigned  char ) [inline, static]

Access to type information: unsigned char.

Definition at line 45 of file DataTypeInfo.h.

{ return UCHAR;         }
DataTypeInfo::Type DataTypeInfo::idByName ( const std::string typ ) [static]

Access to type information.

Definition at line 25 of file DataTypeInfo.cpp.

                                                                {
  if ( typ == "unsigned char"         || typ == "const unsigned char" )
    return UCHAR;
  else if ( typ == "unsigned short"   || typ == "const unsigned short" )
    return USHORT;
  else if ( typ == "unsigned int"     || typ == "const unsigned int" )
    return UINT;
  else if ( typ == "unsigned long"    || typ == "const unsigned long" )
    return ULONG;
  else if ( typ == "char"             || typ == "const char" )
    return CHAR;
  else if ( typ == "short"            || typ == "const short" )
    return SHORT;
  else if ( typ == "int"              || typ == "const int" )
    return INT;
  else if ( typ == "long"             || typ == "const long" )
    return LONG;
  else if ( typ == "bool"             || typ == "const bool" )
    return BOOL;
  else if ( typ == "float"            || typ == "const float" )
    return FLOAT;
  else if ( typ == "double"           || typ == "const double" )
    return DOUBLE;
  else if ( typ == "std::string"      || typ == "const std::string" )
    return STRING;
  else if ( typ == "char*"            || typ == "const char*" )
    return NTCHAR;
  else if ( typ == "IOpaqueAddress*"  || typ == "const IOpaqueAddress*" )
    return OBJECT_ADDR;
  else if ( typ == "SmartRef<DataObject>"      || typ == "const SmartRef<DataObject>" )
    return OBJECT_REF;
  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
    return CONTAINED_REF;
  else if ( typ == "void*"            || typ == "const void*" )
    return POINTER;
  else
    return UNKNOWN;
}
std::string DataTypeInfo::name ( const std::type_info typ ) [static]

Definition at line 152 of file DataTypeInfo.cpp.

                                                       {
  if ( typ == typeid(unsigned char) )
    return DataTypeInfo::name(UCHAR);
  else if ( typ == typeid(unsigned short) )
    return DataTypeInfo::name(USHORT);
  else if ( typ == typeid(unsigned int) )
    return DataTypeInfo::name(UINT);
  else if ( typ == typeid(unsigned long) )
    return DataTypeInfo::name(ULONG);
  else if ( typ == typeid(char) )
    return DataTypeInfo::name(CHAR);
  else if ( typ == typeid(short) )
    return DataTypeInfo::name(SHORT);
  else if ( typ == typeid(int) )
    return DataTypeInfo::name(INT);
  else if ( typ == typeid(long) )
    return DataTypeInfo::name(LONG);
  else if ( typ == typeid(bool) )
    return DataTypeInfo::name(BOOL);
  else if ( typ == typeid(float) )
    return DataTypeInfo::name(FLOAT);
  else if ( typ == typeid(double) )
    return DataTypeInfo::name(DOUBLE);
  else if ( typ == typeid(std::string) )
    return DataTypeInfo::name(STRING);
  else if ( typ == typeid(char*) )
    return DataTypeInfo::name(NTCHAR);
  else if ( typ == typeid(IOpaqueAddress*) )
    return DataTypeInfo::name(OBJECT_ADDR);
  else if ( typ == typeid(SmartRef<DataObject>) )
    return DataTypeInfo::name(OBJECT_REF);
  else if ( typ == typeid(SmartRef<ContainedObject>) )
    return DataTypeInfo::name(CONTAINED_REF);
  else if ( typ == typeid(void*) )
    return DataTypeInfo::name(POINTER);
  else
    return DataTypeInfo::name(UNKNOWN);
}
std::string DataTypeInfo::name ( long  typ ) [static]

Definition at line 105 of file DataTypeInfo.cpp.

                                       {
  switch(typ)   {
  case UCHAR:
    return System::typeinfoName(typeid(unsigned char));
  case USHORT:
    return System::typeinfoName(typeid(unsigned short));
  case UINT:
    return System::typeinfoName(typeid(unsigned int));
  case ULONG:
    return System::typeinfoName(typeid(unsigned long));
  case CHAR:
    return System::typeinfoName(typeid(char));
  case SHORT:
    return System::typeinfoName(typeid(short));
  case INT:
    return System::typeinfoName(typeid(int));
  case LONG:
    return System::typeinfoName(typeid(long));
  case BOOL:
    return System::typeinfoName(typeid(bool));
  case FLOAT:
    return System::typeinfoName(typeid(float));
  case DOUBLE:
    return System::typeinfoName(typeid(double));
  case STRING:
    return System::typeinfoName(typeid(std::string));
  case LONG_STRING:
    return System::typeinfoName(typeid(std::string));
  case NTCHAR:
    return System::typeinfoName(typeid(char*));
  case LONG_NTCHAR:
    return System::typeinfoName(typeid(char*));
  case OBJECT_ADDR:
    return System::typeinfoName(typeid(IOpaqueAddress*));
  case OBJECT_REF:
    return System::typeinfoName(typeid(SmartRef<DataObject>));
  case CONTAINED_REF:
    return System::typeinfoName(typeid(SmartRef<ContainedObject>));
  case POINTER:
    return System::typeinfoName(typeid(void*));
  case UNKNOWN:
  default:
    return "";
  }
}
static long DataTypeInfo::size ( const std::type_info typ ) [inline, static]

Access to type information: the reverse way.

Definition at line 213 of file DataTypeInfo.h.

                                                {
    return size( ID(typ) );
  }
static long DataTypeInfo::size ( long  typ ) [inline, static]

Access to type information: the reverse way.

Definition at line 166 of file DataTypeInfo.h.

                                 {
    switch(typ)   {
    case UCHAR:
      return sizeof(unsigned char);
    case USHORT:
      return sizeof(unsigned short);
    case UINT:
      return sizeof(unsigned int);
    case ULONG:
      return sizeof(unsigned long);
    case ULONGLONG:
      return sizeof(unsigned long long);
    case CHAR:
      return sizeof(char);
    case SHORT:
      return sizeof(short);
    case INT:
      return sizeof(int);
    case LONG:
      return sizeof(long);
    case LONGLONG:
      return sizeof(long long);
    case BOOL:
      return sizeof(bool);
    case FLOAT:
      return sizeof(float);
    case DOUBLE:
      return sizeof(double);
    case STRING:
      return sizeof(std::string);
    case LONG_STRING:
      return sizeof(std::string);
    case NTCHAR:
      return sizeof(char*);
    case LONG_NTCHAR:
      return sizeof(char*);
    case OBJECT_ADDR:
    case POINTER:
    case OBJECT_REF:
    case CONTAINED_REF:
    case UNKNOWN:
    default:
      return 0;
    }
  }
static const std::type_info& DataTypeInfo::type ( long  typ ) [inline, static]

Access to type information: the reverse way.

Definition at line 116 of file DataTypeInfo.h.

                                                {
    switch(typ)   {
    case UCHAR:
      return typeid(unsigned char);
    case USHORT:
      return typeid(unsigned short);
    case UINT:
      return typeid(unsigned int);
    case ULONG:
      return typeid(unsigned long);
    case ULONGLONG:
      return typeid(unsigned long long);
    case CHAR:
      return typeid(char);
    case SHORT:
      return typeid(short);
    case INT:
      return typeid(int);
    case LONG:
      return typeid(long);
    case LONGLONG:
      return typeid(long long);
    case BOOL:
      return typeid(bool);
    case FLOAT:
      return typeid(float);
    case DOUBLE:
      return typeid(double);
    case LONG_STRING:
      return typeid(std::string);
    case STRING:
      return typeid(std::string);
    case NTCHAR:
      return typeid(char*);
    case LONG_NTCHAR:
      return typeid(char*);
    case OBJECT_REF:
      return typeid(SmartRef<DataObject>);
    case CONTAINED_REF:
      return typeid(SmartRef<ContainedObject>);
    case OBJECT_ADDR:
      return typeid(IOpaqueAddress*);
    case POINTER:
    case UNKNOWN:
    default:
      return typeid(void*);
    }
  }
const std::type_info & DataTypeInfo::typeByName ( const std::string typ ) [static]

Access to type information.

Definition at line 65 of file DataTypeInfo.cpp.

                                                                     {
  if ( typ == "unsigned char"         || typ == "const unsigned char" )
    return typeid(unsigned char);
  else if ( typ == "unsigned short"   || typ == "const unsigned short" )
    return typeid(unsigned short);
  else if ( typ == "unsigned int"     || typ == "const unsigned int" )
    return typeid(unsigned int);
  else if ( typ == "unsigned long"    || typ == "const unsigned long" )
    return typeid(unsigned long);
  else if ( typ == "char"             || typ == "const char" )
    return typeid(char);
  else if ( typ == "short"            || typ == "const short" )
    return typeid(short);
  else if ( typ == "int"              || typ == "const int" )
    return typeid(int);
  else if ( typ == "long"             || typ == "const long" )
    return typeid(long);
  else if ( typ == "bool"             || typ == "const bool" )
    return typeid(bool);
  else if ( typ == "float"            || typ == "const float" )
    return typeid(float);
  else if ( typ == "double"           || typ == "const double" )
    return typeid(double);
  else if ( typ == "std::string"      || typ == "const std::string" )
    return typeid(std::string);
  else if ( typ == "char*"            || typ == "const char*" )
    return typeid(char*);
  else if ( typ == "IOpaqueAddress*"  || typ == "const IOpaqueAddress*" )
    return typeid(IOpaqueAddress);
  else if ( typ == "SmartRef<DataObject>"      || typ == "const SmartRef<DataObject>" )
    return typeid(DataObject*);
  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
    return typeid(SmartRef<ContainedObject>);
  else if ( typ == "void*"            || typ == "const void*" )
    return typeid(void*);
  else
    return typeid(void*);
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Jan 30 2012 13:53:12 for Gaudi Framework, version v23r0 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004