16 #ifndef SURGSIM_FRAMEWORK_ACCESSIBLE_INL_H 17 #define SURGSIM_FRAMEWORK_ACCESSIBLE_INL_H 25 auto functors = m_functors.find(name);
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&)
47 result = boost::any_cast<T>(
getValue(name));
49 catch (
const boost::bad_any_cast& exception)
51 SURGSIM_FAILURE() <<
"Failure to cast to the given type. <" << exception.what() <<
">";
58 T SurgSim::Framework::convert(boost::any val)
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
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