YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Things.cpp
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#include <yarp/os/Things.h>
7
8#include <cstdio>
9
10using namespace yarp::os;
11
13 beenRead(false),
14 conReader(nullptr),
15 writer(nullptr),
16 reader(nullptr),
17 portable(nullptr)
18{
19}
20
22{
23 delete portable;
24}
25
27{
28 yarp::os::Things::writer = writer;
29}
30
32{
33 return writer;
34}
35
37{
38 yarp::os::Things::reader = reader;
39}
40
42{
43 return reader;
44}
45
47{
48 conReader = &reader;
49 delete portable;
50 portable = nullptr;
51 return true;
52}
53
55{
56 if (writer != nullptr) {
57 return writer->write(connection);
58 }
59 if (portable != nullptr) {
60 return portable->write(connection);
61 }
62 return false;
63}
64
66{
67 delete portable;
68 conReader = nullptr;
69 writer = nullptr;
70 reader = nullptr;
71 portable = nullptr;
72 beenRead = false;
73}
74
76{
77 return beenRead;
78}
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
An interface for writing to a network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition PortWriter.h:23
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
bool write(ConnectionWriter &writer) const override=0
Write this object to a network connection.
bool setConnectionReader(yarp::os::ConnectionReader &reader)
set a reference to a ConnectionReader
Definition Things.cpp:46
yarp::os::PortWriter * getPortWriter()
Definition Things.cpp:31
yarp::os::PortReader * getPortReader()
Definition Things.cpp:41
bool write(yarp::os::ConnectionWriter &connection)
Definition Things.cpp:54
virtual ~Things()
Definition Things.cpp:21
void setPortReader(yarp::os::PortReader *reader)
Set the reference to a PortReader object.
Definition Things.cpp:36
void setPortWriter(yarp::os::PortWriter *writer)
Set the reference to a PortWriter object.
Definition Things.cpp:26
bool hasBeenRead()
Definition Things.cpp:75
An interface to the operating system, including Port based communication.