YARP
Yet Another Robot Platform
Time.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/Time" msg definition:
12 // time 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_Time_h
17 #define YARP_ROSMSG_std_msgs_Time_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 
35  Time() :
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/Time";
117 
118  // The checksum for this message, ROS will need this
119  static constexpr const char* typeChecksum = "cd7166c74c552c311fbcc2fe5a7bc289";
120 
121  // The source text for this message, ROS will need this
122  static constexpr const char* typeText = "\
123 time 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_Time_h
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
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:174
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
A single value (typically within a Bottle).
Definition: Value.h:47
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
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:33
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TickTime.h:151
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TickTime.h:116
static constexpr const char * typeText
Definition: Time.h:122
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Time > bottleStyle
Definition: Time.h:113
yarp::os::Type getType() const override
Definition: Time.h:126
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Time.h:46
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Time.h:104
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Time.h:73
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Time.h:56
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Time.h:79
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Time > rosStyle
Definition: Time.h:112
static constexpr const char * typeName
Definition: Time.h:116
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Time.h:89
yarp::rosmsg::TickTime data
Definition: Time.h:33
static constexpr const char * typeChecksum
Definition: Time.h:119
Definition: Bool.h:22
The main, catch-all namespace for YARP.
Definition: environment.h:18