fw4spl
src/fwData/ROITraits.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/ROITraits.hpp"
10 
11 #include <fwCore/base.hpp>
12 
13 fwDataRegisterMacro( ::fwData::ROITraits );
14 
15 namespace fwData
16 {
17 
18 //------------------------------------------------------------------------------
19 
21 {
22 }
23 
24 //------------------------------------------------------------------------------
25 
27 {
28 }
29 
30 //------------------------------------------------------------------------------
31 
32 void ROITraits::setMaskOpNode(const ::fwData::Node::sptr& maskOpNode )
33 {
34  m_maskOpNode = maskOpNode;
35 }
36 
37 //------------------------------------------------------------------------------
38 
39 ::fwData::Node::sptr ROITraits::getMaskOpNode()
40 {
41  ::fwData::Node::sptr opNode;
42  if ( m_evaluatedExp != "W" ) // Thus mask op node must be assigned
43  {
44  opNode = m_maskOpNode;
45  }
46  return opNode;
47 }
48 
49 //------------------------------------------------------------------------------
50 
51 void ROITraits::setStructureTraits(const ::fwData::StructureTraits::sptr& structureTraits )
52 {
53  m_structureTraits = structureTraits;
54 }
55 
56 //------------------------------------------------------------------------------
57 
58 ::fwData::StructureTraits::sptr ROITraits::getStructureTraits()
59 {
60  return m_structureTraits;
61 }
62 
63 //------------------------------------------------------------------------------
64 
65 void ROITraits::cachedDeepCopy(const Object::csptr &source, DeepCopyCacheType &cache)
66 {
67  ROITraits::csptr other = ROITraits::dynamicConstCast(source);
68  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
69  "Unable to copy" + (source ? source->getClassname() : std::string("<NULL>"))
70  + " to " + this->getClassname()), !bool(other) );
71  this->fieldDeepCopy( source, cache );
72 
73  OSLM_FATAL("Not implemented." );
74 }
75 
76 } // namespace fwData
77 
78 
FWDATA_API::fwData::Node::sptr getMaskOpNode()
Get the ROI mask node used for ROI, the only case where sptr can be null is when m_evaluatedExp corre...
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
FWDATA_API void cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
virtual FWDATA_API ~ROITraits()
destructor
FWDATA_API::fwData::StructureTraits::sptr getStructureTraits()
Get the associated structure traits.
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
FWDATA_API void setMaskOpNode(const ::fwData::Node::sptr &maskOpNode)
Set the ROI mask node used for ROI.
FWDATA_API ROITraits(::fwData::Object::Key key)
Constructor.
#define OSLM_FATAL(message)
Definition: spyLog.hpp:285
FWDATA_API void setStructureTraits(const ::fwData::StructureTraits::sptr &structureTraits)
Set the associated structure traits.
Contains the representation of the data objects used in the framework.
This class defines ROI traits.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject