The Gaudi Framework  v36r9p1 (5c15b2bb)
DataTypeInfo Class Reference

#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 26 of file DataTypeInfo.h.

Member Enumeration Documentation

◆ Type

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 33 of file DataTypeInfo.h.

33  {
34  UNKNOWN = 0,
35  UCHAR,
36  USHORT,
37  UINT,
38  ULONG,
39  CHAR,
40  SHORT,
41  INT,
42  LONG,
43  BOOL,
44  FLOAT,
45  DOUBLE,
46  STRING,
47  NTCHAR,
48  OBJECT_REF,
50  POINTER,
54  LONGLONG,
55  ULONGLONG
56  };

Constructor & Destructor Documentation

◆ DataTypeInfo()

DataTypeInfo::DataTypeInfo ( )
inlineprivate

Definition at line 29 of file DataTypeInfo.h.

29 {}

Member Function Documentation

◆ copy()

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

Copy data.

Definition at line 241 of file DataTypeInfo.h.

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

◆ ID() [1/20]

static Type DataTypeInfo::ID ( const bool  )
inlinestatic

Access to type information: bool.

Definition at line 58 of file DataTypeInfo.h.

58 { return BOOL; }

◆ ID() [2/20]

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

Access to type information: char* (NULL terminated)

Definition at line 86 of file DataTypeInfo.h.

86 { return NTCHAR; }

◆ ID() [3/20]

static Type DataTypeInfo::ID ( const char  )
inlinestatic

Access to type information: char.

Definition at line 60 of file DataTypeInfo.h.

60 { return CHAR; }

◆ ID() [4/20]

static Type DataTypeInfo::ID ( const double  )
inlinestatic

Access to type information: float.

Definition at line 82 of file DataTypeInfo.h.

82 { return DOUBLE; }

◆ ID() [5/20]

static Type DataTypeInfo::ID ( const float  )
inlinestatic

Access to type information: float.

Definition at line 80 of file DataTypeInfo.h.

80 { return FLOAT; }

◆ ID() [6/20]

static Type DataTypeInfo::ID ( const int  )
inlinestatic

Access to type information: int.

Definition at line 64 of file DataTypeInfo.h.

64 { return INT; }

◆ ID() [7/20]

static Type DataTypeInfo::ID ( const IOpaqueAddress )
inlinestatic

Access to type information: IOpaqueAddress.

Definition at line 88 of file DataTypeInfo.h.

88 { return OBJECT_ADDR; }

◆ ID() [8/20]

static Type DataTypeInfo::ID ( const long long  )
inlinestatic

Access to type information: long long.

Definition at line 68 of file DataTypeInfo.h.

68 { return LONGLONG; }

◆ ID() [9/20]

static Type DataTypeInfo::ID ( const long  )
inlinestatic

Access to type information: long.

Definition at line 66 of file DataTypeInfo.h.

66 { return LONG; }

◆ ID() [10/20]

static Type DataTypeInfo::ID ( const short  )
inlinestatic

Access to type information: short.

Definition at line 62 of file DataTypeInfo.h.

62 { return SHORT; }

◆ ID() [11/20]

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

Access to type information: Contained object.

Definition at line 94 of file DataTypeInfo.h.

94 { return CONTAINED_REF; }

◆ ID() [12/20]

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

Access to type information: DataObject.

Definition at line 92 of file DataTypeInfo.h.

92 { return OBJECT_REF; }

◆ ID() [13/20]

static Type DataTypeInfo::ID ( const std::string )
inlinestatic

Access to type information: std::string.

Definition at line 84 of file DataTypeInfo.h.

84 { return STRING; }

◆ ID() [14/20]

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

Access to type information: the reverse way.

Definition at line 97 of file DataTypeInfo.h.

97  {
98  if ( typ == typeid( unsigned char ) )
99  return UCHAR;
100  else if ( typ == typeid( unsigned short ) )
101  return USHORT;
102  else if ( typ == typeid( unsigned int ) )
103  return UINT;
104  else if ( typ == typeid( unsigned long ) )
105  return ULONG;
106  else if ( typ == typeid( unsigned long long ) )
107  return ULONGLONG;
108  else if ( typ == typeid( char ) )
109  return CHAR;
110  else if ( typ == typeid( short ) )
111  return SHORT;
112  else if ( typ == typeid( int ) )
113  return INT;
114  else if ( typ == typeid( long ) )
115  return LONG;
116  else if ( typ == typeid( long long ) )
117  return LONGLONG;
118  else if ( typ == typeid( bool ) )
119  return BOOL;
120  else if ( typ == typeid( float ) )
121  return FLOAT;
122  else if ( typ == typeid( double ) )
123  return DOUBLE;
124  else if ( typ == typeid( std::string ) )
125  return STRING;
126  else if ( typ == typeid( char* ) )
127  return NTCHAR;
128  else if ( typ == typeid( SmartRef<DataObject> ) )
129  return OBJECT_REF;
130  else if ( typ == typeid( SmartRef<ContainedObject> ) )
131  return CONTAINED_REF;
132  else if ( typ == typeid( IOpaqueAddress* ) )
133  return OBJECT_ADDR;
134  else if ( typ == typeid( void* ) )
135  return POINTER;
136  else
137  return UNKNOWN;
138  }

