DataTypeInfo Class Reference

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

#include <GaudiKernel/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,
  LONGLONG, ULONGLONG
}
 

Static Public Member Functions

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

Private Member Functions

 DataTypeInfo ()
 

Detailed Description

Small class which allows access to internal type IDs.

Definition at line 16 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 22 of file DataTypeInfo.h.

Constructor & Destructor Documentation

DataTypeInfo::DataTypeInfo ( )
inlineprivate

Definition at line 19 of file DataTypeInfo.h.

19 {}

Member Function Documentation

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

Copy data.

Definition at line 217 of file DataTypeInfo.h.

217  {
218  switch(typ) {
219  case UCHAR: numObj *= sizeof(unsigned char); break;
220  case USHORT: numObj *= sizeof(unsigned short); break;
221  case UINT: numObj *= sizeof(unsigned int); break;
222  case ULONG: numObj *= sizeof(unsigned long); break;
223  case ULONGLONG: numObj *= sizeof(unsigned long long); break;
224  case CHAR: numObj *= sizeof(char); break;
225  case SHORT: numObj *= sizeof(short); break;
226  case INT: numObj *= sizeof(int); break;
227  case LONG: numObj *= sizeof(long); break;
228  case LONGLONG: numObj *= sizeof(long long); break;
229  case BOOL: numObj *= sizeof(bool); break;
230  case FLOAT: numObj *= sizeof(float); break;
231  case DOUBLE: numObj *= sizeof(double); break;
232  case UNKNOWN:
233  default: numObj *= 0; break;
234  }
235  memcpy(tar, src, numObj);
236  return numObj;
237  }
T memcpy(T...args)
static Type DataTypeInfo::ID ( const bool  )
inlinestatic

Access to type information: bool.

Definition at line 32 of file DataTypeInfo.h.

32 { return BOOL; }
static Type DataTypeInfo::ID ( const char  )
inlinestatic

Access to type information: char.

Definition at line 34 of file DataTypeInfo.h.

34 { return CHAR; }
static Type DataTypeInfo::ID ( const short  )
inlinestatic

Access to type information: short.

Definition at line 36 of file DataTypeInfo.h.

36 { return SHORT; }
static Type DataTypeInfo::ID ( const int  )
inlinestatic

Access to type information: int.

Definition at line 38 of file DataTypeInfo.h.

38 { return INT; }
static Type DataTypeInfo::ID ( const long  )
inlinestatic

Access to type information: long.

Definition at line 40 of file DataTypeInfo.h.

40 { return LONG; }
static Type DataTypeInfo::ID ( const long  long)
inlinestatic

Access to type information: long long.

Definition at line 42 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const unsigned  char)
inlinestatic

Access to type information: unsigned char.

Definition at line 44 of file DataTypeInfo.h.

44 { return UCHAR; }
static Type DataTypeInfo::ID ( const unsigned  short)
inlinestatic

Access to type information: unsigned short.

Definition at line 46 of file DataTypeInfo.h.

46 { return USHORT; }
static Type DataTypeInfo::ID ( const unsigned  int)
inlinestatic

Access to type information: unsigned int.

Definition at line 48 of file DataTypeInfo.h.

48 { return UINT; }
static Type DataTypeInfo::ID ( const unsigned  long)
inlinestatic

Access to type information: unsigned long.

Definition at line 50 of file DataTypeInfo.h.

50 { return ULONG; }
static Type DataTypeInfo::ID ( const unsigned long  long)
inlinestatic

Access to type information: unsigned long long.

Definition at line 52 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const float  )
inlinestatic

Access to type information: float.

Definition at line 54 of file DataTypeInfo.h.

54 { return FLOAT; }
static Type DataTypeInfo::ID ( const double  )
inlinestatic

Access to type information: float.

Definition at line 56 of file DataTypeInfo.h.

56 { return DOUBLE; }
static Type DataTypeInfo::ID ( const std::string )
inlinestatic

Access to type information: std::string.

Definition at line 58 of file DataTypeInfo.h.

58 { return STRING; }
static Type DataTypeInfo::ID ( const char *  )
inlinestatic

Access to type information: char* (NULL terminated)

