16 #ifndef SURGSIM_FRAMEWORK_COMPONENT_INL_H 17 #define SURGSIM_FRAMEWORK_COMPONENT_INL_H 26 template <
class Target,
class Source>
27 std::shared_ptr<Target>
checkAndConvert(std::shared_ptr<Source> incoming,
const std::string& expectedTypeName)
29 SURGSIM_ASSERT(incoming !=
nullptr) <<
"Incoming pointer can't be nullptr";
30 auto result = std::dynamic_pointer_cast<Target>(incoming);
32 <<
"Expected " << expectedTypeName <<
" but received " << incoming->getClassName() <<
" which cannot " 33 <<
"be converted, in component " << incoming->getFullName() <<
".";
Definition: CompoundShapeToGraphics.cpp:29
std::shared_ptr< Target > checkAndConvert(std::shared_ptr< Source > incoming, const std::string &expectedTypeName)
The function tries to convert the Source type to the Target type it will throw if Target is not a sub...
Definition: Component-inl.h:27
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77