◆ ID() [15/20]

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

Access to type information: unsigned char.

Definition at line 70 of file DataTypeInfo.h.

70 { return UCHAR; }

◆ ID() [16/20]

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

Access to type information: unsigned int.

Definition at line 74 of file DataTypeInfo.h.

74 { return UINT; }

◆ ID() [17/20]

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

Access to type information: unsigned long long.

Definition at line 78 of file DataTypeInfo.h.

78 { return ULONGLONG; }

◆ ID() [18/20]

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

Access to type information: unsigned long.

Definition at line 76 of file DataTypeInfo.h.

76 { return ULONG; }

◆ ID() [19/20]

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

Access to type information: unsigned short.

Definition at line 72 of file DataTypeInfo.h.

72 { return USHORT; }

◆ ID() [20/20]

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

Access to type information: Pointers.

Definition at line 90 of file DataTypeInfo.h.

90 { return POINTER; }

◆ idByName()

DataTypeInfo::Type DataTypeInfo::idByName ( const std::string typ)
static

Access to type information.

Definition at line 34 of file DataTypeInfo.cpp.

34  {
35  if ( typ == "unsigned char" || typ == "const unsigned char" )
36  return UCHAR;
37  else if ( typ == "unsigned short" || typ == "const unsigned short" )
38  return USHORT;
39  else if ( typ == "unsigned int" || typ == "const unsigned int" )
40  return UINT;
41  else if ( typ == "unsigned long" || typ == "const unsigned long" )
42  return ULONG;
43  else if ( typ == "char" || typ == "const char" )
44  return CHAR;
45  else if ( typ == "short" || typ == "const short" )
46  return SHORT;
47  else if ( typ == "int" || typ == "const int" )
48  return INT;
49  else if ( typ == "long" || typ == "const long" )
50  return LONG;
51  else if ( typ == "bool" || typ == "const bool" )
52  return BOOL;
53  else if ( typ == "float" || typ == "const float" )
54  return FLOAT;
55  else if ( typ == "double" || typ == "const double" )
56  return DOUBLE;
57  else if ( typ == "std::string" || typ == "const std::string" )
58  return STRING;
59  else if ( typ == "char*" || typ == "const char*" )
60  return NTCHAR;
61  else if ( typ == "IOpaqueAddress*" || typ == "const IOpaqueAddress*" )
62  return OBJECT_ADDR;
63  else if ( typ == "SmartRef<DataObject>" || typ == "const SmartRef<DataObject>" )
64  return OBJECT_REF;
65  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
66  return CONTAINED_REF;
67  else if ( typ == "void*" || typ == "const void*" )
68  return POINTER;
69  else
70  return UNKNOWN;
71 }

◆ name() [1/2]

std::string DataTypeInfo::name ( const std::type_info typ)
static

Definition at line 159 of file DataTypeInfo.cpp.

159  {
160  if ( typ == typeid( unsigned char ) )
161  return DataTypeInfo::name( UCHAR );
162  else if ( typ == typeid( unsigned short ) )
163  return DataTypeInfo::name( USHORT );
164  else if ( typ == typeid( unsigned int ) )
165  return DataTypeInfo::name( UINT );
166  else if ( typ == typeid( unsigned long ) )
167  return DataTypeInfo::name( ULONG );
168  else if ( typ == typeid( char ) )
169  return DataTypeInfo::name( CHAR );
170  else if ( typ == typeid( short ) )
171  return DataTypeInfo::name( SHORT );
172  else if ( typ == typeid( int ) )
173  return DataTypeInfo::name( INT );
174  else if ( typ == typeid( long ) )
175  return DataTypeInfo::name( LONG );
176  else if ( typ == typeid( bool ) )
177  return DataTypeInfo::name( BOOL );
178  else if ( typ == typeid( float ) )
179  return DataTypeInfo::name( FLOAT );
180  else if ( typ == typeid( double ) )
181  return DataTypeInfo::name( DOUBLE );
182  else if ( typ == typeid( std::string ) )
183  return DataTypeInfo::name( STRING );
184  else if ( typ == typeid( char* ) )
185  return DataTypeInfo::name( NTCHAR );
186  else if ( typ == typeid( IOpaqueAddress* ) )
188  else if ( typ == typeid( SmartRef<DataObject> ) )
189  return DataTypeInfo::name( OBJECT_REF );
190  else if ( typ == typeid( SmartRef<ContainedObject> ) )
192  else if ( typ == typeid( void* ) )
193  return DataTypeInfo::name( POINTER );
194  else
195  return DataTypeInfo::name( UNKNOWN );
196 }

