YARP
Yet Another Robot Platform
InputProtocol.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_INPUTPROTOCOL_H
8#define YARP_OS_INPUTPROTOCOL_H
9
10#include <yarp/os/Connection.h>
12#include <yarp/os/InputStream.h>
14#include <yarp/os/Property.h>
15#include <yarp/os/Route.h>
16#include <yarp/os/SizedWriter.h>
17
18#include <string>
19
20namespace yarp::os {
21class OutputProtocol;
22class Contactable;
23} // namespace yarp::os
24
25
26namespace yarp::os {
27
32{
33public:
37 virtual ~InputProtocol() = default;
38
44 virtual bool open(const std::string& name) = 0;
45
49 virtual void close() = 0;
50
54 virtual void interrupt() = 0;
55
60 virtual const Route& getRoute() const = 0;
61
68
72 virtual void endRead() = 0;
73
77 virtual void reply(SizedWriter& writer) = 0;
78
82 virtual Connection& getConnection() = 0;
83
90 virtual Connection& getReceiver() = 0;
91
95 virtual bool isOk() const = 0;
96
102 virtual OutputProtocol& getOutput() = 0;
103
109 virtual void suppressReply() = 0;
110
115
120
124 virtual void setEnvelope(const std::string& str) = 0;
125
129 virtual bool setTimeout(double timeout) = 0;
130
134 virtual void attachPort(Contactable* port) = 0;
135
139 virtual bool isReplying() const = 0;
140};
141
142} // namespace yarp::os
143
144#endif // YARP_OS_INPUTPROTOCOL_H
An interface for reading from a network connection.
A controller for an individual connection.
Definition: Connection.h:26
An abstract port.
Definition: Contactable.h:28
The input side of an active connection between two ports.
Definition: InputProtocol.h:32
virtual bool open(const std::string &name)=0
Start negotiating a carrier, using the given name as our own if a name is needed (this should general...
virtual bool isOk() const =0
Check if the connection is valid and can be used.
virtual OutputStream & getOutputStream()=0
Access the output stream associated with the connection.
virtual InputStream & getInputStream()=0
Access the input stream associated with the connection.
virtual void close()=0
Negotiate an end to operations.
virtual bool setTimeout(double timeout)=0
Set the timeout to be used for network operations.
virtual void setEnvelope(const std::string &str)=0
Set the envelope that will be attached to the next message.
virtual void endRead()=0
End the current read operation, begin by beginRead().
virtual void reply(SizedWriter &writer)=0
Reply to a message we have just read.
virtual const Route & getRoute() const =0
Get the route associated with this connection.
virtual ~InputProtocol()=default
Destructor.
virtual ConnectionReader & beginRead()=0
Begin a read operation, with bytes read via the returned yarp::os::ConnectionReader object.
virtual void suppressReply()=0
Make sure that any attempt to send a reply to input will be denied.
virtual void interrupt()=0
Try to get operations interrupted.
virtual bool isReplying() const =0
virtual Connection & getReceiver()=0
It is possible to chain a basic connection with a modifier.
virtual OutputProtocol & getOutput()=0
Get an interface for doing write operations on the connection.
virtual Connection & getConnection()=0
Get the basic connection through which we are communicating.
virtual void attachPort(Contactable *port)=0
Set the port to be associated with the connection.
Simple specification of the minimum functions needed from input streams.
Definition: InputStream.h:25
The output side of an active connection between two ports.
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:21
Information about a connection between two ports.
Definition: Route.h:28
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:32
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition: api.h:18