The Gaudi Framework  v29r3 (fa547fc2)
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 24 of file DataTypeInfo.h.

Constructor & Destructor Documentation

DataTypeInfo::DataTypeInfo ( )
inlineprivate

Definition at line 20 of file DataTypeInfo.h.

20 {}

Member Function Documentation

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

Copy data.

Definition at line 235 of file DataTypeInfo.h.

236  {
237  switch ( typ ) {
238  case UCHAR:
239  numObj *= sizeof( unsigned char );
240  break;
241  case USHORT:
242  numObj *= sizeof( unsigned short );
243  break;
244  case UINT:
245  numObj *= sizeof( unsigned int );
246  break;
247  case ULONG:
248  numObj *= sizeof( unsigned long );
249  break;
250  case ULONGLONG:
251  numObj *= sizeof( unsigned long long );
252  break;
253  case CHAR:
254  numObj *= sizeof( char );
255  break;
256  case SHORT:
257  numObj *= sizeof( short );
258  break;
259  case INT:
260  numObj *= sizeof( int );
261  break;
262  case LONG:
263  numObj *= sizeof( long );
264  break;
265  case LONGLONG:
266  numObj *= sizeof( long long );
267  break;
268  case BOOL:
269  numObj *= sizeof( bool );
270  break;
271  case FLOAT:
272  numObj *= sizeof( float );
273  break;
274  case DOUBLE:
275  numObj *= sizeof( double );
276  break;
277  case UNKNOWN:
278  default:
279  numObj *= 0;
280  break;
281  }
282  memcpy( tar, src, numObj );
283  return numObj;
284  }
T memcpy(T...args)
static Type DataTypeInfo::ID ( const bool  )
inlinestatic

Access to type information: bool.

Definition at line 49 of file DataTypeInfo.h.

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

Access to type information: char.

Definition at line 51 of file DataTypeInfo.h.

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

Access to type information: short.

Definition at line 53 of file DataTypeInfo.h.

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

Access to type information: int.

Definition at line 55 of file DataTypeInfo.h.

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

Access to type information: long.

Definition at line 57 of file DataTypeInfo.h.

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

Access to type information: long long.

Definition at line 59 of file DataTypeInfo.h.

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

Access to type information: unsigned char.

Definition at line 61 of file DataTypeInfo.h.

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

Access to type information: unsigned short.

Definition at line 63 of file DataTypeInfo.h.

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

Access to type information: unsigned int.

Definition at line 65 of file DataTypeInfo.h.

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

Access to type information: unsigned long.

Definition at line 67 of file DataTypeInfo.h.

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

Access to type information: unsigned long long.

Definition at line 69 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const float  )
inlinestatic

Access to type information: float.

Definition at line 71 of file DataTypeInfo.h.

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

Access to type information: float.

Definition at line 73 of file DataTypeInfo.h.

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

Access to type information: std::string.

Definition at line 75 of file DataTypeInfo.h.

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

Access to type information: char* (NULL terminated)

Definition at line 77 of file DataTypeInfo.h.

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

Access to type information: IOpaqueAddress.

Definition at line 79 of file DataTypeInfo.h.

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

Access to type information: Pointers.

Definition at line 81 of file DataTypeInfo.h.

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

Access to type information: DataObject.

Definition at line 83 of file DataTypeInfo.h.

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

Access to type information: Contained object.

Definition at line 85 of file DataTypeInfo.h.

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

Access to type information: the reverse way.

Definition at line 88 of file DataTypeInfo.h.