◆ name() [2/2]

std::string DataTypeInfo::name ( long  typ)
static

Definition at line 112 of file DataTypeInfo.cpp.

112  {
113  switch ( typ ) {
114  case UCHAR:
115  return System::typeinfoName( typeid( unsigned char ) );
116  case USHORT:
117  return System::typeinfoName( typeid( unsigned short ) );
118  case UINT:
119  return System::typeinfoName( typeid( unsigned int ) );
120  case ULONG:
121  return System::typeinfoName( typeid( unsigned long ) );
122  case CHAR:
123  return System::typeinfoName( typeid( char ) );
124  case SHORT:
125  return System::typeinfoName( typeid( short ) );
126  case INT:
127  return System::typeinfoName( typeid( int ) );
128  case LONG:
129  return System::typeinfoName( typeid( long ) );
130  case BOOL:
131  return System::typeinfoName( typeid( bool ) );
132  case FLOAT:
133  return System::typeinfoName( typeid( float ) );
134  case DOUBLE:
135  return System::typeinfoName( typeid( double ) );
136  case STRING:
137  return System::typeinfoName( typeid( std::string ) );
138  case LONG_STRING:
139  return System::typeinfoName( typeid( std::string ) );
140  case NTCHAR:
141  return System::typeinfoName( typeid( char* ) );
142  case LONG_NTCHAR:
143  return System::typeinfoName( typeid( char* ) );
144  case OBJECT_ADDR:
145  return System::typeinfoName( typeid( IOpaqueAddress* ) );
146  case OBJECT_REF:
147  return System::typeinfoName( typeid( SmartRef<DataObject> ) );
148  case CONTAINED_REF:
150  case POINTER:
151  return System::typeinfoName( typeid( void* ) );
152  case UNKNOWN:
153  default:
154  return "";
155  }
156 }

◆ size() [1/2]

