YARP
Yet Another Robot Platform
OutputProtocol.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_OUTPUTPROTOCOL_H
8 #define YARP_OS_OUTPUTPROTOCOL_H
9 
10 #include <yarp/os/Connection.h>
12 #include <yarp/os/InputStream.h>
13 #include <yarp/os/Property.h>
14 #include <yarp/os/Route.h>
15 #include <yarp/os/SizedWriter.h>
16 
17 namespace yarp {
18 namespace os {
19 class InputProtocol;
20 class Contactable;
21 } // namespace os
22 } // namespace yarp
23 
24 namespace yarp {
25 namespace os {
30 {
31 public:
35  virtual ~OutputProtocol() = default;
36 
42  virtual bool open(const Route& route) = 0;
43 
49  virtual void rename(const Route& route) = 0;
50 
54  virtual void close() = 0;
55 
56  virtual const Route& getRoute() const = 0;
57 
61  virtual bool isOk() const = 0;
62 
66  virtual Connection& getConnection() = 0;
67 
74  virtual Connection& getReceiver() = 0;
75 
82  virtual Connection& getSender() = 0;
83 
92  virtual bool write(SizedWriter& writer) = 0;
93 
94  virtual void interrupt() = 0;
95 
96 
102  virtual InputProtocol& getInput() = 0;
103 
108 
112  virtual InputStream& getInputStream() = 0;
113 
117  virtual bool setTimeout(double timeout) = 0;
118 
122  virtual void attachPort(Contactable* port) = 0;
123 
128  virtual void beginWrite() = 0;
129 };
130 
131 } // namespace os
132 } // namespace yarp
133 
134 #endif // YARP_OS_OUTPUTPROTOCOL_H
A controller for an individual connection.
Definition: Connection.h:27
An abstract port.
Definition: Contactable.h:35
The input side of an active connection between two ports.
Definition: InputProtocol.h:35
Simple specification of the minimum functions needed from input streams.
Definition: InputStream.h:26
The output side of an active connection between two ports.
virtual const Route & getRoute() const =0
virtual Connection & getConnection()=0
Get the connection whose protocol operations we are managing.
virtual bool open(const Route &route)=0
Start negotiating a carrier, using the given route (this should generally match the name of the sendi...
virtual Connection & getSender()=0
It is possible to chain a basic connection with a modifier.
virtual Connection & getReceiver()=0
It is possible to chain a basic connection with a modifier.
virtual void attachPort(Contactable *port)=0
Set the port to be associated with the connection.
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 InputProtocol & getInput()=0
Get an interface for doing read operations on the connection.
virtual ~OutputProtocol()=default
Destructor.
virtual void close()=0
Negotiate an end to operations.
virtual void interrupt()=0
virtual void rename(const Route &route)=0
Relabel the route after the fact (e.g.
virtual bool setTimeout(double timeout)=0
Set the timeout to be used for network operations.
virtual void beginWrite()=0
Notify connection that we intend to write to it.
virtual bool isOk() const =0
Check if the connection is valid and can be used.
virtual bool write(SizedWriter &writer)=0
Write a message on the connection.
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:22
Information about a connection between two ports.
Definition: Route.h:29
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:33
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18