YARP
Yet Another Robot Platform
SelfTest.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 "diagnostic_msgs/SelfTest" msg definition:
9 // ---
10 // string id
11 // byte passed
12 // DiagnosticStatus[] status
13 // Instances of this class can be read and written with YARP ports,
14 // using a ROS-compatible format.
15 
16 #ifndef YARP_ROSMSG_diagnostic_msgs_SelfTest_h
17 #define YARP_ROSMSG_diagnostic_msgs_SelfTest_h
18 
19 #include <yarp/os/Wire.h>
20 #include <yarp/os/Type.h>
22 #include <string>
23 #include <vector>
24 
25 namespace yarp {
26 namespace rosmsg {
27 namespace diagnostic_msgs {
28 
30 {
31 public:
32 
34  {
35  }
36 
37  void clear()
38  {
39  }
40 
41  bool readBare(yarp::os::ConnectionReader& connection) override
42  {
43 
44  return !connection.isError();
45  }
46 
47  bool readBottle(yarp::os::ConnectionReader& connection) override
48  {
49  connection.convertTextMode();
50  yarp::os::idl::WireReader reader(connection);
51  if (!reader.readListHeader(0)) {
52  return false;
53  }
54 
55 
56  return !connection.isError();
57  }
58 
60  bool read(yarp::os::ConnectionReader& connection) override
61  {
62  return (connection.isBareMode() ? readBare(connection)
63  : readBottle(connection));
64  }
65 
66  bool writeBare(yarp::os::ConnectionWriter& connection) const override
67  {
68 
69  return !connection.isError();
70  }
71 
72  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
73  {
74  connection.appendInt32(BOTTLE_TAG_LIST);
75  connection.appendInt32(0);
76 
77 
78  connection.convertTextMode();
79  return !connection.isError();
80  }
81 
83  bool write(yarp::os::ConnectionWriter& connection) const override
84  {
85  return (connection.isBareMode() ? writeBare(connection)
86  : writeBottle(connection));
87  }
88 
89  // This class will serialize ROS style or YARP style depending on protocol.
90  // If you need to force a serialization style, use one of these classes:
93 
94  // The name for this message, ROS will need this
95  static constexpr const char* typeName = "diagnostic_msgs/SelfTest";
96 
97  // The checksum for this message, ROS will need this
98  static constexpr const char* typeChecksum = "d41d8cd98f00b204e9800998ecf8427e";
99 
100  // The source text for this message, ROS will need this
101  static constexpr const char* typeText = "\
102 ---\n\
103 string id\n\
104 byte passed\n\
105 DiagnosticStatus[] status\n\
106 ";
107 
108  yarp::os::Type getType() const override
109  {
111  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
112  typ.addProperty("message_definition", yarp::os::Value(typeText));
113  return typ;
114  }
115 };
116 
117 } // namespace diagnostic_msgs
118 } // namespace rosmsg
119 } // namespace yarp
120 
121 #endif // YARP_ROSMSG_diagnostic_msgs_SelfTest_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
static constexpr const char * typeChecksum
Definition: SelfTest.h:98
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: SelfTest.h:83
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: SelfTest.h:47
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: SelfTest.h:41
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: SelfTest.h:60
yarp::os::Type getType() const override
Definition: SelfTest.h:108
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: SelfTest.h:66
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: SelfTest.h:72
yarp::os::idl::BottleStyle< yarp::rosmsg::diagnostic_msgs::SelfTest > bottleStyle
Definition: SelfTest.h:92
static constexpr const char * typeText
Definition: SelfTest.h:101
static constexpr const char * typeName
Definition: SelfTest.h:95
yarp::os::idl::BareStyle< yarp::rosmsg::diagnostic_msgs::SelfTest > rosStyle
Definition: SelfTest.h:91
The main, catch-all namespace for YARP.
Definition: dirs.h:16