fw4spl
src/fwData/ResectionDB.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
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 "fwData/registry/macros.hpp"
8 #include "fwData/Exception.hpp"
9 #include "fwData/ResectionDB.hpp"
10 
11 #include <fwCom/Signal.hpp>
12 #include <fwCom/Signal.hxx>
13 
14 #include <fwCore/base.hpp>
15 
16 fwDataRegisterMacro( ::fwData::ResectionDB );
17 
18 namespace fwData
19 {
20 
21 const ::fwCom::Signals::SignalKeyType ResectionDB::s_RESECTION_ADDED_SIG = "resectionAdded";
22 const ::fwCom::Signals::SignalKeyType ResectionDB::s_SAFE_PART_ADDED_SIG = "safePartAdded";
23 
24 //------------------------------------------------------------------------------
25 
27 {
28  m_sigResectionAdded = ResectionAddedSignalType::New();
29  m_sigSafePartAdded = SafePartAddedSignalType::New();
30 
31  m_signals( s_RESECTION_ADDED_SIG, m_sigResectionAdded)
32  ( s_SAFE_PART_ADDED_SIG, m_sigSafePartAdded);
33 }
34 
35 //------------------------------------------------------------------------------
36 
38 {
39 }
40 
41 //------------------------------------------------------------------------------
42 
43 void ResectionDB::shallowCopy(const Object::csptr &_source )
44 {
45  ResectionDB::csptr other = ResectionDB::dynamicConstCast(_source);
46  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
47  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
48  + " to " + this->getClassname()), !bool(other) );
49  this->fieldShallowCopy( _source );
50 }
51 
52 //------------------------------------------------------------------------------
53 
54 void ResectionDB::cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache)
55 {
56  ResectionDB::csptr other = ResectionDB::dynamicConstCast(_source);
57  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
58  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
59  + " to " + this->getClassname()), !bool(other) );
60  this->fieldDeepCopy( _source, cache );
61 }
62 
63 //------------------------------------------------------------------------------
64 
65 ResectionDB::ResectionContainerType::size_type ResectionDB::getNumberOfResections() const
66 {
67  return m_resections.size();
68 }
69 
70 //------------------------------------------------------------------------------
71 
72 void ResectionDB::addResection(const ::fwData::Resection::sptr& resection )
73 {
74  m_resections.push_back( resection );
75 }
76 
77 //------------------------------------------------------------------------------
78 
79 } // end namespace fwData
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SAFE_PART_ADDED_SIG
Key in m_signals map of signal m_sigSafePartAdded.
FWDATA_API ResectionContainerType::size_type getNumberOfResections() const
Get the number of resections.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_RESECTION_ADDED_SIG
Key in m_signals map of signal m_sigResectionAdded.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
virtual FWDATA_API ~ResectionDB()
Destructor.
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
FWDATA_API ResectionDB(::fwData::Object::Key key)
Constructor.
FWDATA_API void addResection(const ::fwData::Resection::sptr &resection)
add resection
This class defines a resection container.
FWDATA_API void shallowCopy(const Object::csptr &_source) override
Defines shallow copy.
FWDATA_API void cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
Contains the representation of the data objects used in the framework.
FWDATA_API void fieldShallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)