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