fw4spl
src/fwData/Integer.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 "fwData/Integer.hpp"
8 
9 #include "fwData/Exception.hpp"
10 #include "fwData/GenericField.hpp"
11 #include "fwData/registry/macros.hpp"
12 
13 fwDataRegisterMacro( ::fwData::Integer );
14 
15 namespace fwData
16 {
17 //------------------------------------------------------------------------------
18 
20 {
21 }
22 
23 //------------------------------------------------------------------------------
24 
26 {
27 }
28 
29 //------------------------------------------------------------------------------
30 
31 void Integer::shallowCopy(const Object::csptr& _source )
32 {
33  Integer::csptr other = Integer::dynamicConstCast(_source);
34  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
35  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
36  + " to " + this->getClassname()), !bool(other) );
37  this->fieldShallowCopy( _source );
38  m_value = other->m_value;
39 }
40 
41 //------------------------------------------------------------------------------
42 
43 void Integer::cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType& cache)
44 {
45  Integer::csptr other = Integer::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->fieldDeepCopy( _source, cache );
50  m_value = other->m_value;
51 }
52 
53 } // namespace fwData
This class contains an integer value. Integer object is essentially used as a field in other objects...
Definition: Integer.hpp:24
FWDATA_API Integer(::fwData::Object::Key key) noexcept
Constructor.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
virtual FWDATA_API ~Integer() noexcept
Destructor.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
Definition: Integer.hpp:28
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
FWDATA_API void cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
FWDATA_API void shallowCopy(const Object::csptr &_source) override
Defines shallow 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)