fw4spl
getObject.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2016.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWDATACAMP_GETOBJECT_HPP__
8 #define __FWDATACAMP_GETOBJECT_HPP__
9 
10 #include <string>
11 
12 
13 #include <fwCore/macros.hpp>
14 
15 #include "fwDataCamp/config.hpp"
16 
17 namespace fwData
18 {
19 class Object;
20 }
21 
22 namespace fwDataCamp
23 {
24 
35 FWDATACAMP_API SPTR(::fwData::Object) getObject( CSPTR(::fwData::Object) object,
36  const std::string & path,
37  bool raiseException = false);
38 
42 template< class DATATYPE >
43 SPTR(DATATYPE) getObject( CSPTR(::fwData::Object) object,
44  const std::string & path,
45  bool raiseException = false )
46 {
47  SPTR(::fwData::Object) subObject = getObject( object, path, raiseException );
48  SPTR(DATATYPE) casteDdata = ::std::dynamic_pointer_cast<DATATYPE>( subObject );
49  return casteDdata;
50 }
51 
52 
53 } // namespace fwDataCamp
54 
55 #endif // __FWDATACAMP_GETOBJECT_HPP__
56 
#define SPTR(_cls_)
#define CSPTR(_cls_)
STL namespace.
This file defines fwCore base macros.
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.
Definition: getObject.hpp:43
This namespace contains data object descriptions used for introspection.
Base class for each data object.
Contains the representation of the data objects used in the framework.