YARP
Yet Another Robot Platform
Connection.h
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#ifndef YARP_OS_CONNECTION_H
7#define YARP_OS_CONNECTION_H
8
9#include <yarp/os/api.h>
10
11#include <string>
12
13namespace yarp::os {
14
15class Bytes;
16class ConnectionReader;
17class PortWriter;
18class PortReader;
19class Property;
20
26{
27public:
31 virtual ~Connection();
32
39 virtual bool isValid() const;
40
46 virtual bool isTextMode() const = 0;
47
53 virtual bool isBareMode() const;
54
65 virtual void handleEnvelope(const std::string& envelope) = 0;
66
67
75 virtual bool canEscape() const = 0;
76
83 virtual bool requireAck() const = 0;
84
91 virtual bool supportReply() const = 0;
92
101 virtual bool isLocal() const = 0;
102
103
115 virtual bool isPush() const = 0;
116
127 virtual bool isConnectionless() const = 0;
128
129
139 virtual bool isBroadcast() const = 0;
140
141
147 virtual bool isActive() const = 0;
148
149
156 virtual bool modifiesIncomingData() const = 0;
157
169
178
185 virtual bool modifiesOutgoingData() const = 0;
186
197 virtual const PortWriter& modifyOutgoingData(const PortWriter& writer) = 0;
198
206 virtual bool acceptOutgoingData(const PortWriter& writer) = 0;
207
214 virtual bool modifiesReply() const = 0;
215
222 virtual PortReader& modifyReply(PortReader& reader) = 0;
223
229 virtual void setCarrierParams(const yarp::os::Property& params) = 0;
230
237 virtual void getCarrierParams(yarp::os::Property& params) const = 0;
238
246 virtual void getHeader(yarp::os::Bytes& header) const = 0;
247
252 virtual void prepareDisconnect() = 0;
253
259 virtual std::string getName() const = 0;
260};
261
262} // namespace yarp::os
263
264
265#endif // YARP_OS_CONNECTION_H
A simple abstraction for a block of bytes.
Definition: Bytes.h:24
An interface for reading from a network connection.
A controller for an individual connection.
Definition: Connection.h:26
virtual bool isLocal() const =0
Check if carrier operates within a single process.
virtual bool isTextMode() const =0
Check if carrier is textual in nature.
virtual void prepareDisconnect()=0
Do cleanup and preparation for the coming disconnect, if necessary.
virtual bool acceptIncomingData(yarp::os::ConnectionReader &reader)=0
Determine whether incoming data should be accepted.
virtual bool isConnectionless() const =0
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
virtual void getCarrierParams(yarp::os::Property &params) const =0
Get carrier configuration and deliver it by port administrative commands.
virtual PortReader & modifyReply(PortReader &reader)=0
Modify reply payload data, if appropriate.
virtual void handleEnvelope(const std::string &envelope)=0
Carriers that do not distinguish data from administrative headers (i.e.
virtual bool acceptOutgoingData(const PortWriter &writer)=0
Determine whether outgoing data should be accepted.
virtual ~Connection()
Destructor.
virtual bool requireAck() const =0
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
virtual bool modifiesReply() const =0
Check if this carrier modifies outgoing data through the Carrier::modifyReply method.
virtual bool modifiesIncomingData() const =0
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.
virtual bool isActive() const =0
Check if carrier is alive and error free.
virtual bool canEscape() const =0
Check if carrier can encode administrative messages, as opposed to just user data.
virtual const PortWriter & modifyOutgoingData(const PortWriter &writer)=0
Modify outgoing payload data, if appropriate.
virtual yarp::os::ConnectionReader & modifyIncomingData(yarp::os::ConnectionReader &reader)=0
Modify incoming payload data, if appropriate.
virtual bool isPush() const =0
Check if carrier is "push" or "pull" style.
virtual std::string getName() const =0
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
virtual bool supportReply() const =0
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
virtual bool modifiesOutgoingData() const =0
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.
virtual bool isBroadcast() const =0
Check if this carrier uses a broadcast mechanism.
virtual void getHeader(yarp::os::Bytes &header) const =0
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
virtual void setCarrierParams(const yarp::os::Property &params)=0
Configure carrier from port administrative commands.
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
A class for storing options and configuration information.
Definition: Property.h:33
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:314
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition: api.h:18