fw4spl
fwMedData/src/fwMedData/ActivitySeries.cpp
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 #include "fwMedData/ActivitySeries.hpp"
8 
9 #include <fwData/Composite.hpp>
10 #include <fwData/Exception.hpp>
11 #include <fwData/registry/macros.hpp>
12 
13 fwDataRegisterMacro( ::fwMedData::ActivitySeries );
14 
15 namespace fwMedData
16 {
17 
19  Series(key),
20  m_data(::fwData::Composite::New())
21 {
22 }
23 
24 //------------------------------------------------------------------------------
25 
27 {
28 }
29 
30 //------------------------------------------------------------------------------
31 
32 void ActivitySeries::shallowCopy(const ::fwData::Object::csptr& _source)
33 {
34  ActivitySeries::csptr other = ActivitySeries::dynamicConstCast(_source);
35  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
36  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
37  + " to " + this->getClassname()), !bool(other) );
38 
39  this->::fwMedData::Series::shallowCopy(_source);
40  m_activityConfigId = other->m_activityConfigId;
41  m_data = other->m_data;
42 }
43 
44 //------------------------------------------------------------------------------
45 
46 void ActivitySeries::cachedDeepCopy(const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache)
47 {
48  ActivitySeries::csptr other = ActivitySeries::dynamicConstCast(_source);
49  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
50  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
51  + " to " + this->getClassname()), !bool(other) );
52 
53  this->::fwMedData::Series::cachedDeepCopy(_source, cache);
54 
55  m_activityConfigId = other->m_activityConfigId;
56  m_data = ::fwData::Object::copy(other->m_data, cache);
57 }
58 
59 //------------------------------------------------------------------------------
60 
61 } // namespace fwMedData
62 
Namespace containing medical data.
virtual FWMEDDATA_API ~ActivitySeries()
Destructor.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
ConfigIdType m_activityConfigId
Activity configuration identifier.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
FWMEDDATA_API ActivitySeries(::fwData::Object::Key key)
Constructor.
static FWDATA_API::fwData::Object::sptr copy(const ::fwData::Object::csptr &source)
return a copy of the source. if source is a null pointer, return a null pointer.
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
Contains the representation of the data objects used in the framework.
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
std::shared_ptr< ::fwData::Composite > m_data
... container