All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_info & type (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_info & typeByName (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 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 ( )
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 218 of file DataTypeInfo.h.

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

Access to type information: bool.

Definition at line 33 of file DataTypeInfo.h.

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

Access to type information: char.

Definition at line 35 of file DataTypeInfo.h.

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

Access to type information: short.

Definition at line 37 of file DataTypeInfo.h.

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

Access to type information: int.

Definition at line 39 of file DataTypeInfo.h.

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

Access to type information: long.

Definition at line 41 of file DataTypeInfo.h.

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

Access to type information: long long.

Definition at line 43 of file DataTypeInfo.h.

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

Access to type information: unsigned char.

Definition at line 45 of file DataTypeInfo.h.

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

Access to type information: unsigned short.

Definition at line 47 of file DataTypeInfo.h.

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

Access to type information: unsigned int.

Definition at line 49 of file DataTypeInfo.h.

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

Access to type information: unsigned long.

Definition at line 51 of file DataTypeInfo.h.

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

Access to type information: unsigned long long.

Definition at line 53 of file DataTypeInfo.h.

static Type DataTypeInfo::ID ( const float  )
inlinestatic

Access to type information: float.

Definition at line 55 of file DataTypeInfo.h.

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

Access to type information: float.

Definition at line 57 of file DataTypeInfo.h.

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

Access to type information: std::string.

Definition at line 59 of file DataTypeInfo.h.

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

Access to type information: char* (NULL terminated)

Definition at line 61 of file DataTypeInfo.h.

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

Access to type information: IOpaqueAddress.

Definition at line 63 of file DataTypeInfo.h.

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

Access to type information: Pointers.

Definition at line 65 of file DataTypeInfo.h.

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

Access to type information: DataObject.

Definition at line 67 of file DataTypeInfo.h.

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

Access to type information: Contained object.

Definition at line 69 of file DataTypeInfo.h.

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

Access to type information: the reverse way.

Definition at line 72 of file DataTypeInfo.h.

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

Access to type information.

Definition at line 25 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 105 of file DataTypeInfo.cpp.

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

Definition at line 152 of file DataTypeInfo.cpp.

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

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

Access to type information: the reverse way.

Definition at line 213 of file DataTypeInfo.h.

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

Access to type information: the reverse way.

Definition at line 116 of file DataTypeInfo.h.

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

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

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