YARP
Yet Another Robot Platform
Connection.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_OS_CONNECTION_H
10 #define YARP_OS_CONNECTION_H
11 
12 #include <yarp/os/api.h>
13 
14 #include <string>
15 
16 namespace yarp {
17 namespace os {
18 
19 class Bytes;
20 class ConnectionReader;
21 class PortWriter;
22 class PortReader;
23 class Property;
24 
30 {
31 public:
35  virtual ~Connection();
36 
43  virtual bool isValid() const;
44 
50  virtual bool isTextMode() const = 0;
51 
57  virtual bool isBareMode() const;
58 
69  virtual void handleEnvelope(const std::string& envelope) = 0;
70 
71 
79  virtual bool canEscape() const = 0;
80 
87  virtual bool requireAck() const = 0;
88 
95  virtual bool supportReply() const = 0;
96 
105  virtual bool isLocal() const = 0;
106 
107 
119  virtual bool isPush() const = 0;
120 
131  virtual bool isConnectionless() const = 0;
132 
133 
143  virtual bool isBroadcast() const = 0;
144 
145 
151  virtual bool isActive() const = 0;
152 
153 
160  virtual bool modifiesIncomingData() const = 0;
161 
173 
182 
189  virtual bool modifiesOutgoingData() const = 0;
190 
201  virtual const PortWriter& modifyOutgoingData(const PortWriter& writer) = 0;
202 
210  virtual bool acceptOutgoingData(const PortWriter& writer) = 0;
211 
218  virtual bool modifiesReply() const = 0;
219 
226  virtual PortReader& modifyReply(PortReader& reader) = 0;
227 
233  virtual void setCarrierParams(const yarp::os::Property& params) = 0;
234 
241  virtual void getCarrierParams(yarp::os::Property& params) const = 0;
242 
250  virtual void getHeader(yarp::os::Bytes& header) const = 0;
251 
256  virtual void prepareDisconnect() = 0;
257 
263  virtual std::string getName() const = 0;
264 };
265 
266 } // namespace os
267 } // namespace yarp
268 
269 
270 #endif // YARP_OS_CONNECTION_H
yarp::os::Connection::acceptOutgoingData
virtual bool acceptOutgoingData(const PortWriter &writer)=0
Determine whether outgoing data should be accepted.
yarp::os::Connection::acceptIncomingData
virtual bool acceptIncomingData(yarp::os::ConnectionReader &reader)=0
Determine whether incoming data should be accepted.
yarp::os::Connection::isActive
virtual bool isActive() const =0
Check if carrier is alive and error free.
yarp::os::Time::isValid
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
api.h
yarp::os::Connection::isTextMode
virtual bool isTextMode() const =0
Check if carrier is textual in nature.
yarp::os::Connection::getName
virtual std::string getName() const =0
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::Connection::isLocal
virtual bool isLocal() const =0
Check if carrier operates within a single process.
yarp::os::Connection::modifyReply
virtual PortReader & modifyReply(PortReader &reader)=0
Modify reply payload data, if appropriate.
yarp::os::Connection::modifiesReply
virtual bool modifiesReply() const =0
Check if this carrier modifies outgoing data through the Carrier::modifyReply method.
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
yarp::os::Connection::handleEnvelope
virtual void handleEnvelope(const std::string &envelope)=0
Carriers that do not distinguish data from administrative headers (i.e.
yarp::os::Connection::canEscape
virtual bool canEscape() const =0
Check if carrier can encode administrative messages, as opposed to just user data.
yarp::os::Connection::modifiesIncomingData
virtual bool modifiesIncomingData() const =0
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.
yarp::os::PortReader
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
yarp::os::Connection::modifyIncomingData
virtual yarp::os::ConnectionReader & modifyIncomingData(yarp::os::ConnectionReader &reader)=0
Modify incoming payload data, if appropriate.
yarp::os::Connection::requireAck
virtual bool requireAck() const =0
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
yarp::os::Connection::~Connection
virtual ~Connection()
Destructor.
yarp::os::Connection::prepareDisconnect
virtual void prepareDisconnect()=0
Do cleanup and preparation for the coming disconnect, if necessary.
yarp::os::Connection::isPush
virtual bool isPush() const =0
Check if carrier is "push" or "pull" style.
yarp::os::Connection::supportReply
virtual bool supportReply() const =0
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
yarp::os::Connection::getHeader
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...
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::os::Connection::isConnectionless
virtual bool isConnectionless() const =0
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
yarp::os::Connection::getCarrierParams
virtual void getCarrierParams(yarp::os::Property &params) const =0
Get carrier configuration and deliver it by port administrative commands.
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::os::Connection::modifiesOutgoingData
virtual bool modifiesOutgoingData() const =0
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.
yarp::os::Connection::setCarrierParams
virtual void setCarrierParams(const yarp::os::Property &params)=0
Configure carrier from port administrative commands.
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::Connection
A controller for an individual connection.
Definition: Connection.h:30
yarp::os::Connection::isBroadcast
virtual bool isBroadcast() const =0
Check if this carrier uses a broadcast mechanism.
yarp::os::Connection::modifyOutgoingData
virtual const PortWriter & modifyOutgoingData(const PortWriter &writer)=0
Modify outgoing payload data, if appropriate.
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37