fw4spl
GenericObjectReader.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
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 __FWDATAIO_READER_GENERICOBJECTREADER_HPP__
8 #define __FWDATAIO_READER_GENERICOBJECTREADER_HPP__
9 
10 #include "fwDataIO/config.hpp"
11 #include "fwDataIO/reader/IObjectReader.hpp"
12 
13 namespace fwDataIO
14 {
15 
16 namespace reader
17 {
18 
28 template<class DATATYPE>
30 {
31 
32 public:
33 
35  typedef DATATYPE DataType;
36 
38 
41  {
42  }
43 
44  //------------------------------------------------------------------------------
45 
46  virtual std::string extension() override
47  {
48  return ("");
49  }
50 
53  {
54  }
55 
62  virtual void setObject( ::fwTools::Object::sptr obj ) override
63  {
64  assert( std::dynamic_pointer_cast< DataType >( obj ) );
65  m_object = obj;
66  }
67 
74  virtual std::shared_ptr< DataType > getConcreteObject()
75  {
76  return std::dynamic_pointer_cast< DataType >( getObject() );
77  }
78 
79 };
80 
81 } // namespace reader
82 
83 } // namespace fwDataIO
84 
85 #endif // __FWDATAIO_READER_GENERICOBJECTREADER_HPP__
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)
GenericObjectReader()
Constructor. Do nothing.
virtual ~GenericObjectReader()
Destructor. Do nothing.
virtual void setObject(::fwTools::Object::sptr obj) override
m_object setter.
DATATYPE DataType
the object type related
This namespace fwDataIO contains reader and writer for several framework&#39;s data.
::fwTools::Object::wptr m_object
Object result of reading process.
generic class for all object readers.
virtual FWDATAIO_API::fwTools::Object::sptr getObject()
m_object getter.
virtual std::shared_ptr< DataType > getConcreteObject()
m_object getter.