Skip to content
Snippets Groups Projects
Commit caa5b8e0 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

add support for Boolean and Void types

parent ce970060
No related branches found
No related tags found
No related merge requests found
......@@ -197,8 +197,8 @@ namespace ChimeraTK {
ChimeraTK::TemplateUserTypeMap<MapOfArray> arrayMap;
/** Map assigning string type identifyers to C++ types */
ChimeraTK::SingleTypeUserTypeMap<const char*> typeMap{
"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float", "double", "string"};
ChimeraTK::SingleTypeUserTypeMap<const char*> typeMap{"int8", "uint8", "int16", "uint16", "int32", "uint32",
"int64", "uint64", "float", "double", "string", "boolean", "void"};
/** Implementation of get() which can be overloaded for scalars and vectors.
* The second argument is a dummy only to distinguish the two overloaded
......
......@@ -216,7 +216,8 @@ namespace ChimeraTK {
/// @todo error handling!
std::stringstream stream(value);
T convertedValue;
if(typeid(T) == typeid(int8_t) || typeid(T) == typeid(uint8_t)) { // prevent interpreting int8-types as characters
if constexpr(std::is_same<T, int8_t>::value || std::is_same<T, uint8_t>::value) {
// prevent interpreting int8-types as characters
int16_t intermediate;
stream >> intermediate;
convertedValue = intermediate;
......@@ -269,7 +270,8 @@ namespace ChimeraTK {
// convert value into user type
std::stringstream stream(it->second);
T convertedValue;
if(typeid(T) == typeid(int8_t) || typeid(T) == typeid(uint8_t)) { // prevent interpreting int8-types as characters
if constexpr(std::is_same<T, int8_t>::value || std::is_same<T, uint8_t>::value) {
// prevent interpreting int8-types as characters
int16_t intermediate;
stream >> intermediate;
convertedValue = intermediate;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment