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