Definition at line 60 of file DataTypeInfo.h.

60 { return NTCHAR; }
static Type DataTypeInfo::ID ( const IOpaqueAddress )
inlinestatic

Access to type information: IOpaqueAddress.

Definition at line 62 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const void *  )
inlinestatic

Access to type information: Pointers.

Definition at line 64 of file DataTypeInfo.h.

64 { return POINTER; }
static Type DataTypeInfo::ID ( const SmartRef< DataObject > &  )
inlinestatic

Access to type information: DataObject.

Definition at line 66 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const SmartRef< ContainedObject > &  )
inlinestatic

Access to type information: Contained object.

Definition at line 68 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const std::type_info typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 71 of file DataTypeInfo.h.

71  {
72  if ( typ == typeid(unsigned char) )
73  return UCHAR;
74  else if ( typ == typeid(unsigned short) )
75  return USHORT;
76  else if ( typ == typeid(unsigned int) )
77  return UINT;
78  else if ( typ == typeid(unsigned long) )
79  return ULONG;
80  else if ( typ == typeid(unsigned long long) )
81  return ULONGLONG;
82  else if ( typ == typeid(char) )
83  return CHAR;
84  else if ( typ == typeid(short) )
85  return SHORT;
86  else if ( typ == typeid(int) )
87  return INT;
88  else if ( typ == typeid(long) )
89  return LONG;
90  else if ( typ == typeid(long long) )
91  return LONGLONG;
92  else if ( typ == typeid(bool) )
93  return BOOL;
94  else if ( typ == typeid(float) )
95  return FLOAT;
96  else if ( typ == typeid(double) )
97  return DOUBLE;
98  else if ( typ == typeid(std::string) )
99  return STRING;
100  else if ( typ == typeid(char*) )
101  return NTCHAR;
102  else if ( typ == typeid(SmartRef<DataObject>) )
103  return OBJECT_REF;
104  else if ( typ == typeid(SmartRef<ContainedObject>) )
105  return CONTAINED_REF;
106  else if ( typ == typeid(IOpaqueAddress*) )
107  return OBJECT_ADDR;
108  else if ( typ == typeid(void*) )
109  return POINTER;
110  else
111  return UNKNOWN;
112  }
STL class.
Opaque address interface definition.
DataTypeInfo::Type DataTypeInfo::idByName ( const std::string typ)
static

Access to type information.

Definition at line 24 of file DataTypeInfo.cpp.

24  {
25  if ( typ == "unsigned char" || typ == "const unsigned char" )
26  return UCHAR;
27  else if ( typ == "unsigned short" || typ == "const unsigned short" )
28  return USHORT;
29  else if ( typ == "unsigned int" || typ == "const unsigned int" )
30  return UINT;
31  else if ( typ == "unsigned long" || typ == "const unsigned long" )
32  return ULONG;
33  else if ( typ == "char" || typ == "const char" )
34  return CHAR;
35  else if ( typ == "short" || typ == "const short" )
36  return SHORT;
37  else if ( typ == "int" || typ == "const int" )
38  return INT;
39  else if ( typ == "long" || typ == "const long" )
40  return LONG;
41  else if ( typ == "bool" || typ == "const bool" )
42  return BOOL;
43  else if ( typ == "float" || typ == "const float" )
44  return FLOAT;
45  else if ( typ == "double" || typ == "const double" )
46  return DOUBLE;
47  else if ( typ == "std::string" || typ == "const std::string" )
48  return STRING;
49  else if ( typ == "char*" || typ == "const char*" )
50  return NTCHAR;
51  else if ( typ == "IOpaqueAddress*" || typ == "const IOpaqueAddress*" )
52  return OBJECT_ADDR;
53  else if ( typ == "SmartRef<DataObject>" || typ == "const SmartRef<DataObject>" )
54  return OBJECT_REF;
55  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
56  return CONTAINED_REF;
57  else if ( typ == "void*" || typ == "const void*" )
58  return POINTER;
59  else
60  return UNKNOWN;
61 }
std::string DataTypeInfo::name ( long  typ)
static

Definition at line 104 of file DataTypeInfo.cpp.

