YARP
Yet Another Robot Platform
WireWriter.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 #ifndef YARP_OS_IDL_WIREWRITER_H
10 #define YARP_OS_IDL_WIREWRITER_H
11 
12 #include <yarp/conf/numeric.h>
13 
14 #include <yarp/os/api.h>
15 
16 #include <yarp/os/Bottle.h>
18 #include <yarp/os/Vocab.h>
20 #include <yarp/os/idl/WireReader.h>
21 
22 #include <string>
23 
24 namespace yarp {
25 namespace os {
26 namespace idl {
27 
33 {
34 public:
36 
37  WireWriter(WireReader& reader);
38 
39  ~WireWriter();
40 
41  bool isNull() const;
42 
43  bool write(const WirePortable& obj) const;
44 
45  bool write(const yarp::os::PortWriter& obj) const;
46 
47  bool writeNested(const WirePortable& obj) const;
48 
49  bool writeNested(const yarp::os::PortWriter& obj) const;
50 
51  bool writeBool(bool x) const;
52 
53  bool writeI8(std::int8_t x) const;
54 
55  bool writeI16(std::int16_t x) const;
56 
57  bool writeI32(std::int32_t x) const;
58 
59  bool writeI64(std::int64_t x) const;
60 
61  bool writeFloat32(yarp::conf::float32_t x) const;
62 
63  bool writeFloat64(yarp::conf::float64_t x) const;
64 
65 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
66  YARP_DEPRECATED_MSG("Use writeI8 instead")
67  bool writeByte(std::int8_t x) const
68  {
69  return writeI8(x);
70  }
71 
72  YARP_DEPRECATED_MSG("Use writeFloat64 instead")
73  bool writeDouble(double x) const
74  {
75  return writeFloat64(static_cast<yarp::conf::float64_t>(x));
76  }
77 #endif // YARP_NO_DEPRECATED
78 
79  bool writeVocab(std::int32_t x) const;
80 
81  bool isValid() const;
82 
83  bool isError() const;
84 
85  bool writeTag(const char* tag, int split, int len) const;
86 
87  bool writeString(const std::string& tag) const;
88 
89  bool writeBinary(const std::string& tag) const;
90 
91  bool writeListHeader(int len) const;
92 
93  bool writeListBegin(int tag, std::uint32_t len) const;
94 
95  bool writeSetBegin(int tag, std::uint32_t len) const;
96 
97  bool writeMapBegin(int tag, int tag2, std::uint32_t len) const;
98 
99  bool writeListEnd() const;
100 
101  bool writeSetEnd() const;
102 
103  bool writeMapEnd() const;
104 
105  bool writeOnewayResponse() const;
106 
107 private:
108  bool get_mode;
109  YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::string) get_string;
110  bool get_is_vocab;
111  mutable bool need_ok;
112  ConnectionWriter& writer;
113 };
114 
115 } // namespace idl
116 } // namespace os
117 } // namespace yarp
118 
119 #endif // YARP_OS_IDL_WIREWRITER_H
ConnectionWriter.h
yarp::os::Time::isValid
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
numeric.h
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:339
api.h
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
yarp::os::idl::WireWriter
IDL-friendly connection writer.
Definition: WireWriter.h:33
WireReader.h
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::conf::float32_t
float float32_t
Definition: numeric.h:50
yarp::os::idl::WireReader
IDL-friendly connection reader.
Definition: WireReader.h:33
YARP_DEPRECATED_MSG
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2883
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
Vocab.h
WirePortable.h
yarp::conf::float64_t
double float64_t
Definition: numeric.h:51
yarp::sig::file::write
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:971
Bottle.h