16 #ifndef SURGSIM_FRAMEWORK_ACCESSIBLE_INL_H 17 #define SURGSIM_FRAMEWORK_ACCESSIBLE_INL_H 26 if (value !=
nullptr && functors !=
m_functors.end() && functors->second.getter !=
nullptr)
30 *value = boost::any_cast<T>(functors->second.getter());
33 catch (boost::bad_any_cast exception)
47 result = boost::any_cast<T>(
getValue(name));
49 catch (boost::bad_any_cast exception)
51 SURGSIM_FAILURE() <<
"Failure to cast to the given type. <" << exception.what() <<
">";
60 return boost::any_cast<T>(val);
#define SURGSIM_FAILURE()
Report that something very bad has happened and abort program execution.
Definition: Assert.h:95
SurgSim::Math::Matrix44f convert(boost::any val)
Specialization for convert<T>() to correctly cast Matrix44d to Matrix44f, will throw if the val is no...
Definition: Accessible.cpp:210
std::unordered_map< std::string, Functors > m_functors
Definition: Accessible.h:173
The header that provides the assertion API.
T getValue(const std::string &name) const
Retrieves the value with the name by executing the getter if it is found and tries to convert it to t...
Definition: Accessible-inl.h:42