104  {
105  switch(typ) {
106  case UCHAR:
107  return System::typeinfoName(typeid(unsigned char));
108  case USHORT:
109  return System::typeinfoName(typeid(unsigned short));
110  case UINT:
111  return System::typeinfoName(typeid(unsigned int));
112  case ULONG:
113  return System::typeinfoName(typeid(unsigned long));
114  case CHAR:
115  return System::typeinfoName(typeid(char));
116  case SHORT:
117  return System::typeinfoName(typeid(short));
118  case INT:
119  return System::typeinfoName(typeid(int));
120  case LONG:
121  return System::typeinfoName(typeid(long));
122  case BOOL:
123  return System::typeinfoName(typeid(bool));
124  case FLOAT:
125  return System::typeinfoName(typeid(float));
126  case DOUBLE:
127  return System::typeinfoName(typeid(double));
128  case STRING:
129  return System::typeinfoName(typeid(std::string));
130  case LONG_STRING:
131  return System::typeinfoName(typeid(std::string));
132  case NTCHAR:
133  return System::typeinfoName(typeid(char*));
134  case LONG_NTCHAR:
135  return System::typeinfoName(typeid(char*));
136  case OBJECT_ADDR:
137  return System::typeinfoName(typeid(IOpaqueAddress*));
138  case OBJECT_REF:
140  case CONTAINED_REF:
142  case POINTER:
143  return System::typeinfoName(typeid(void*));
144  case UNKNOWN:
145  default:
146  return "";
147  }
148 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
STL class.
Opaque address interface definition.
std::string DataTypeInfo::name ( const std::type_info typ)
static

Definition at line 151 of file DataTypeInfo.cpp.

151  {
152  if ( typ == typeid(unsigned char) )
153  return DataTypeInfo::name(UCHAR);
154  else if ( typ == typeid(unsigned short) )
155  return DataTypeInfo::name(USHORT);
156  else if ( typ == typeid(unsigned int) )
157  return DataTypeInfo::name(UINT);
158  else if ( typ == typeid(unsigned long) )
159  return DataTypeInfo::name(ULONG);
160  else if ( typ == typeid(char) )
161  return DataTypeInfo::name(CHAR);
162  else if ( typ == typeid(short) )
163  return DataTypeInfo::name(SHORT);
164  else if ( typ == typeid(int) )
165  return DataTypeInfo::name(INT);
166  else if ( typ == typeid(long) )
167  return DataTypeInfo::name(LONG);
168  else if ( typ == typeid(bool) )
169  return DataTypeInfo::name(BOOL);
170  else if ( typ == typeid(float) )
171  return DataTypeInfo::name(FLOAT);
172  else if ( typ == typeid(double) )
173  return DataTypeInfo::name(DOUBLE);
174  else if ( typ == typeid(std::string) )
175  return DataTypeInfo::name(STRING);
176  else if ( typ == typeid(char*) )
177  return DataTypeInfo::name(NTCHAR);
178  else if ( typ == typeid(IOpaqueAddress*) )
180  else if ( typ == typeid(SmartRef<DataObject>) )
182  else if ( typ == typeid(SmartRef<ContainedObject>) )
184  else if ( typ == typeid(void*) )
185  return DataTypeInfo::name(POINTER);
186  else
187  return DataTypeInfo::name(UNKNOWN);
188 }
STL class.
Opaque address interface definition.
static std::string name(long typ)
static long DataTypeInfo::size ( long  typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 165 of file DataTypeInfo.h.

165  {
166  switch(typ) {
167  case UCHAR:
168  return sizeof(unsigned char);
169  case USHORT:
170  return sizeof(unsigned short);
171  case UINT:
172  return sizeof(unsigned int);
173  case ULONG:
174  return sizeof(unsigned long);
175  case ULONGLONG:
176  return sizeof(unsigned long long);
177  case CHAR:
178  return sizeof(char);
179  case SHORT:
180  return sizeof(short);
181  case INT:
182  return sizeof(int);
183  case LONG:
184  return sizeof(long);
185  case LONGLONG:
186  return sizeof(long long);
187  case BOOL:
188  return sizeof(bool);
189  case FLOAT:
190  return sizeof(float);
191  case DOUBLE:
192  return sizeof(double);
193  case STRING:
194  return sizeof(std::string);
195  case LONG_STRING:
196  return sizeof(std::string);
197  case NTCHAR:
198  return sizeof(char*);
199  case LONG_NTCHAR:
200  return sizeof(char*);
201  case OBJECT_ADDR:
202  case POINTER:
203  case OBJECT_REF:
204  case CONTAINED_REF:
205  case UNKNOWN:
206  default:
207  return 0;
208  }
209  }
STL class.
static long DataTypeInfo::size ( const std::type_info typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 212 of file DataTypeInfo.h.

212  {
213  return size( ID(typ) );
214  }
static Type ID(const bool)
Access to type information: bool.
Definition: DataTypeInfo.h:32
static long size(long typ)
Access to type information: the reverse way.
Definition: DataTypeInfo.h:165
static const std::type_info& DataTypeInfo::type ( long  typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 115 of file DataTypeInfo.h.

115  {
116  switch(typ) {
117  case UCHAR:
118  return typeid(unsigned char);
119  case USHORT:
120  return typeid(unsigned short);
121  case UINT:
122  return typeid(unsigned int);
123  case ULONG:
124  return typeid(unsigned long);
125  case ULONGLONG:
126  return typeid(unsigned long long);
127  case CHAR:
128  return typeid(char);
129  case SHORT:
130  return typeid(short);
131  case INT:
132  return typeid(int);
133  case LONG:
134  return typeid(long);
135  case LONGLONG:
136  return typeid(long long);
137  case BOOL:
138  return typeid(bool);
139  case FLOAT:
140  return typeid(float);
141  case DOUBLE:
142  return typeid(double);
143  case LONG_STRING:
144  return typeid(std::string);
145  case STRING:
146  return typeid(std::string);
147  case NTCHAR:
148  return typeid(char*);
149  case LONG_NTCHAR:
150  return typeid(char*);
151  case OBJECT_REF:
152  return typeid(SmartRef<DataObject>);
153  case CONTAINED_REF:
154  return typeid(SmartRef<ContainedObject>);
155  case OBJECT_ADDR:
156  return typeid(IOpaqueAddress*);
157  case POINTER:
158  case UNKNOWN:
159  default:
160  return typeid(void*);
161  }
162  }
STL class.
Opaque address interface definition.
const std::type_info & DataTypeInfo::typeByName ( const std::string typ)
static

Access to type information.

Definition at line 64 of file DataTypeInfo.cpp.

64  {
65  if ( typ == "unsigned char" || typ == "const unsigned char" )
66  return typeid(unsigned char);
67  else if ( typ == "unsigned short" || typ == "const unsigned short" )
68  return typeid(unsigned short);
69  else if ( typ == "unsigned int" || typ == "const unsigned int" )
70  return typeid(unsigned int);
71  else if ( typ == "unsigned long" || typ == "const unsigned long" )
72  return typeid(unsigned long);
73  else if ( typ == "char" || typ == "const char" )
74  return typeid(char);
75  else if ( typ == "short" || typ == "const short" )
76  return typeid(short);
77  else if ( typ == "int" || typ == "const int" )
78  return typeid(int);
79  else if ( typ == "long" || typ == "const long" )
80  return typeid(long);
81  else if ( typ == "bool" || typ == "const bool" )
82  return typeid(bool);
83  else if ( typ == "float" || typ == "const float" )
84  return typeid(float);
85  else if ( typ == "double" || typ == "const double" )
86  return typeid(double);
87  else if ( typ == "std::string" || typ == "const std::string" )
88  return typeid(std::string);
89  else if ( typ == "char*" || typ == "const char*" )
90  return typeid(char*);
91  else if ( typ == "IOpaqueAddress*" || typ == "const IOpaqueAddress*" )
92  return typeid(IOpaqueAddress);
93  else if ( typ == "SmartRef<DataObject>" || typ == "const SmartRef<DataObject>" )
94  return typeid(DataObject*);
95  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
96  return typeid(SmartRef<ContainedObject>);
97  else if ( typ == "void*" || typ == "const void*" )
98  return typeid(void*);
99  else
100  return typeid(void*);
101 }
STL class.
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

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