89  {
90  if ( typ == typeid( unsigned char ) )
91  return UCHAR;
92  else if ( typ == typeid( unsigned short ) )
93  return USHORT;
94  else if ( typ == typeid( unsigned int ) )
95  return UINT;
96  else if ( typ == typeid( unsigned long ) )
97  return ULONG;
98  else if ( typ == typeid( unsigned long long ) )
99  return ULONGLONG;
100  else if ( typ == typeid( char ) )
101  return CHAR;
102  else if ( typ == typeid( short ) )
103  return SHORT;
104  else if ( typ == typeid( int ) )
105  return INT;
106  else if ( typ == typeid( long ) )
107  return LONG;
108  else if ( typ == typeid( long long ) )
109  return LONGLONG;
110  else if ( typ == typeid( bool ) )
111  return BOOL;
112  else if ( typ == typeid( float ) )
113  return FLOAT;
114  else if ( typ == typeid( double ) )
115  return DOUBLE;
116  else if ( typ == typeid( std::string ) )
117  return STRING;
118  else if ( typ == typeid( char* ) )
119  return NTCHAR;
120  else if ( typ == typeid( SmartRef<DataObject> ) )
121  return OBJECT_REF;
122  else if ( typ == typeid( SmartRef<ContainedObject> ) )
123  return CONTAINED_REF;
124  else if ( typ == typeid( IOpaqueAddress* ) )
125  return OBJECT_ADDR;
126  else if ( typ == typeid( void* ) )
127  return POINTER;
128  else
129  return UNKNOWN;
130  }
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.

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

Definition at line 106 of file DataTypeInfo.cpp.

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

Definition at line 154 of file DataTypeInfo.cpp.

155 {
156  if ( typ == typeid( unsigned char ) )
157  return DataTypeInfo::name( UCHAR );
158  else if ( typ == typeid( unsigned short ) )
159  return DataTypeInfo::name( USHORT );
160  else if ( typ == typeid( unsigned int ) )
161  return DataTypeInfo::name( UINT );
162  else if ( typ == typeid( unsigned long ) )
163  return DataTypeInfo::name( ULONG );
164  else if ( typ == typeid( char ) )
165  return DataTypeInfo::name( CHAR );
166  else if ( typ == typeid( short ) )
167  return DataTypeInfo::name( SHORT );
168  else if ( typ == typeid( int ) )
169  return DataTypeInfo::name( INT );
170  else if ( typ == typeid( long ) )
171  return DataTypeInfo::name( LONG );
172  else if ( typ == typeid( bool ) )
173  return DataTypeInfo::name( BOOL );
174  else if ( typ == typeid( float ) )
175  return DataTypeInfo::name( FLOAT );
176  else if ( typ == typeid( double ) )
177  return DataTypeInfo::name( DOUBLE );
178  else if ( typ == typeid( std::string ) )
179  return DataTypeInfo::name( STRING );
180  else if ( typ == typeid( char* ) )
181  return DataTypeInfo::name( NTCHAR );
182  else if ( typ == typeid( IOpaqueAddress* ) )
184  else if ( typ == typeid( SmartRef<DataObject> ) )
185  return DataTypeInfo::name( OBJECT_REF );
186  else if ( typ == typeid( SmartRef<ContainedObject> ) )
188  else if ( typ == typeid( void* ) )
189  return DataTypeInfo::name( POINTER );
190  else
191  return DataTypeInfo::name( UNKNOWN );
192 }
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 184 of file DataTypeInfo.h.

