fw4spl
IObjectWriter.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #include "fwDataIO/writer/IObjectWriter.hpp"
8 
9 #include <fwJobs/IJob.hpp>
10 
11 namespace fwDataIO
12 {
13 
14 namespace writer
15 {
16 
17 //------------------------------------------------------------------------------
18 
20 {
21 }
22 
23 //------------------------------------------------------------------------------
24 
26 {
27 }
28 
29 //------------------------------------------------------------------------------
30 
31 void IObjectWriter::setObject( ::fwTools::Object::csptr object )
32 {
33  m_object = object;
34 }
35 
36 //------------------------------------------------------------------------------
37 
38 ::fwTools::Object::csptr IObjectWriter::getObject() const
39 {
40  assert( !m_object.expired() );
41  return m_object.lock();
42 }
43 
44 //------------------------------------------------------------------------------
45 
46 void IObjectWriter::setLocation( const ::fwData::location::ILocation::sptr _location )
47 {
48  m_location = _location;
49 }
50 
51 //------------------------------------------------------------------------------
52 
53 ::fwData::location::ILocation::sptr IObjectWriter::getLocation()
54 {
55  return m_location;
56 }
57 
58 //------------------------------------------------------------------------------
59 
61 {
62  return std::string();
63 }
64 
65 //------------------------------------------------------------------------------
66 
68 {
69  auto job = this->getJob();
70  if ( job )
71  {
72  job->cancel();
73  }
74 }
75 
76 //------------------------------------------------------------------------------
77 
78 } // namespace writer
79 
80 } // namespace fwDataIO
FWDATAIO_API IObjectWriter()
Constructor. Do nothing.
This namespace fwDataIO contains reader and writer for several framework&#39;s data.
::fwTools::Object::cwptr m_object
Object write on filesystem by the process.
virtual FWDATAIO_API std::string extension()=0
Return the default filename extension can be dynamic.
virtual std::shared_ptr< ::fwJobs::IJob > getJob() const
Returns the internal job, nullptr by default.
virtual FWDATAIO_API::fwTools::Object::csptr getObject() const
m_object getter.
virtual FWDATAIO_API ~IObjectWriter()
Destructor. Do nothing.
::fwData::location::ILocation::sptr m_location
Object location ( file path, directory path, url, etc )
virtual FWDATAIO_API void setObject(::fwTools::Object::csptr object)
m_object setter.
virtual FWDATAIO_API void cancel()
Requests writer abortion.
virtual FWDATAIO_API::fwData::location::ILocation::sptr getLocation()
m_location getter.
virtual FWDATAIO_API void setLocation(const ::fwData::location::ILocation::sptr location)
m_location setter.