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