185  {
186  switch ( typ ) {
187  case UCHAR:
188  return sizeof( unsigned char );
189  case USHORT:
190  return sizeof( unsigned short );
191  case UINT:
192  return sizeof( unsigned int );
193  case ULONG:
194  return sizeof( unsigned long );
195  case ULONGLONG:
196  return sizeof( unsigned long long );
197  case CHAR:
198  return sizeof( char );
199  case SHORT:
200  return sizeof( short );
201  case INT:
202  return sizeof( int );
203  case LONG:
204  return sizeof( long );
205  case LONGLONG:
206  return sizeof( long long );
207  case BOOL:
208  return sizeof( bool );
209  case FLOAT:
210  return sizeof( float );
211  case DOUBLE:
212  return sizeof( double );
213  case STRING:
214  return sizeof( std::string );
215  case LONG_STRING:
216  return sizeof( std::string );
217  case NTCHAR:
218  return sizeof( char* );
219  case LONG_NTCHAR:
220  return sizeof( char* );
221  case OBJECT_ADDR:
222  case POINTER:
223  case OBJECT_REF:
224  case CONTAINED_REF:
225  case UNKNOWN:
226  default:
227  return 0;
228  }
229  }
STL class.
static long DataTypeInfo::size ( const std::type_info typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 232 of file DataTypeInfo.h.

232 { return size( ID( typ ) ); }
static Type ID(const bool)
Access to type information: bool.
Definition: DataTypeInfo.h:49
static long size(long typ)
Access to type information: the reverse way.
Definition: DataTypeInfo.h:184
static const std::type_info& DataTypeInfo::type ( long  typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 133 of file DataTypeInfo.h.

134  {
135  switch ( typ ) {
136  case UCHAR:
137  return typeid( unsigned char );
138  case USHORT:
139  return typeid( unsigned short );
140  case UINT:
141  return typeid( unsigned int );
142  case ULONG:
143  return typeid( unsigned long );
144  case ULONGLONG:
145  return typeid( unsigned long long );
146  case CHAR:
147  return typeid( char );
148  case SHORT:
149  return typeid( short );
150  case INT:
151  return typeid( int );
152  case LONG:
153  return typeid( long );
154  case LONGLONG:
155  return typeid( long long );
156  case BOOL:
157  return typeid( bool );
158  case FLOAT:
159  return typeid( float );
160  case DOUBLE:
161  return typeid( double );
162  case LONG_STRING:
163  return typeid( std::string );
164  case STRING:
165  return typeid( std::string );
166  case NTCHAR:
167  return typeid( char* );
168  case LONG_NTCHAR:
169  return typeid( char* );
170  case OBJECT_REF:
171  return typeid( SmartRef<DataObject> );
172  case CONTAINED_REF:
173  return typeid( SmartRef<ContainedObject> );
174  case OBJECT_ADDR:
175  return typeid( IOpaqueAddress* );
176  case POINTER:
177  case UNKNOWN:
178  default:
179  return typeid( void* );
180  }
181  }
STL class.
Opaque address interface definition.
const std::type_info & DataTypeInfo::typeByName ( const std::string typ)
static

Access to type information.

Definition at line 65 of file DataTypeInfo.cpp.

66 {
67  if ( typ == "unsigned char" || typ == "const unsigned char" )
68  return typeid( unsigned char );
69  else if ( typ == "unsigned short" || typ == "const unsigned short" )
70  return typeid( unsigned short );
71  else if ( typ == "unsigned int" || typ == "const unsigned int" )
72  return typeid( unsigned int );
73  else if ( typ == "unsigned long" || typ == "const unsigned long" )
74  return typeid( unsigned long );
75  else if ( typ == "char" || typ == "const char" )
76  return typeid( char );
77  else if ( typ == "short" || typ == "const short" )
78  return typeid( short );
79  else if ( typ == "int" || typ == "const int" )
80  return typeid( int );
81  else if ( typ == "long" || typ == "const long" )
82  return typeid( long );
83  else if ( typ == "bool" || typ == "const bool" )
84  return typeid( bool );
85  else if ( typ == "float" || typ == "const float" )
86  return typeid( float );
87  else if ( typ == "double" || typ == "const double" )
88  return typeid( double );
89  else if ( typ == "std::string" || typ == "const std::string" )
90  return typeid( std::string );
91  else if ( typ == "char*" || typ == "const char*" )
92  return typeid( char* );
93  else if ( typ == "IOpaqueAddress*" || typ == "const IOpaqueAddress*" )
94  return typeid( IOpaqueAddress );
95  else if ( typ == "SmartRef<DataObject>" || typ == "const SmartRef<DataObject>" )
96  return typeid( DataObject* );
97  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
98  return typeid( SmartRef<ContainedObject> );
99  else if ( typ == "void*" || typ == "const void*" )
100  return typeid( void* );
101  else
102  return typeid( void* );
103 }
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: