YARP
Yet Another Robot Platform
GoalStatus.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 // This is an automatically generated file.
7 
8 // Generated from the following "actionlib_msgs/GoalStatus" msg definition:
9 // GoalID goal_id
10 // uint8 status
11 // uint8 PENDING = 0 # The goal has yet to be processed by the action server
12 // uint8 ACTIVE = 1 # The goal is currently being processed by the action server
13 // uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing
14 // # and has since completed its execution (Terminal State)
15 // uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)
16 // uint8 ABORTED = 4 # The goal was aborted during execution by the action server due
17 // # to some failure (Terminal State)
18 // uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,
19 // # because the goal was unattainable or invalid (Terminal State)
20 // uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing
21 // # and has not yet completed execution
22 // uint8 RECALLING = 7 # The goal received a cancel request before it started executing,
23 // # but the action server has not yet confirmed that the goal is canceled
24 // uint8 RECALLED = 8 # The goal received a cancel request before it started executing
25 // # and was successfully cancelled (Terminal State)
26 // uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be
27 // # sent over the wire by an action server
28 //
29 // #Allow for the user to associate a string with GoalStatus for debugging
30 // string text
31 //
32 // Instances of this class can be read and written with YARP ports,
33 // using a ROS-compatible format.
34 
35 #ifndef YARP_ROSMSG_actionlib_msgs_GoalStatus_h
36 #define YARP_ROSMSG_actionlib_msgs_GoalStatus_h
37 
38 #include <yarp/os/Wire.h>
39 #include <yarp/os/Type.h>
40 #include <yarp/os/idl/WireTypes.h>
41 #include <string>
42 #include <vector>
44 
45 namespace yarp {
46 namespace rosmsg {
47 namespace actionlib_msgs {
48 
50 {
51 public:
53  std::uint8_t status;
54  static const std::uint8_t PENDING = 0;
55  static const std::uint8_t ACTIVE = 1;
56  static const std::uint8_t PREEMPTED = 2;
57  static const std::uint8_t SUCCEEDED = 3;
58  static const std::uint8_t ABORTED = 4;
59  static const std::uint8_t REJECTED = 5;
60  static const std::uint8_t PREEMPTING = 6;
61  static const std::uint8_t RECALLING = 7;
62  static const std::uint8_t RECALLED = 8;
63  static const std::uint8_t LOST = 9;
64  std::string text;
65 
67  goal_id(),
68  status(0),
69  text("")
70  {
71  }
72 
73  void clear()
74  {
75  // *** goal_id ***
76  goal_id.clear();
77 
78  // *** status ***
79  status = 0;
80 
81  // *** PENDING ***
82 
83  // *** ACTIVE ***
84 
85  // *** PREEMPTED ***
86 
87  // *** SUCCEEDED ***
88 
89  // *** ABORTED ***
90 
91  // *** REJECTED ***
92 
93  // *** PREEMPTING ***
94 
95  // *** RECALLING ***
96 
97  // *** RECALLED ***
98 
99  // *** LOST ***
100 
101  // *** text ***
102  text = "";
103  }
104 
105  bool readBare(yarp::os::ConnectionReader& connection) override
106  {
107  // *** goal_id ***
108  if (!goal_id.read(connection)) {
109  return false;
110  }
111 
112  // *** status ***
113  status = connection.expectInt8();
114 
115  // *** text ***
116  int len = connection.expectInt32();
117  text.resize(len);
118  if (!connection.expectBlock((char*)text.c_str(), len)) {
119  return false;
120  }
121 
122  return !connection.isError();
123  }
124 
125  bool readBottle(yarp::os::ConnectionReader& connection) override
126  {
127  connection.convertTextMode();
128  yarp::os::idl::WireReader reader(connection);
129  if (!reader.readListHeader(13)) {
130  return false;
131  }
132 
133  // *** goal_id ***
134  if (!goal_id.read(connection)) {
135  return false;
136  }
137 
138  // *** status ***
139  status = reader.expectInt8();
140 
141  // *** text ***
142  if (!reader.readString(text)) {
143  return false;
144  }
145 
146  return !connection.isError();
147  }
148 
150  bool read(yarp::os::ConnectionReader& connection) override
151  {
152  return (connection.isBareMode() ? readBare(connection)
153  : readBottle(connection));
154  }
155 
156  bool writeBare(yarp::os::ConnectionWriter& connection) const override
157  {
158  // *** goal_id ***
159  if (!goal_id.write(connection)) {
160  return false;
161  }
162 
163  // *** status ***
164  connection.appendInt8(status);
165 
166  // *** text ***
167  connection.appendInt32(text.length());
168  connection.appendExternalBlock((char*)text.c_str(), text.length());
169 
170  return !connection.isError();
171  }
172 
173  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
174  {
175  connection.appendInt32(BOTTLE_TAG_LIST);
176  connection.appendInt32(13);
177 
178  // *** goal_id ***
179  if (!goal_id.write(connection)) {
180  return false;
181  }
182 
183  // *** status ***
184  connection.appendInt32(BOTTLE_TAG_INT8);
185  connection.appendInt8(status);
186 
187  // *** text ***
188  connection.appendInt32(BOTTLE_TAG_STRING);
189  connection.appendInt32(text.length());
190  connection.appendExternalBlock((char*)text.c_str(), text.length());
191 
192  connection.convertTextMode();
193  return !connection.isError();
194  }
195 
197  bool write(yarp::os::ConnectionWriter& connection) const override
198  {
199  return (connection.isBareMode() ? writeBare(connection)
200  : writeBottle(connection));
201  }
202 
203  // This class will serialize ROS style or YARP style depending on protocol.
204  // If you need to force a serialization style, use one of these classes:
207 
208  // The name for this message, ROS will need this
209  static constexpr const char* typeName = "actionlib_msgs/GoalStatus";
210 
211  // The checksum for this message, ROS will need this
212  static constexpr const char* typeChecksum = "d388f9b87b3c471f784434d671988d4a";
213 
214  // The source text for this message, ROS will need this
215  static constexpr const char* typeText = "\
216 GoalID goal_id\n\
217 uint8 status\n\
218 uint8 PENDING = 0 # The goal has yet to be processed by the action server\n\
219 uint8 ACTIVE = 1 # The goal is currently being processed by the action server\n\
220 uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing\n\
221  # and has since completed its execution (Terminal State)\n\
222 uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)\n\
223 uint8 ABORTED = 4 # The goal was aborted during execution by the action server due\n\
224  # to some failure (Terminal State)\n\
225 uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,\n\
226  # because the goal was unattainable or invalid (Terminal State)\n\
227 uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing\n\
228  # and has not yet completed execution\n\
229 uint8 RECALLING = 7 # The goal received a cancel request before it started executing,\n\
230  # but the action server has not yet confirmed that the goal is canceled\n\
231 uint8 RECALLED = 8 # The goal received a cancel request before it started executing\n\
232  # and was successfully cancelled (Terminal State)\n\
233 uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be\n\
234  # sent over the wire by an action server\n\
235 \n\
236 #Allow for the user to associate a string with GoalStatus for debugging\n\
237 string text\n\
238 \n\
239 \n\
240 ================================================================================\n\
241 MSG: actionlib_msgs/GoalID\n\
242 # The stamp should store the time at which this goal was requested.\n\
243 # It is used by an action server when it tries to preempt all\n\
244 # goals that were requested before a certain time\n\
245 time stamp\n\
246 \n\
247 # The id provides a way to associate feedback and\n\
248 # result message with specific goal requests. The id\n\
249 # specified must be unique.\n\
250 string id\n\
251 \n\
252 ";
253 
254  yarp::os::Type getType() const override
255  {
257  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
258  typ.addProperty("message_definition", yarp::os::Value(typeText));
259  return typ;
260  }
261 };
262 
263 } // namespace actionlib_msgs
264 } // namespace rosmsg
265 } // namespace yarp
266 
267 #endif // YARP_ROSMSG_actionlib_msgs_GoalStatus_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:19
#define BOTTLE_TAG_STRING
Definition: Bottle.h:26
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:30
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:382
std::int8_t expectInt8()
Definition: WireReader.h:80
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: GoalID.h:96
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: GoalID.h:136
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: GoalStatus.h:156
yarp::rosmsg::actionlib_msgs::GoalID goal_id
Definition: GoalStatus.h:52
static const std::uint8_t SUCCEEDED
Definition: GoalStatus.h:57
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: GoalStatus.h:173
static const std::uint8_t PENDING
Definition: GoalStatus.h:54
yarp::os::Type getType() const override
Definition: GoalStatus.h:254
yarp::os::idl::BareStyle< yarp::rosmsg::actionlib_msgs::GoalStatus > rosStyle
Definition: GoalStatus.h:205
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: GoalStatus.h:150
static const std::uint8_t PREEMPTING
Definition: GoalStatus.h:60
static const std::uint8_t RECALLING
Definition: GoalStatus.h:61
static const std::uint8_t LOST
Definition: GoalStatus.h:63
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: GoalStatus.h:197
static constexpr const char * typeText
Definition: GoalStatus.h:215
static const std::uint8_t ACTIVE
Definition: GoalStatus.h:55
static const std::uint8_t REJECTED
Definition: GoalStatus.h:59
yarp::os::idl::BottleStyle< yarp::rosmsg::actionlib_msgs::GoalStatus > bottleStyle
Definition: GoalStatus.h:206
static const std::uint8_t RECALLED
Definition: GoalStatus.h:62
static const std::uint8_t PREEMPTED
Definition: GoalStatus.h:56
static constexpr const char * typeName
Definition: GoalStatus.h:209
static const std::uint8_t ABORTED
Definition: GoalStatus.h:58
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: GoalStatus.h:125
static constexpr const char * typeChecksum
Definition: GoalStatus.h:212
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: GoalStatus.h:105
The main, catch-all namespace for YARP.
Definition: dirs.h:16