static long DataTypeInfo::size ( const std::type_info typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 238 of file DataTypeInfo.h.

238 { return size( ID( typ ) ); }

◆ size() [2/2]

static long DataTypeInfo::size ( long  typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 191 of file DataTypeInfo.h.

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

◆ type()

static const std::type_info& DataTypeInfo::type ( long  typ)
inlinestatic

Access to type information: the reverse way.

Definition at line 141 of file DataTypeInfo.h.

141  {
142  switch ( typ ) {
143  case UCHAR:
144  return typeid( unsigned char );
145  case USHORT:
146  return typeid( unsigned short );
147  case UINT:
148  return typeid( unsigned int );
149  case ULONG:
150  return typeid( unsigned long );
151  case ULONGLONG:
152  return typeid( unsigned long long );
153  case CHAR:
154  return typeid( char );
155  case SHORT:
156  return typeid( short );
157  case INT:
158  return typeid( int );
159  case LONG:
160  return typeid( long );
161  case LONGLONG:
162  return typeid( long long );
163  case BOOL:
164  return typeid( bool );
165  case FLOAT:
166  return typeid( float );
167  case DOUBLE:
168  return typeid( double );
169  case LONG_STRING:
170  return typeid( std::string );
171  case STRING:
172  return typeid( std::string );
173  case NTCHAR:
174  return typeid( char* );
175  case LONG_NTCHAR:
176  return typeid( char* );
177  case OBJECT_REF:
178  return typeid( SmartRef<DataObject> );
179  case CONTAINED_REF:
180  return typeid( SmartRef<ContainedObject> );
181  case OBJECT_ADDR:
182  return typeid( IOpaqueAddress* );
183  case POINTER:
184  case UNKNOWN:
185  default:
186  return typeid( void* );
187  }
188  }

◆ typeByName()

const std::type_info & DataTypeInfo::typeByName ( const std::string typ)
static

Access to type information.

Definition at line 74 of file DataTypeInfo.cpp.

74  {
75  if ( typ == "unsigned char" || typ == "const unsigned char" )
76  return typeid( unsigned char );
77  else if ( typ == "unsigned short" || typ == "const unsigned short" )
78  return typeid( unsigned short );
79  else if ( typ == "unsigned int" || typ == "const unsigned int" )
80  return typeid( unsigned int );
81  else if ( typ == "unsigned long" || typ == "const unsigned long" )
82  return typeid( unsigned long );
83  else if ( typ == "char" || typ == "const char" )
84  return typeid( char );
85  else if ( typ == "short" || typ == "const short" )
86  return typeid( short );
87  else if ( typ == "int" || typ == "const int" )
88  return typeid( int );
89  else if ( typ == "long" || typ == "const long" )
90  return typeid( long );
91  else if ( typ == "bool" || typ == "const bool" )
92  return typeid( bool );
93  else if ( typ == "float" || typ == "const float" )
94  return typeid( float );
95  else if ( typ == "double" || typ == "const double" )
96  return typeid( double );
97  else if ( typ == "std::string" || typ == "const std::string" )
98  return typeid( std::string );
99  else if ( typ == "char*" || typ == "const char*" )
100  return typeid( char* );
101  else if ( typ == "IOpaqueAddress*" || typ == "const IOpaqueAddress*" )
102  return typeid( IOpaqueAddress );
103  else if ( typ == "SmartRef<DataObject>" || typ == "const SmartRef<DataObject>" )
104  return typeid( DataObject* );
105  else if ( typ == "SmartRef<ContainedObject>" || typ == "const SmartRef<ContainedObject>" )
106  return typeid( SmartRef<ContainedObject> );
107  else
108  return typeid( void* );
109 }

The documentation for this class was generated from the following files:
DataTypeInfo::ID
static Type ID(const bool)
Access to type information: bool.
Definition: DataTypeInfo.h:58
std::string
STL class.
DataTypeInfo::STRING
@ STRING
Definition: DataTypeInfo.h:46
Properties.long
long
(c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations # # This software i...
Definition: Properties.py:15
IOpaqueAddress
Definition: IOpaqueAddress.h:33
DataTypeInfo::NTCHAR
@ NTCHAR
Definition: DataTypeInfo.h:47
DataTypeInfo::POINTER
@ POINTER
Definition: DataTypeInfo.h:50
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:310
DataTypeInfo::USHORT
@ USHORT
Definition: DataTypeInfo.h:36
DataTypeInfo::ULONG
@ ULONG
Definition: DataTypeInfo.h:38
DataTypeInfo::LONG
@ LONG
Definition: DataTypeInfo.h:42
DataTypeInfo::size
static long size(long typ)
Access to type information: the reverse way.
Definition: DataTypeInfo.h:191
DataTypeInfo::DOUBLE
@ DOUBLE
Definition: DataTypeInfo.h:45
DataTypeInfo::SHORT
@ SHORT
Definition: DataTypeInfo.h:40
DataTypeInfo::UNKNOWN
@ UNKNOWN
Definition: DataTypeInfo.h:34
DataTypeInfo::CONTAINED_REF
@ CONTAINED_REF
Definition: DataTypeInfo.h:49
DataTypeInfo::LONG_STRING
@ LONG_STRING
Definition: DataTypeInfo.h:52
DataTypeInfo::FLOAT
@ FLOAT
Definition: DataTypeInfo.h:44
DataTypeInfo::UCHAR
@ UCHAR
Definition: DataTypeInfo.h:35
DataTypeInfo::UINT
@ UINT
Definition: DataTypeInfo.h:37
DataTypeInfo::BOOL
@ BOOL
Definition: DataTypeInfo.h:43
DataTypeInfo::name
static std::string name(long typ)
Definition: DataTypeInfo.cpp:112
DataTypeInfo::ULONGLONG
@ ULONGLONG
Definition: DataTypeInfo.h:55
DataObject
Definition: DataObject.h:40
DataTypeInfo::LONG_NTCHAR
@ LONG_NTCHAR
Definition: DataTypeInfo.h:53
std::memcpy
T memcpy(T... args)
DataTypeInfo::OBJECT_ADDR
@ OBJECT_ADDR
Definition: DataTypeInfo.h:51
SmartRef< DataObject >
DataTypeInfo::LONGLONG
@ LONGLONG
Definition: DataTypeInfo.h:54
DataTypeInfo::OBJECT_REF
@ OBJECT_REF
Definition: DataTypeInfo.h:48
DataTypeInfo::INT
@ INT
Definition: DataTypeInfo.h:41
DataTypeInfo::CHAR
@ CHAR
Definition: DataTypeInfo.h:39