16 #ifndef SURGSIM_DATASTRUCTURES_NAMEDVARIANTDATA_INL_H 17 #define SURGSIM_DATASTRUCTURES_NAMEDVARIANTDATA_INL_H 23 namespace DataStructures
54 return (a.type() ==
typeid(T));
65 return hasTypedData<T>(index);
76 *value = boost::any_cast<T>(a);
78 catch(
const boost::bad_any_cast &)
80 SURGSIM_FAILURE() <<
"Cannot cast the named value to the specified type.";
89 return get(index, value);
96 #endif // SURGSIM_DATASTRUCTURES_NAMEDVARIANTDATA_INL_H Definition: DriveElementFromInputBehavior.cpp:27
NamedVariantData()
Definition: NamedVariantData-inl.h:26
bool hasData(int index) const
Check whether the entry with the specified index contains valid data.
bool hasTypedData(int index) const
Check whether the entry with the specified index contains valid data.
Definition: NamedVariantData-inl.h:36
#define SURGSIM_FAILURE()
Report that something very bad has happened and abort program execution.
Definition: Assert.h:95
int getIndex(const std::string &name) const
Given a name, return the corresponding index (or -1).
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
The header that provides the assertion API.
bool get(int index, T *value) const
Given an index, get the corresponding value.
Definition: NamedData-inl.h:194
bool get(int index, T *value) const
Given an index, get the corresponding value.
Definition: NamedVariantData-inl.h:69