YARP
Yet Another Robot Platform
Unwrapped.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_UNWRAPPED_H
10 #define YARP_OS_IDL_UNWRAPPED_H
11 
13 #include <yarp/os/idl/WireReader.h>
14 #include <yarp/os/idl/WireWriter.h>
15 
16 namespace yarp {
17 namespace os {
18 namespace idl {
19 
20 template <class T>
22 {
23 public:
25 
26  bool read(yarp::os::ConnectionReader& reader) override
27  {
28  WireReader wreader(reader);
29  return content.read(wreader);
30  }
31 
32  bool write(yarp::os::ConnectionWriter& writer) const override
33  {
34  WireWriter wwriter(writer);
35  return content.write(wwriter);
36  }
37 };
38 
39 template <class T>
41 {
42 public:
43  T& content;
44 
46 
47  bool read(yarp::os::ConnectionReader& reader) override
48  {
49  WireReader wreader(reader);
50  return content.read(wreader);
51  }
52 
53  bool write(yarp::os::ConnectionWriter& writer) const override
54  {
55  WireWriter wwriter(writer);
56  return content.write(wwriter);
57  }
58 };
59 
60 } // namespace idl
61 } // namespace os
62 } // namespace yarp
63 
64 #endif // YARP_OS_IDL_UNWRAPPED_H
yarp::os::Portable
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:29
yarp::os::idl::UnwrappedView::read
bool read(yarp::os::ConnectionReader &reader) override
Read this object from a network connection.
Definition: Unwrapped.h:47
yarp::os::idl::UnwrappedView::content
T & content
Definition: Unwrapped.h:43
yarp::os::idl::Unwrapped::write
bool write(yarp::os::ConnectionWriter &writer) const override
Write this object to a network connection.
Definition: Unwrapped.h:32
yarp::os::idl::UnwrappedView::write
bool write(yarp::os::ConnectionWriter &writer) const override
Write this object to a network connection.
Definition: Unwrapped.h:53
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::Unwrapped
Definition: Unwrapped.h:22
WireWriter.h
yarp::os::idl::Unwrapped::content
T content
Definition: Unwrapped.h:24
yarp::os::idl::UnwrappedView::UnwrappedView
UnwrappedView(T &content)
Definition: Unwrapped.h:45
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
The main, catch-all namespace for YARP.
Definition: environment.h:18
WirePortable.h
yarp::os::idl::UnwrappedView
Definition: Unwrapped.h:41
yarp::os::idl::Unwrapped::read
bool read(yarp::os::ConnectionReader &reader) override
Read this object from a network connection.
Definition: Unwrapped.h:26