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