YARP
Yet Another Robot Platform
InputProtocol.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_INPUTPROTOCOL_H
11 #define YARP_OS_INPUTPROTOCOL_H
12 
13 #include <yarp/os/Connection.h>
15 #include <yarp/os/InputStream.h>
16 #include <yarp/os/OutputStream.h>
17 #include <yarp/os/Property.h>
18 #include <yarp/os/Route.h>
19 #include <yarp/os/SizedWriter.h>
20 
21 #include <string>
22 
23 namespace yarp {
24 namespace os {
25 class OutputProtocol;
26 class Contactable;
27 } // namespace os
28 } // namespace yarp
29 
30 
31 namespace yarp {
32 namespace os {
33 
38 {
39 public:
43  virtual ~InputProtocol() = default;
44 
50  virtual bool open(const std::string& name) = 0;
51 
55  virtual void close() = 0;
56 
60  virtual void interrupt() = 0;
61 
66  virtual const Route& getRoute() const = 0;
67 
73  virtual ConnectionReader& beginRead() = 0;
74 
78  virtual void endRead() = 0;
79 
83  virtual void reply(SizedWriter& writer) = 0;
84 
88  virtual Connection& getConnection() = 0;
89 
96  virtual Connection& getReceiver() = 0;
97 
101  virtual bool isOk() const = 0;
102 
108  virtual OutputProtocol& getOutput() = 0;
109 
115  virtual void suppressReply() = 0;
116 
121 
125  virtual InputStream& getInputStream() = 0;
126 
130  virtual void setEnvelope(const std::string& str) = 0;
131 
135  virtual bool setTimeout(double timeout) = 0;
136 
140  virtual void attachPort(Contactable* port) = 0;
141 
145  virtual bool isReplying() const = 0;
146 };
147 
148 } // namespace os
149 } // namespace yarp
150 
151 #endif // YARP_OS_INPUTPROTOCOL_H
yarp::os::OutputProtocol
The output side of an active connection between two ports.
Definition: OutputProtocol.h:33
yarp::os::InputProtocol::close
virtual void close()=0
Negotiate an end to operations.
yarp::os::OutputStream
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:25
OutputStream.h
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::InputProtocol::setTimeout
virtual bool setTimeout(double timeout)=0
Set the timeout to be used for network operations.
yarp::os::Route
Information about a connection between two ports.
Definition: Route.h:32
yarp::os::InputProtocol::getOutputStream
virtual OutputStream & getOutputStream()=0
Access the output stream associated with the connection.
yarp::os::InputProtocol::getOutput
virtual OutputProtocol & getOutput()=0
Get an interface for doing write operations on the connection.
yarp::os::InputProtocol::isReplying
virtual bool isReplying() const =0
Route.h
Property.h
yarp::os::InputProtocol::suppressReply
virtual void suppressReply()=0
Make sure that any attempt to send a reply to input will be denied.
yarp::os::InputProtocol::getInputStream
virtual InputStream & getInputStream()=0
Access the input stream associated with the connection.
Connection.h
yarp::os::InputProtocol::getRoute
virtual const Route & getRoute() const =0
Get the route associated with this connection.
yarp::os::InputProtocol::reply
virtual void reply(SizedWriter &writer)=0
Reply to a message we have just read.
yarp::os::InputProtocol::attachPort
virtual void attachPort(Contactable *port)=0
Set the port to be associated with the connection.
yarp::os::InputProtocol::isOk
virtual bool isOk() const =0
Check if the connection is valid and can be used.
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::os::InputProtocol::open
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...
yarp::os::InputProtocol::beginRead
virtual ConnectionReader & beginRead()=0
Begin a read operation, with bytes read via the returned yarp::os::ConnectionReader object.
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::InputProtocol::interrupt
virtual void interrupt()=0
Try to get operations interrupted.
yarp::os::Connection
A controller for an individual connection.
Definition: Connection.h:30
yarp::os::InputProtocol::~InputProtocol
virtual ~InputProtocol()=default
Destructor.
yarp::os::InputProtocol::endRead
virtual void endRead()=0
End the current read operation, begin by beginRead().
InputStream.h
yarp::os::InputProtocol
The input side of an active connection between two ports.
Definition: InputProtocol.h:38
yarp::os::InputProtocol::setEnvelope
virtual void setEnvelope(const std::string &str)=0
Set the envelope that will be attached to the next message.
yarp::os::InputStream
Simple specification of the minimum functions needed from input streams.
Definition: InputStream.h:29
yarp::os::InputProtocol::getConnection
virtual Connection & getConnection()=0
Get the basic connection through which we are communicating.
SizedWriter.h
yarp::os::InputProtocol::getReceiver
virtual Connection & getReceiver()=0
It is possible to chain a basic connection with a modifier.
yarp::os::SizedWriter
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:36
yarp::os::Contactable
An abstract port.
Definition: Contactable.h:38
ConnectionReader.h