YARP
Yet Another Robot Platform
Duration.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 "std_msgs/Duration" msg definition:
12 // duration data
13 // Instances of this class can be read and written with YARP ports,
14 // using a ROS-compatible format.
15 
16 #ifndef YARP_ROSMSG_std_msgs_Duration_h
17 #define YARP_ROSMSG_std_msgs_Duration_h
18 
19 #include <yarp/os/Wire.h>
20 #include <yarp/os/Type.h>
21 #include <yarp/os/idl/WireTypes.h>
22 #include <string>
23 #include <vector>
25 
26 namespace yarp {
27 namespace rosmsg {
28 namespace std_msgs {
29 
31 {
32 public:
34 
36  data()
37  {
38  }
39 
40  void clear()
41  {
42  // *** data ***
43  data.clear();
44  }
45 
46  bool readBare(yarp::os::ConnectionReader& connection) override
47  {
48  // *** data ***
49  if (!data.read(connection)) {
50  return false;
51  }
52 
53  return !connection.isError();
54  }
55 
56  bool readBottle(yarp::os::ConnectionReader& connection) override
57  {
58  connection.convertTextMode();
59  yarp::os::idl::WireReader reader(connection);
60  if (!reader.readListHeader(1)) {
61  return false;
62  }
63 
64  // *** data ***
65  if (!data.read(connection)) {
66  return false;
67  }
68 
69  return !connection.isError();
70  }
71 
73  bool read(yarp::os::ConnectionReader& connection) override
74  {
75  return (connection.isBareMode() ? readBare(connection)
76  : readBottle(connection));
77  }
78 
79  bool writeBare(yarp::os::ConnectionWriter& connection) const override
80  {
81  // *** data ***
82  if (!data.write(connection)) {
83  return false;
84  }
85 
86  return !connection.isError();
87  }
88 
89  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
90  {
91  connection.appendInt32(BOTTLE_TAG_LIST);
92  connection.appendInt32(1);
93 
94  // *** data ***
95  if (!data.write(connection)) {
96  return false;
97  }
98 
99  connection.convertTextMode();
100  return !connection.isError();
101  }
102 
104  bool write(yarp::os::ConnectionWriter& connection) const override
105  {
106  return (connection.isBareMode() ? writeBare(connection)
107  : writeBottle(connection));
108  }
109 
110  // This class will serialize ROS style or YARP style depending on protocol.
111  // If you need to force a serialization style, use one of these classes:
114 
115  // The name for this message, ROS will need this
116  static constexpr const char* typeName = "std_msgs/Duration";
117 
118  // The checksum for this message, ROS will need this
119  static constexpr const char* typeChecksum = "3e286caf4241d664e55f3ad380e2ae46";
120 
121  // The source text for this message, ROS will need this
122  static constexpr const char* typeText = "\
123 duration data\n\
124 ";
125 
126  yarp::os::Type getType() const override
127  {
129  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
130  typ.addProperty("message_definition", yarp::os::Value(typeText));
131  return typ;
132  }
133 };
134 
135 } // namespace std_msgs
136 } // namespace rosmsg
137 } // namespace yarp
138 
139 #endif // YARP_ROSMSG_std_msgs_Duration_h
WireTypes.h
yarp::rosmsg::std_msgs::Duration::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Duration > rosStyle
Definition: Duration.h:112
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
TickDuration.h
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::std_msgs::Duration::data
yarp::rosmsg::TickDuration data
Definition: Duration.h:33
yarp::rosmsg::std_msgs::Duration::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Duration.h:46
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
yarp::rosmsg::std_msgs::Duration::typeName
static constexpr const char * typeName
Definition: Duration.h:116
yarp::rosmsg::std_msgs::Duration::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Duration.h:104
yarp::rosmsg::std_msgs::Duration::typeText
static constexpr const char * typeText
Definition: Duration.h:122
yarp::rosmsg::TickDuration
Definition: TickDuration.h:30
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::rosmsg::std_msgs::Duration::Duration
Duration()
Definition: Duration.h:35
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::rosmsg::std_msgs::Duration::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Duration.h:79
std_msgs
Definition: Bool.h:22
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::rosmsg::std_msgs::Duration::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Duration.h:73
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::std_msgs::Duration::getType
yarp::os::Type getType() const override
Definition: Duration.h:126
yarp::rosmsg::std_msgs::Duration::clear
void clear()
Definition: Duration.h:40
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::std_msgs::Duration::typeChecksum
static constexpr const char * typeChecksum
Definition: Duration.h:119
yarp::rosmsg::std_msgs::Duration::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Duration.h:89
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::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::std_msgs::Duration::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Duration > bottleStyle
Definition: Duration.h:113
yarp::rosmsg::std_msgs::Duration::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Duration.h:56
yarp::rosmsg::TickDuration::clear
void clear()
Definition: TickDuration.h:78
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::std_msgs::Duration
Definition: Duration.h:31
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::TickDuration::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TickDuration.h:151
yarp::rosmsg::TickDuration::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TickDuration.h:116
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