fw4spl
Port.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #pragma once
8 
9 #include "fwData/config.hpp"
10 #include "fwData/factory/new.hpp"
11 #include "fwData/Object.hpp"
12 
13 fwCampAutoDeclareDataMacro((fwData)(Port), FWDATA_API);
14 
15 namespace fwData
16 {
20 class FWDATA_CLASS_API Port : public ::fwData::Object
21 {
22 public:
23  fwCoreClassDefinitionsWithFactoryMacro( (Port)(::fwData::Object), (()), ::fwData::factory::New< Port >);
24 
29  FWDATA_API Port(::fwData::Object::Key key);
30 
32  FWDATA_API virtual ~Port();
33 
38  std::string& getIdentifier ();
39  const std::string& getIdentifier () const;
40  void setIdentifier (const std::string& _identifier);
42 
48  std::string& getType ();
49  const std::string& getType () const;
50  void setType (const std::string& _type);
52 
57  fwCampMakeFriendDataMacro((fwData)(Port));
59 
61  FWDATA_API void shallowCopy( const Object::csptr& _source ) override;
62 
64  FWDATA_API void cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType& cache) override;
65 
66 protected:
67 
69  std::string m_identifier; // example "ID_SIZEX", "THRESHOLD_LOW"
71  std::string m_type; // example "Image, Mesh" un className de data
72 };
73 
74 //-----------------------------------------------------------------------------
75 
76 inline std::string& Port::getIdentifier ()
77 {
78  return this->m_identifier;
79 }
80 
81 //-----------------------------------------------------------------------------
82 
83 inline const std::string& Port::getIdentifier () const
84 {
85  return this->m_identifier;
86 }
87 
88 //-----------------------------------------------------------------------------
89 
90 inline void Port::setIdentifier (const std::string& _identifier)
91 {
92  this->m_identifier = _identifier;
93 }
94 
95 //-----------------------------------------------------------------------------
96 
97 inline std::string& Port::getType ()
98 {
99  return this->m_type;
100 }
101 
102 //-----------------------------------------------------------------------------
103 
104 inline const std::string& Port::getType () const
105 {
106  return this->m_type;
107 }
108 
109 //-----------------------------------------------------------------------------
110 
111 inline void Port::setType (const std::string& _type)
112 {
113  this->m_type = _type;
114 }
115 
116 //-----------------------------------------------------------------------------
117 
118 } // namespace fwData
void setIdentifier(const std::string &_identifier)
Retrieve the identifier.
Definition: Port.hpp:90
std::string & getIdentifier()
Retrieve the identifier.
Definition: Port.hpp:76
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
std::string & getType()
Retrieve the type.
Definition: Port.hpp:97
std::string m_type
port type
Definition: Port.hpp:71
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
A port is defined by an identifier and a type.
Definition: Port.hpp:20
Base class for each data object.
void setType(const std::string &_type)
Retrieve the type.
Definition: Port.hpp:111
Contains the representation of the data objects used in the framework.
std::string m_identifier
port identifier
Definition: Port.hpp:69