fw4spl
include/fwData/Node.hpp
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 #ifndef __FWDATA_NODE_HPP__
8 #define __FWDATA_NODE_HPP__
9 
10 #include "fwData/config.hpp"
11 #include "fwData/factory/new.hpp"
12 #include "fwData/Object.hpp"
13 #include "fwData/Port.hpp"
14 
15 #include <vector>
16 
17 fwCampAutoDeclareDataMacro((fwData)(Node), FWDATA_API);
18 
19 namespace fwData
20 {
21 
26 class FWDATA_CLASS_API Node : public ::fwData::Object
27 {
28 public:
29 
30  fwCoreClassDefinitionsWithFactoryMacro( (Node)(::fwData::Object), (()), ::fwData::factory::New< Node >);
31  fwCampMakeFriendDataMacro((fwData)(Node));
32 
34  typedef std::vector< ::fwData::Port::sptr > PortContainer;
35 
37  typedef ::fwCom::Signal< void () > UpdatedSignalType;
38 
43  FWDATA_API Node(::fwData::Object::Key key);
44 
46  FWDATA_API virtual ~Node();
47 
49  FWDATA_API void addInputPort(const ::fwData::Port::sptr& port);
50 
52  FWDATA_API void addOutputPort(const ::fwData::Port::sptr& port);
53 
55  FWDATA_API PortContainer& getInputPorts();
56 
58  FWDATA_API PortContainer& getOutputPorts();
59 
61  FWDATA_API void setObject(const ::fwData::Object::sptr& object );
62 
64  FWDATA_API ::fwData::Object::sptr getObject() const;
65 
74  FWDATA_API Port::sptr findPort(const std::string& _identifier, bool _modeInput) const;
75 
77  FWDATA_API void shallowCopy( const Object::csptr& _source ) override;
78 
80  FWDATA_API void cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType& cache) override;
81 
83  FWDATA_API static const ::fwCom::Signals::SignalKeyType s_UPDATED_SIG;
84 
85 protected:
86 
88  ::fwData::Object::sptr m_object;
89 
91  PortContainer m_inputs;
92 
94  PortContainer m_outputs;
95 
97  UpdatedSignalType::sptr m_sigUpdated;
98 };
99 
100 } // namespace fwData
101 
102 #endif // __FWDATA_NODE_HPP__
103 
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
This class defines a node. A node is represented by input and output ports.
std::vector< ::fwData::Port::sptr > PortContainer
Port container.
::fwData::Object::sptr m_object
node object
::fwCom::Signal< void() > UpdatedSignalType
Type of &#39;updated&#39; signal.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_UPDATED_SIG
Updated signal key.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
PortContainer m_outputs
Output port container.
Base class for each data object.
UpdatedSignalType::sptr m_sigUpdated
Updated signal.
Contains the representation of the data objects used in the framework.
PortContainer m_inputs
Input port container.