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
TickTime.h
yarp::rosmsg::std_msgs::Time::typeText
static constexpr const char * typeText
Definition: Time.h:122
yarp::rosmsg::std_msgs::Time::clear
void clear()
Definition: Time.h:40
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::os::idl::BottleStyle
Definition: BottleStyle.h:22
yarp::os::Type
Definition: Type.h:24
yarp::rosmsg::std_msgs::Time::typeChecksum
static constexpr const char * typeChecksum
Definition: Time.h:119
yarp::os::idl::WirePortable::read
virtual bool read(yarp::os::idl::WireReader &reader)
Definition: WirePortable.cpp:14
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
yarp::rosmsg::std_msgs::Time::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::std_msgs::Time > bottleStyle
Definition: Time.h:113
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::TickTime
Definition: TickTime.h:30
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::rosmsg::std_msgs::Time
Definition: Time.h:31
std_msgs
Definition: Bool.h:22
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::std_msgs::Time::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Time.h:73
yarp::rosmsg::std_msgs::Time::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Time.h:79
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::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::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::rosmsg::std_msgs::Time::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Time.h:46
yarp::rosmsg::std_msgs::Time::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Time.h:89
yarp::rosmsg::std_msgs::Time::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Time.h:56
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::TickTime::clear
void clear()
Definition: TickTime.h:78
yarp::rosmsg::std_msgs::Time::getType
yarp::os::Type getType() const override
Definition: Time.h:126
yarp::rosmsg::std_msgs::Time::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::std_msgs::Time > rosStyle
Definition: Time.h:112
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::std_msgs::Time::Time
Time()
Definition: Time.h:35
yarp::rosmsg::std_msgs::Time::typeName
static constexpr const char * typeName
Definition: Time.h:116
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::std_msgs::Time::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Time.h:104
yarp::rosmsg::std_msgs::Time::data
yarp::rosmsg::TickTime data
Definition: Time.h:33
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