The Gaudi Framework  v31r0 (aeb156f0)
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 23 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 231 of file DataTypeInfo.h.

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

Access to type information: bool.

Definition at line 48 of file DataTypeInfo.h.

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

Access to type information: char.

Definition at line 50 of file DataTypeInfo.h.

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

Access to type information: short.

Definition at line 52 of file DataTypeInfo.h.

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

Access to type information: int.

Definition at line 54 of file DataTypeInfo.h.

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

Access to type information: long.

Definition at line 56 of file DataTypeInfo.h.

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

Access to type information: long long.

Definition at line 58 of file DataTypeInfo.h.

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

Access to type information: unsigned char.

Definition at line 60 of file DataTypeInfo.h.

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

Access to type information: unsigned short.

Definition at line 62 of file DataTypeInfo.h.

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

Access to type information: unsigned int.

Definition at line 64 of file DataTypeInfo.h.

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

Access to type information: unsigned long.

Definition at line 66 of file DataTypeInfo.h.

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

Access to type information: unsigned long long.

Definition at line 68 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const float  )
inlinestatic

Access to type information: float.

Definition at line 70 of file DataTypeInfo.h.

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

Access to type information: float.

Definition at line 72 of file DataTypeInfo.h.

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

Access to type information: std::string.

Definition at line 74 of file DataTypeInfo.h.

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

Access to type information: char* (NULL terminated)

Definition at line 76 of file DataTypeInfo.h.

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

Access to type information: IOpaqueAddress.

Definition at line 78 of file DataTypeInfo.h.

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

Access to type information: Pointers.

Definition at line 80 of file DataTypeInfo.h.

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

Access to type information: DataObject.

Definition at line 82 of file DataTypeInfo.h.

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

Access to type information: Contained object.

Definition at line 84 of file DataTypeInfo.h.

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

Access to type information: the reverse way.

Definition at line 87 of file DataTypeInfo.h.

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

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

Definition at line 149 of file DataTypeInfo.cpp.

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

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

Access to type information: the reverse way.

Definition at line 228 of file DataTypeInfo.h.

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

Access to type information: the reverse way.

Definition at line 131 of file DataTypeInfo.h.

131  {
132  switch ( typ ) {
133  case UCHAR:
134  return typeid( unsigned char );
135  case USHORT:
136  return typeid( unsigned short );
137  case UINT:
138  return typeid( unsigned int );
139  case ULONG:
140  return typeid( unsigned long );
141  case ULONGLONG:
142  return typeid( unsigned long long );
143  case CHAR:
144  return typeid( char );
145  case SHORT:
146  return typeid( short );
147  case INT:
148  return typeid( int );
149  case LONG:
150  return typeid( long );
151  case LONGLONG:
152  return typeid( long long );
153  case BOOL:
154  return typeid( bool );
155  case FLOAT:
156  return typeid( float );
157  case DOUBLE:
158  return typeid( double );
159  case LONG_STRING:
160  return typeid( std::string );
161  case STRING:
162  return typeid( std::string );
163  case NTCHAR:
164  return typeid( char* );
165  case LONG_NTCHAR:
166  return typeid( char* );
167  case OBJECT_REF:
168  return typeid( SmartRef<DataObject> );
169  case CONTAINED_REF:
170  return typeid( SmartRef<ContainedObject> );
171  case OBJECT_ADDR:
172  return typeid( IOpaqueAddress* );
173  case POINTER:
174  case UNKNOWN:
175  default:
176  return typeid( void* );
177  }
178  }
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
98  return typeid( void* );
99 }
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: