10#ifndef BAM_CONSTANTS_H
11#define BAM_CONSTANTS_H
157 static bool CanConvertFrom(
const char)
162 static bool CanConvertTo(
const char)
167 static char TypeCode()
175struct TagTypeHelper<uint8_t>
177 static bool CanConvertFrom(
const char c)
179 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_UINT8);
181 static bool CanConvertTo(
const char c)
183 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_UINT8 ||
184 c == Constants::BAM_TAG_TYPE_UINT16 || c == Constants::BAM_TAG_TYPE_UINT32);
187 static char TypeCode()
189 return Constants::BAM_TAG_TYPE_UINT8;
194struct TagTypeHelper<int8_t>
196 static bool CanConvertFrom(
const char c)
198 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_INT8);
200 static bool CanConvertTo(
const char c)
202 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_INT8 ||
203 c == Constants::BAM_TAG_TYPE_INT16 || c == Constants::BAM_TAG_TYPE_INT32);
205 static char TypeCode()
207 return Constants::BAM_TAG_TYPE_INT8;
212struct TagTypeHelper<uint16_t>
214 static bool CanConvertFrom(
const char c)
216 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_UINT8 ||
217 c == Constants::BAM_TAG_TYPE_UINT16);
219 static bool CanConvertTo(
const char c)
221 return (c == Constants::BAM_TAG_TYPE_UINT16 || c == Constants::BAM_TAG_TYPE_UINT32);
223 static char TypeCode()
225 return Constants::BAM_TAG_TYPE_UINT16;
230struct TagTypeHelper<int16_t>
232 static bool CanConvertFrom(
const char c)
234 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_INT8 ||
235 c == Constants::BAM_TAG_TYPE_INT16);
237 static bool CanConvertTo(
const char c)
239 return (c == Constants::BAM_TAG_TYPE_INT16 || c == Constants::BAM_TAG_TYPE_INT32);
241 static char TypeCode()
243 return Constants::BAM_TAG_TYPE_INT16;
248struct TagTypeHelper<uint32_t>
250 static bool CanConvertFrom(
const char c)
252 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_UINT8 ||
253 c == Constants::BAM_TAG_TYPE_UINT16 || c == Constants::BAM_TAG_TYPE_UINT32);
255 static bool CanConvertTo(
const char c)
257 return (c == Constants::BAM_TAG_TYPE_UINT32);
259 static char TypeCode()
261 return Constants::BAM_TAG_TYPE_UINT32;
266struct TagTypeHelper<int32_t>
268 static bool CanConvertFrom(
const char c)
270 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_INT8 ||
271 c == Constants::BAM_TAG_TYPE_INT16 || c == Constants::BAM_TAG_TYPE_INT32);
273 static bool CanConvertTo(
const char c)
275 return (c == Constants::BAM_TAG_TYPE_INT32);
277 static char TypeCode()
279 return Constants::BAM_TAG_TYPE_INT32;
284struct TagTypeHelper<float>
286 static bool CanConvertFrom(
const char c)
288 return (c == Constants::BAM_TAG_TYPE_ASCII || c == Constants::BAM_TAG_TYPE_UINT8 ||
289 c == Constants::BAM_TAG_TYPE_INT8 || c == Constants::BAM_TAG_TYPE_UINT16 ||
290 c == Constants::BAM_TAG_TYPE_INT16 || c == Constants::BAM_TAG_TYPE_UINT32 ||
291 c == Constants::BAM_TAG_TYPE_INT32 || c == Constants::BAM_TAG_TYPE_FLOAT);
293 static bool CanConvertTo(
const char c)
295 return (c == Constants::BAM_TAG_TYPE_FLOAT);
297 static char TypeCode()
299 return Constants::BAM_TAG_TYPE_FLOAT;
304struct TagTypeHelper<std::string>
306 static bool CanConvertFrom(
const char c)
308 return (c == Constants::BAM_TAG_TYPE_HEX || c == Constants::BAM_TAG_TYPE_STRING);
310 static bool CanConvertTo(
const char c)
312 return (c == Constants::BAM_TAG_TYPE_HEX || c == Constants::BAM_TAG_TYPE_STRING);
314 static char TypeCode()
316 return Constants::BAM_TAG_TYPE_STRING;