YARP
Yet Another Robot Platform
GoalID.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/GoalID" msg definition:
12 // # The stamp should store the time at which this goal was requested.
13 // # It is used by an action server when it tries to preempt all
14 // # goals that were requested before a certain time
15 // time stamp
16 //
17 // # The id provides a way to associate feedback and
18 // # result message with specific goal requests. The id
19 // # specified must be unique.
20 // string id
21 //
22 // Instances of this class can be read and written with YARP ports,
23 // using a ROS-compatible format.
24 
25 #ifndef YARP_ROSMSG_actionlib_msgs_GoalID_h
26 #define YARP_ROSMSG_actionlib_msgs_GoalID_h
27 
28 #include <yarp/os/Wire.h>
29 #include <yarp/os/Type.h>
30 #include <yarp/os/idl/WireTypes.h>
31 #include <string>
32 #include <vector>
33 #include <yarp/rosmsg/TickTime.h>
34 
35 namespace yarp {
36 namespace rosmsg {
37 namespace actionlib_msgs {
38 
40 {
41 public:
43  std::string id;
44 
45  GoalID() :
46  stamp(),
47  id("")
48  {
49  }
50 
51  void clear()
52  {
53  // *** stamp ***
54  stamp.clear();
55 
56  // *** id ***
57  id = "";
58  }
59 
60  bool readBare(yarp::os::ConnectionReader& connection) override
61  {
62  // *** stamp ***
63  if (!stamp.read(connection)) {
64  return false;
65  }
66 
67  // *** id ***
68  int len = connection.expectInt32();
69  id.resize(len);
70  if (!connection.expectBlock((char*)id.c_str(), len)) {
71  return false;
72  }
73 
74  return !connection.isError();
75  }
76 
77  bool readBottle(yarp::os::ConnectionReader& connection) override
78  {
79  connection.convertTextMode();
80  yarp::os::idl::WireReader reader(connection);
81  if (!reader.readListHeader(2)) {
82  return false;
83  }
84 
85  // *** stamp ***
86  if (!stamp.read(connection)) {
87  return false;
88  }
89 
90  // *** id ***
91  if (!reader.readString(id)) {
92  return false;
93  }
94 
95  return !connection.isError();
96  }
97 
99  bool read(yarp::os::ConnectionReader& connection) override
100  {
101  return (connection.isBareMode() ? readBare(connection)
102  : readBottle(connection));
103  }
104 
105  bool writeBare(yarp::os::ConnectionWriter& connection) const override
106  {
107  // *** stamp ***
108  if (!stamp.write(connection)) {
109  return false;
110  }
111 
112  // *** id ***
113  connection.appendInt32(id.length());
114  connection.appendExternalBlock((char*)id.c_str(), id.length());
115 
116  return !connection.isError();
117  }
118 
119  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
120  {
121  connection.appendInt32(BOTTLE_TAG_LIST);
122  connection.appendInt32(2);
123 
124  // *** stamp ***
125  if (!stamp.write(connection)) {
126  return false;
127  }
128 
129  // *** id ***
130  connection.appendInt32(BOTTLE_TAG_STRING);
131  connection.appendInt32(id.length());
132  connection.appendExternalBlock((char*)id.c_str(), id.length());
133 
134  connection.convertTextMode();
135  return !connection.isError();
136  }
137 
139  bool write(yarp::os::ConnectionWriter& connection) const override
140  {
141  return (connection.isBareMode() ? writeBare(connection)
142  : writeBottle(connection));
143  }
144 
145  // This class will serialize ROS style or YARP style depending on protocol.
146  // If you need to force a serialization style, use one of these classes:
149 
150  // The name for this message, ROS will need this
151  static constexpr const char* typeName = "actionlib_msgs/GoalID";
152 
153  // The checksum for this message, ROS will need this
154  static constexpr const char* typeChecksum = "302881f31927c1df708a2dbab0e80ee8";
155 
156  // The source text for this message, ROS will need this
157  static constexpr const char* typeText = "\
158 # The stamp should store the time at which this goal was requested.\n\
159 # It is used by an action server when it tries to preempt all\n\
160 # goals that were requested before a certain time\n\
161 time stamp\n\
162 \n\
163 # The id provides a way to associate feedback and\n\
164 # result message with specific goal requests. The id\n\
165 # specified must be unique.\n\
166 string id\n\
167 \n\
168 ";
169 
170  yarp::os::Type getType() const override
171  {
173  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
174  typ.addProperty("message_definition", yarp::os::Value(typeText));
175  return typ;
176  }
177 };
178 
179 } // namespace actionlib_msgs
180 } // namespace rosmsg
181 } // namespace yarp
182 
183 #endif // YARP_ROSMSG_actionlib_msgs_GoalID_h
yarp::rosmsg::actionlib_msgs::GoalID::stamp
yarp::rosmsg::TickTime stamp
Definition: GoalID.h:42
TickTime.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::GoalID::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::actionlib_msgs::GoalID > rosStyle
Definition: GoalID.h:147
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
BOTTLE_TAG_STRING
#define BOTTLE_TAG_STRING
Definition: Bottle.h:28
Wire.h
yarp::rosmsg::actionlib_msgs::GoalID::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: GoalID.h:60
yarp::rosmsg::actionlib_msgs::GoalID::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: GoalID.h:105
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::TickTime
Definition: TickTime.h:30
yarp::rosmsg::actionlib_msgs::GoalID::getType
yarp::os::Type getType() const override
Definition: GoalID.h:170
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
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::rosmsg::actionlib_msgs::GoalID::typeName
static constexpr const char * typeName
Definition: GoalID.h:151
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::rosmsg::actionlib_msgs::GoalID::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: GoalID.h:77
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::actionlib_msgs::GoalID::GoalID
GoalID()
Definition: GoalID.h:45
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::GoalID::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: GoalID.h:99
yarp::rosmsg::actionlib_msgs::GoalID::typeChecksum
static constexpr const char * typeChecksum
Definition: GoalID.h:154
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::GoalID::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::actionlib_msgs::GoalID > bottleStyle
Definition: GoalID.h:148
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::rosmsg::TickTime::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TickTime.h:116
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
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::TickTime::clear
void clear()
Definition: TickTime.h:78
yarp::rosmsg::actionlib_msgs::GoalID
Definition: GoalID.h:40
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::TickTime::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TickTime.h:151
yarp::rosmsg::actionlib_msgs::GoalID::typeText
static constexpr const char * typeText
Definition: GoalID.h:157
yarp::rosmsg::actionlib_msgs::GoalID::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: GoalID.h:119
yarp::rosmsg::actionlib_msgs::GoalID::id
std::string id
Definition: GoalID.h:43
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