YARP
Yet Another Robot Platform
Time.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/Time" msg definition:
9 // time 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_Time_h
14 #define YARP_ROSMSG_std_msgs_Time_h
15 
16 #include <yarp/os/Wire.h>
17 #include <yarp/os/Type.h>
18 #include <yarp/os/idl/WireTypes.h>
19 #include <string>
20 #include <vector>
22 
23 namespace yarp {
24 namespace rosmsg {
25 namespace std_msgs {
26 
28 {
29 public:
31 
32  Time() :
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/Time";
114 
115  // The checksum for this message, ROS will need this
116  static constexpr const char* typeChecksum = "cd7166c74c552c311fbcc2fe5a7bc289";
117 
118  // The source text for this message, ROS will need this
119  static constexpr const char* typeText = "\
120 time data\n\
121 ";
122 
123  yarp::os::Type getType() const override
124  {
126  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
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_Time_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: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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TickTime.h:148
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TickTime.h:113
static constexpr const char * typeText
Definition: Time.h:119
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Time > bottleStyle
Definition: Time.h:110
yarp::os::Type getType() const override
Definition: Time.h:123
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Time.h:43
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Time.h:101
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Time.h:70
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Time.h:53
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Time.h:76
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Time > rosStyle
Definition: Time.h:109
static constexpr const char * typeName
Definition: Time.h:113
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Time.h:86
yarp::rosmsg::TickTime data
Definition: Time.h:30
static constexpr const char * typeChecksum
Definition: Time.h:116
Definition: Bool.h:19
The main, catch-all namespace for YARP.
Definition: dirs.h:16