YARP
Yet Another Robot Platform
GoalStatusArray.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/GoalStatusArray" msg definition:
9 // # Stores the statuses for goals that are currently being tracked
10 // # by an action server
11 // Header header
12 // GoalStatus[] status_list
13 //
14 // Instances of this class can be read and written with YARP ports,
15 // using a ROS-compatible format.
16 
17 #ifndef YARP_ROSMSG_actionlib_msgs_GoalStatusArray_h
18 #define YARP_ROSMSG_actionlib_msgs_GoalStatusArray_h
19 
20 #include <yarp/os/Wire.h>
21 #include <yarp/os/Type.h>
22 #include <yarp/os/idl/WireTypes.h>
23 #include <string>
24 #include <vector>
27 
28 namespace yarp {
29 namespace rosmsg {
30 namespace actionlib_msgs {
31 
33 {
34 public:
36  std::vector<yarp::rosmsg::actionlib_msgs::GoalStatus> status_list;
37 
39  header(),
40  status_list()
41  {
42  }
43 
44  void clear()
45  {
46  // *** header ***
47  header.clear();
48 
49  // *** status_list ***
50  status_list.clear();
51  }
52 
53  bool readBare(yarp::os::ConnectionReader& connection) override
54  {
55  // *** header ***
56  if (!header.read(connection)) {
57  return false;
58  }
59 
60  // *** status_list ***
61  int len = connection.expectInt32();
62  status_list.resize(len);
63  for (int i=0; i<len; i++) {
64  if (!status_list[i].read(connection)) {
65  return false;
66  }
67  }
68 
69  return !connection.isError();
70  }
71 
72  bool readBottle(yarp::os::ConnectionReader& connection) override
73  {
74  connection.convertTextMode();
75  yarp::os::idl::WireReader reader(connection);
76  if (!reader.readListHeader(2)) {
77  return false;
78  }
79 
80  // *** header ***
81  if (!header.read(connection)) {
82  return false;
83  }
84 
85  // *** status_list ***
86  if (connection.expectInt32() != BOTTLE_TAG_LIST) {
87  return false;
88  }
89  int len = connection.expectInt32();
90  status_list.resize(len);
91  for (int i=0; i<len; i++) {
92  if (!status_list[i].read(connection)) {
93  return false;
94  }
95  }
96 
97  return !connection.isError();
98  }
99 
101  bool read(yarp::os::ConnectionReader& connection) override
102  {
103  return (connection.isBareMode() ? readBare(connection)
104  : readBottle(connection));
105  }
106 
107  bool writeBare(yarp::os::ConnectionWriter& connection) const override
108  {
109  // *** header ***
110  if (!header.write(connection)) {
111  return false;
112  }
113 
114  // *** status_list ***
115  connection.appendInt32(status_list.size());
116  for (size_t i=0; i<status_list.size(); i++) {
117  if (!status_list[i].write(connection)) {
118  return false;
119  }
120  }
121 
122  return !connection.isError();
123  }
124 
125  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
126  {
127  connection.appendInt32(BOTTLE_TAG_LIST);
128  connection.appendInt32(2);
129 
130  // *** header ***
131  if (!header.write(connection)) {
132  return false;
133  }
134 
135  // *** status_list ***
136  connection.appendInt32(BOTTLE_TAG_LIST);
137  connection.appendInt32(status_list.size());
138  for (size_t i=0; i<status_list.size(); i++) {
139  if (!status_list[i].write(connection)) {
140  return false;
141  }
142  }
143 
144  connection.convertTextMode();
145  return !connection.isError();
146  }
147 
149  bool write(yarp::os::ConnectionWriter& connection) const override
150  {
151  return (connection.isBareMode() ? writeBare(connection)
152  : writeBottle(connection));
153  }
154 
155  // This class will serialize ROS style or YARP style depending on protocol.
156  // If you need to force a serialization style, use one of these classes:
159 
160  // The name for this message, ROS will need this
161  static constexpr const char* typeName = "actionlib_msgs/GoalStatusArray";
162 
163  // The checksum for this message, ROS will need this
164  static constexpr const char* typeChecksum = "8b2b82f13216d0a8ea88bd3af735e619";
165 
166  // The source text for this message, ROS will need this
167  static constexpr const char* typeText = "\
168 # Stores the statuses for goals that are currently being tracked\n\
169 # by an action server\n\
170 Header header\n\
171 GoalStatus[] status_list\n\
172 \n\
173 \n\
174 ================================================================================\n\
175 MSG: std_msgs/Header\n\
176 # Standard metadata for higher-level stamped data types.\n\
177 # This is generally used to communicate timestamped data \n\
178 # in a particular coordinate frame.\n\
179 # \n\
180 # sequence ID: consecutively increasing ID \n\
181 uint32 seq\n\
182 #Two-integer timestamp that is expressed as:\n\
183 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
184 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
185 # time-handling sugar is provided by the client library\n\
186 time stamp\n\
187 #Frame this data is associated with\n\
188 # 0: no frame\n\
189 # 1: global frame\n\
190 string frame_id\n\
191 \n\
192 ================================================================================\n\
193 MSG: actionlib_msgs/GoalStatus\n\
194 GoalID goal_id\n\
195 uint8 status\n\
196 uint8 PENDING = 0 # The goal has yet to be processed by the action server\n\
197 uint8 ACTIVE = 1 # The goal is currently being processed by the action server\n\
198 uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing\n\
199  # and has since completed its execution (Terminal State)\n\
200 uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)\n\
201 uint8 ABORTED = 4 # The goal was aborted during execution by the action server due\n\
202  # to some failure (Terminal State)\n\
203 uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,\n\
204  # because the goal was unattainable or invalid (Terminal State)\n\
205 uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing\n\
206  # and has not yet completed execution\n\
207 uint8 RECALLING = 7 # The goal received a cancel request before it started executing,\n\
208  # but the action server has not yet confirmed that the goal is canceled\n\
209 uint8 RECALLED = 8 # The goal received a cancel request before it started executing\n\
210  # and was successfully cancelled (Terminal State)\n\
211 uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be\n\
212  # sent over the wire by an action server\n\
213 \n\
214 #Allow for the user to associate a string with GoalStatus for debugging\n\
215 string text\n\
216 \n\
217 \n\
218 ================================================================================\n\
219 MSG: actionlib_msgs/GoalID\n\
220 # The stamp should store the time at which this goal was requested.\n\
221 # It is used by an action server when it tries to preempt all\n\
222 # goals that were requested before a certain time\n\
223 time stamp\n\
224 \n\
225 # The id provides a way to associate feedback and\n\
226 # result message with specific goal requests. The id\n\
227 # specified must be unique.\n\
228 string id\n\
229 \n\
230 ";
231 
232  yarp::os::Type getType() const override
233  {
235  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
236  typ.addProperty("message_definition", yarp::os::Value(typeText));
237  return typ;
238  }
239 };
240 
241 } // namespace actionlib_msgs
242 } // namespace rosmsg
243 } // namespace yarp
244 
245 #endif // YARP_ROSMSG_actionlib_msgs_GoalStatusArray_h
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a 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
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 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 writeBottle(yarp::os::ConnectionWriter &connection) const override
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::rosmsg::std_msgs::Header header
bool writeBare(yarp::os::ConnectionWriter &connection) const override
yarp::os::Type getType() const override
yarp::os::idl::BareStyle< yarp::rosmsg::actionlib_msgs::GoalStatusArray > rosStyle
bool readBare(yarp::os::ConnectionReader &connection) override
static constexpr const char * typeChecksum
std::vector< yarp::rosmsg::actionlib_msgs::GoalStatus > status_list
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::os::idl::BottleStyle< yarp::rosmsg::actionlib_msgs::GoalStatusArray > bottleStyle
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:159
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:112
The main, catch-all namespace for YARP.
Definition: dirs.h:16