Skip to content
Snippets Groups Projects
Commit 966f96d4 authored by Nicolas Mansard's avatar Nicolas Mansard
Browse files

Added an helper to get the Value::TypeID directly from the type.

parent 7d0ee40c
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,15 @@ namespace dynamicgraph { ...@@ -106,7 +106,15 @@ namespace dynamicgraph {
Type type_; Type type_;
const void* const value_; const void* const value_;
}; };
} // namespace command
/* ---- HELPER ---------------------------------------------------------- */
template< typename T >
struct ValueHelper
{
static const Value::Type TypeID;
};
} // namespace command
} //namespace dynamicgraph } //namespace dynamicgraph
#endif //DYNAMIC_GRAPH_VALUE_H #endif //DYNAMIC_GRAPH_VALUE_H
...@@ -322,5 +322,15 @@ namespace dynamicgraph { ...@@ -322,5 +322,15 @@ namespace dynamicgraph {
return os; return os;
} }
/* ---- HELPER ---------------------------------------------------------- */
template<> const Value::Type ValueHelper<bool>::TypeID = Value::BOOL;
template<> const Value::Type ValueHelper<unsigned>::TypeID = Value::UNSIGNED;
template<> const Value::Type ValueHelper<int>::TypeID = Value::INT;
template<> const Value::Type ValueHelper<float>::TypeID = Value::FLOAT;
template<> const Value::Type ValueHelper<double>::TypeID = Value::DOUBLE;
template<> const Value::Type ValueHelper<std::string>::TypeID = Value::STRING;
template<> const Value::Type ValueHelper<Vector>::TypeID = Value::VECTOR;
template<> const Value::Type ValueHelper<Matrix>::TypeID = Value::MATRIX;
} // namespace command } // namespace command
} //namespace dynamicgraph } //namespace dynamicgraph
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