fw4spl
core/fwMedData/src/fwMedData/Patient.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 "fwMedData/Patient.hpp"
8 
9 #include <fwData/Exception.hpp>
10 #include <fwData/registry/macros.hpp>
11 
12 fwDataRegisterMacro( ::fwMedData::Patient );
13 
14 namespace fwMedData
15 {
16 
18 {
19 }
20 
21 //------------------------------------------------------------------------------
22 
24 {
25 }
26 
27 //------------------------------------------------------------------------------
28 
29 void Patient::shallowCopy(const ::fwData::Object::csptr &_source)
30 {
31  Patient::csptr other = Patient::dynamicConstCast(_source);
32  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
33  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
34  + " to " + this->getClassname()), !bool(other) );
35 
36  this->fieldShallowCopy( other );
37  m_name = other->m_name;
38  m_birthdate = other->m_birthdate;
39  m_patientId = other->m_patientId;
40  m_sex = other->m_sex;
41 }
42 
43 //------------------------------------------------------------------------------
44 
45 void Patient::cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache)
46 {
47  Patient::csptr other = Patient::dynamicConstCast(_source);
48  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
49  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
50  + " to " + this->getClassname()), !bool(other) );
51 
52  this->fieldDeepCopy( other, cache );
53  m_name = other->m_name;
54  m_birthdate = other->m_birthdate;
55  m_patientId = other->m_patientId;
56  m_sex = other->m_sex;
57 }
58 
59 //------------------------------------------------------------------------------
60 
61 } // namespace fwMedData
62 
DicomValueType m_patientId
Primary hospital identification.
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
Namespace containing medical data.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
virtual FWMEDDATA_API ~Patient()
Destructor.
Implements data exception class.
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
DicomValueType m_sex
Patient&#39;s sex.
FWMEDDATA_API Patient(::fwData::Object::Key key)
Constructor.
FWDATA_API void fieldShallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.