7 #include <fwCore/base.hpp> 9 #include <fwData/Object.hpp> 11 #include "fwDataCamp/getObject.hpp" 12 #include "fwDataCamp/visitor/GetObject.hpp" 13 #include "fwDataCamp/exception/NullPointer.hpp" 14 #include "fwDataCamp/exception/ObjectNotFound.hpp" 19 ::fwData::Object::sptr
getObject( ::fwData::Object::csptr
object,
20 const std::string& path,
23 SLM_FATAL_IF(
"Path for desired object is empty.", path.empty() );
24 SLM_FATAL_IF(
"Path for desired object doesn't start with '@'.", path[0] !=
'@' );
25 const std::string objectPath = path.substr( 1 );
27 ::fwData::Object::sptr subObject;
30 subObject = visitor.get();
32 catch(const ::fwDataCamp::exception::NullPointer& np)
34 FW_FORWARD_EXCEPTION_IF(np, raiseException);
37 FW_RAISE_EXCEPTION_IF(
39 !visitor.objectsFound() && raiseException);
FWDATACAMP_API std::shared_ptr< ::fwData::Object > getObject(std::shared_ptr< const ::fwData::Object > object, const std::string &path, bool raiseException=false)
Returns the object designated by the given path within given object.
This namespace contains data object descriptions used for introspection.
Object not found exception.
#define SLM_FATAL_IF(message, cond)
This class is an helper to introspect a data and find an object (contained into this data) from a nor...