YARP
Yet Another Robot Platform
data.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_MANAGER_DATA
10 #define YARP_MANAGER_DATA
11 
12 #include <yarp/manager/ymm-types.h>
13 #include <yarp/manager/node.h>
14 #include <yarp/manager/utility.h>
15 #include <yarp/conf/api.h>
16 
17 
18 namespace yarp {
19 namespace manager {
20 
21 
25 class InputData : public Node{
26 
27 public:
28  InputData();
29  InputData(const char* szName);
30  InputData(const InputData &input);
31  ~InputData() override;
32  Node* clone() override;
33  void setName(const char* szName) {
34  if(szName){
35  strName = szName;
36  }
37  }
38  const char* getName() { return strName.c_str(); }
39  void setPort(const char* szPort) { if(szPort) { strPort = szPort; } }
40  const char* getPort() { return strPort.c_str(); }
41  void setCarrier(const char* szCr) { if(szCr) { carrier = szCr; } }
42  const char* getCarrier() { return carrier.c_str(); }
43  void setPriority(bool prio) { bWithPriority = prio; }
44  void setRequired(bool req) { bRequired = req; }
45  bool isRequired() { return bRequired; }
46  bool withPriority() { return bWithPriority; }
47  void setDescription(const char* szDesc) { if(szDesc) { strDescription = szDesc; } }
48  const char* getDescription() { return strDescription.c_str(); }
49  void setPortType(NodeType type) { portType = type; }
50  NodeType getPortType() { return portType; }
51  void setOwner(Node* owner) { modOwner = owner; }
52  Node* owner() { return modOwner; }
53 
54  bool operator==(const InputData& input) const {
55  return (strName == input.strName);
56  }
57 
58 protected:
59 
60 private:
61  std::string strName;
62  std::string strPort;
63  std::string carrier;
64  std::string strDescription;
65  bool bWithPriority;
66  bool bRequired;
67  Node* modOwner;
68  NodeType portType;
69 };
70 
71 
72 class OutputData : public Node{
73 
74 public:
75  OutputData();
76  OutputData(const char* szName);
77  OutputData(const OutputData &input);
78  ~OutputData() override;
79  Node* clone() override;
80  void setName(const char* szName) {
81  if(szName){
82  strName = szName;
83  }
84  }
85  const char* getName() { return strName.c_str(); }
86  void setPort(const char* szPort) { if(szPort) { strPort = szPort; } }
87  const char* getPort() { return strPort.c_str(); }
88  void setCarrier(const char* szCr) { if(szCr) { carrier = szCr; } }
89  const char* getCarrier() { return carrier.c_str(); }
90  void setDescription(const char* szDesc) { if(szDesc) { strDescription = szDesc; } }
91  const char* getDescription() { return strDescription.c_str(); }
92  void setPortType(NodeType type) { portType = type; }
93  NodeType getPortType() { return portType; }
94 
95  void setOwner(Node* owner) { modOwner = owner; }
96  Node* owner() { return modOwner; }
97 
98 
99  bool operator==(const OutputData& output) const {
100  return (strName == output.strName);
101  }
102 
103 protected:
104 
105 private:
106  std::string strName;
107  std::string strPort;
108  std::string carrier;
109  std::string strDescription;
110  Node* modOwner;
111  NodeType portType;
112 };
113 
114 } // namespace yarp
115 } // namespace manager
116 
117 
118 #endif // __YARP_MANAGER_MODULE__
yarp::manager::OutputData::owner
Node * owner()
Definition: data.h:96
yarp::manager::OutputData::setPort
void setPort(const char *szPort)
Definition: data.h:86
yarp::manager::OutputData::OutputData
OutputData()
Class OutputData.
Definition: data.cpp:61
yarp::manager::InputData::getPortType
NodeType getPortType()
Definition: data.h:50
yarp::manager::InputData::getPort
const char * getPort()
Definition: data.h:40
yarp::manager::OutputData::setCarrier
void setCarrier(const char *szCr)
Definition: data.h:88
yarp::manager::OutputData::operator==
bool operator==(const OutputData &output) const
Definition: data.h:99
yarp::manager::OutputData::setPortType
void setPortType(NodeType type)
Definition: data.h:92
utility.h
yarp::manager::InputData::owner
Node * owner()
Definition: data.h:52
yarp::manager::OutputData::getPort
const char * getPort()
Definition: data.h:87
yarp::manager::InputData::getDescription
const char * getDescription()
Definition: data.h:48
yarp::manager::InputData::operator==
bool operator==(const InputData &input) const
Definition: data.h:54
yarp::manager::InputData::setPriority
void setPriority(bool prio)
Definition: data.h:43
yarp::manager::OutputData::clone
Node * clone() override
Definition: data.cpp:90
yarp::manager::OutputData
Definition: data.h:72
yarp::manager::InputData::InputData
InputData()
Class InputData.
Definition: data.cpp:16
node.h
yarp::manager::Node
a Node of a Graph
Definition: node.h:68
yarp::manager::InputData::setPort
void setPort(const char *szPort)
Definition: data.h:39
ymm-types.h
yarp::manager::InputData::isRequired
bool isRequired()
Definition: data.h:45
yarp::manager::OutputData::setOwner
void setOwner(Node *owner)
Definition: data.h:95
yarp::manager::InputData::clone
Node * clone() override
Definition: data.cpp:49
yarp::manager::InputData::~InputData
~InputData() override
yarp::manager::OutputData::getCarrier
const char * getCarrier()
Definition: data.h:89
yarp::manager::InputData::setPortType
void setPortType(NodeType type)
Definition: data.h:49
yarp::manager::InputData::setOwner
void setOwner(Node *owner)
Definition: data.h:51
yarp::manager::InputData::withPriority
bool withPriority()
Definition: data.h:46
yarp::manager::InputData::getCarrier
const char * getCarrier()
Definition: data.h:42
yarp::manager::InputData::setDescription
void setDescription(const char *szDesc)
Definition: data.h:47
yarp::manager::InputData::getName
const char * getName()
Definition: data.h:38
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::manager::OutputData::~OutputData
~OutputData() override
yarp::manager::OutputData::setName
void setName(const char *szName)
Definition: data.h:80
yarp::manager::InputData::setRequired
void setRequired(bool req)
Definition: data.h:44
yarp::manager::InputData::setName
void setName(const char *szName)
Definition: data.h:33
yarp::manager::OutputData::getDescription
const char * getDescription()
Definition: data.h:91
yarp::manager::OutputData::getPortType
NodeType getPortType()
Definition: data.h:93
api.h
yarp::manager::InputData::setCarrier
void setCarrier(const char *szCr)
Definition: data.h:41
yarp::manager::InputData
Class InputData.
Definition: data.h:25
yarp::manager::NodeType
enum yarp::manager::__NodeType NodeType
yarp::manager::OutputData::getName
const char * getName()
Definition: data.h:85
yarp::manager::OutputData::setDescription
void setDescription(const char *szDesc)
Definition: data.h:90