YARP
Yet Another Robot Platform
AddDiagnostics.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/AddDiagnostics" msg definition:
12 // # This service is used as part of the process for loading analyzers at runtime,
13 // # and should be used by a loader script or program, not as a standalone service.
14 // # Information about dynamic addition of analyzers can be found at
15 // # http://wiki.ros.org/diagnostics/Tutorials/Adding%20Analyzers%20at%20Runtime
16 //
17 // # The load_namespace parameter defines the namespace where parameters for the
18 // # initialization of analyzers in the diagnostic aggregator have been loaded. The
19 // # value should be a global name (i.e. /my/name/space), not a relative
20 // # (my/name/space) or private (~my/name/space) name. Analyzers will not be added
21 // # if a non-global name is used. The call will also fail if the namespace
22 // # contains parameters that follow a namespace structure that does not conform to
23 // # that expected by the analyzer definitions. See
24 // # http://wiki.ros.org/diagnostics/Tutorials/Configuring%20Diagnostic%20Aggregators
25 // # and http://wiki.ros.org/diagnostics/Tutorials/Using%20the%20GenericAnalyzer
26 // # for examples of the structure of yaml files which are expected to have been
27 // # loaded into the namespace.
28 // string load_namespace
29 // ---
30 //
31 // # True if diagnostic aggregator was updated with new diagnostics, False
32 // # otherwise. A false return value means that either there is a bond in the
33 // # aggregator which already used the requested namespace, or the initialization
34 // # of analyzers failed.
35 // bool success
36 //
37 // # Message with additional information about the success or failure
38 // string message
39 // Instances of this class can be read and written with YARP ports,
40 // using a ROS-compatible format.
41 
42 #ifndef YARP_ROSMSG_diagnostic_msgs_AddDiagnostics_h
43 #define YARP_ROSMSG_diagnostic_msgs_AddDiagnostics_h
44 
45 #include <yarp/os/Wire.h>
46 #include <yarp/os/Type.h>
47 #include <yarp/os/idl/WireTypes.h>
48 #include <string>
49 #include <vector>
50 
51 namespace yarp {
52 namespace rosmsg {
53 namespace diagnostic_msgs {
54 
56 {
57 public:
58  std::string load_namespace;
59 
61  load_namespace("")
62  {
63  }
64 
65  void clear()
66  {
67  // *** load_namespace ***
68  load_namespace = "";
69  }
70 
71  bool readBare(yarp::os::ConnectionReader& connection) override
72  {
73  // *** load_namespace ***
74  int len = connection.expectInt32();
75  load_namespace.resize(len);
76  if (!connection.expectBlock((char*)load_namespace.c_str(), len)) {
77  return false;
78  }
79 
80  return !connection.isError();
81  }
82 
83  bool readBottle(yarp::os::ConnectionReader& connection) override
84  {
85  connection.convertTextMode();
86  yarp::os::idl::WireReader reader(connection);
87  if (!reader.readListHeader(1)) {
88  return false;
89  }
90 
91  // *** load_namespace ***
92  if (!reader.readString(load_namespace)) {
93  return false;
94  }
95 
96  return !connection.isError();
97  }
98 
100  bool read(yarp::os::ConnectionReader& connection) override
101  {
102  return (connection.isBareMode() ? readBare(connection)
103  : readBottle(connection));
104  }
105 
106  bool writeBare(yarp::os::ConnectionWriter& connection) const override
107  {
108  // *** load_namespace ***
109  connection.appendInt32(load_namespace.length());
110  connection.appendExternalBlock((char*)load_namespace.c_str(), load_namespace.length());
111 
112  return !connection.isError();
113  }
114 
115  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
116  {
117  connection.appendInt32(BOTTLE_TAG_LIST);
118  connection.appendInt32(1);
119 
120  // *** load_namespace ***
121  connection.appendInt32(BOTTLE_TAG_STRING);
122  connection.appendInt32(load_namespace.length());
123  connection.appendExternalBlock((char*)load_namespace.c_str(), load_namespace.length());
124 
125  connection.convertTextMode();
126  return !connection.isError();
127  }
128 
130  bool write(yarp::os::ConnectionWriter& connection) const override
131  {
132  return (connection.isBareMode() ? writeBare(connection)
133  : writeBottle(connection));
134  }
135 
136  // This class will serialize ROS style or YARP style depending on protocol.
137  // If you need to force a serialization style, use one of these classes:
140 
141  // The name for this message, ROS will need this
142  static constexpr const char* typeName = "diagnostic_msgs/AddDiagnostics";
143 
144  // The checksum for this message, ROS will need this
145  static constexpr const char* typeChecksum = "c26cf6e164288fbc6050d74f838bcdf0";
146 
147  // The source text for this message, ROS will need this
148  static constexpr const char* typeText = "\
149 # This service is used as part of the process for loading analyzers at runtime,\n\
150 # and should be used by a loader script or program, not as a standalone service.\n\
151 # Information about dynamic addition of analyzers can be found at\n\
152 # http://wiki.ros.org/diagnostics/Tutorials/Adding%20Analyzers%20at%20Runtime\n\
153 \n\
154 # The load_namespace parameter defines the namespace where parameters for the\n\
155 # initialization of analyzers in the diagnostic aggregator have been loaded. The\n\
156 # value should be a global name (i.e. /my/name/space), not a relative\n\
157 # (my/name/space) or private (~my/name/space) name. Analyzers will not be added\n\
158 # if a non-global name is used. The call will also fail if the namespace\n\
159 # contains parameters that follow a namespace structure that does not conform to\n\
160 # that expected by the analyzer definitions. See\n\
161 # http://wiki.ros.org/diagnostics/Tutorials/Configuring%20Diagnostic%20Aggregators\n\
162 # and http://wiki.ros.org/diagnostics/Tutorials/Using%20the%20GenericAnalyzer\n\
163 # for examples of the structure of yaml files which are expected to have been\n\
164 # loaded into the namespace.\n\
165 string load_namespace\n\
166 ---\n\
167 \n\
168 # True if diagnostic aggregator was updated with new diagnostics, False\n\
169 # otherwise. A false return value means that either there is a bond in the\n\
170 # aggregator which already used the requested namespace, or the initialization\n\
171 # of analyzers failed.\n\
172 bool success\n\
173 \n\
174 # Message with additional information about the success or failure\n\
175 string message\n\
176 ";
177 
178  yarp::os::Type getType() const override
179  {
181  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
182  typ.addProperty("message_definition", yarp::os::Value(typeText));
183  return typ;
184  }
185 };
186 
187 } // namespace diagnostic_msgs
188 } // namespace rosmsg
189 } // namespace yarp
190 
191 #endif // YARP_ROSMSG_diagnostic_msgs_AddDiagnostics_h
yarp::os::idl::WireReader::readString
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:339
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: AddDiagnostics.h:83
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::clear
void clear()
Definition: AddDiagnostics.h:65
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::diagnostic_msgs::AddDiagnostics::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::diagnostic_msgs::AddDiagnostics > rosStyle
Definition: AddDiagnostics.h:138
yarp::os::idl::WirePortable::read
virtual bool read(yarp::os::idl::WireReader &reader)
Definition: WirePortable.cpp:14
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::typeText
static constexpr const char * typeText
Definition: AddDiagnostics.h:148
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
BOTTLE_TAG_STRING
#define BOTTLE_TAG_STRING
Definition: Bottle.h:28
Wire.h
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::typeName
static constexpr const char * typeName
Definition: AddDiagnostics.h:142
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: AddDiagnostics.h:115
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::diagnostic_msgs::AddDiagnostics > bottleStyle
Definition: AddDiagnostics.h:139
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::os::ConnectionReader::expectInt32
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
yarp::rosmsg::diagnostic_msgs::AddDiagnostics
Definition: AddDiagnostics.h:56
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::rosmsg::diagnostic_msgs::AddDiagnostics::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: AddDiagnostics.h:130
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::typeChecksum
static constexpr const char * typeChecksum
Definition: AddDiagnostics.h:145
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::AddDiagnostics
AddDiagnostics()
Definition: AddDiagnostics.h:60
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::rosmsg::diagnostic_msgs::AddDiagnostics::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: AddDiagnostics.h:71
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::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::diagnostic_msgs::AddDiagnostics::getType
yarp::os::Type getType() const override
Definition: AddDiagnostics.h:178
diagnostic_msgs
Definition: AddDiagnostics.h:22
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::load_namespace
std::string load_namespace
Definition: AddDiagnostics.h:58
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: AddDiagnostics.h:106
yarp::os::ConnectionWriter::appendExternalBlock
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
yarp::rosmsg::diagnostic_msgs::AddDiagnostics::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: AddDiagnostics.h:100
yarp::os::ConnectionReader::expectBlock
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
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