YARP
Yet Another Robot Platform
NullConnection.cpp
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 
10 
11 #include <yarp/os/Bytes.h>
12 #include <yarp/os/PortReader.h>
13 #include <yarp/os/PortWriter.h>
14 
18 
19 
21 {
22  return false;
23 }
25 {
26  return true;
27 }
29 {
30  return true;
31 }
32 void NullConnection::handleEnvelope(const std::string& envelope)
33 {
34  YARP_UNUSED(envelope);
35 }
37 {
38  return false;
39 }
41 {
42  return false;
43 }
45 {
46  return false;
47 }
49 {
50  return true;
51 }
53 {
54  return false;
55 }
57 {
58  return false;
59 }
61 {
62  return false;
63 }
64 
66 {
67  return false;
68 }
69 
71 {
72  return reader;
73 }
74 
76 {
77  YARP_UNUSED(reader);
78  return true;
79 }
80 
82 {
83  return false;
84 }
85 
87 {
88  return writer;
89 }
90 
92 {
93  YARP_UNUSED(writer);
94  return true;
95 }
96 
98 {
99  return false;
100 }
101 
103 {
104  return reader;
105 }
106 
108 {
109  YARP_UNUSED(params);
110 }
111 
113 {
114  YARP_UNUSED(params);
115 }
116 
118 {
119  for (size_t i = 0; i < header.length(); i++) {
120  header.get()[i] = '\0';
121  }
122 }
123 
125 {
126 }
127 
128 std::string NullConnection::getName() const
129 {
130  return "null";
131 }
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
size_t length() const
Definition: Bytes.cpp:25
const char * get() const
Definition: Bytes.cpp:30
An interface for reading from a network connection.
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
void handleEnvelope(const std::string &envelope) override
Carriers that do not distinguish data from administrative headers (i.e.
bool acceptOutgoingData(const PortWriter &writer) override
Determine whether outgoing data should be accepted.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
bool isActive() const override
Check if carrier is alive and error free.
bool isLocal() const override
Check if carrier operates within a single process.
bool acceptIncomingData(yarp::os::ConnectionReader &reader) override
Determine whether incoming data should be accepted.
bool modifiesReply() const override
Check if this carrier modifies outgoing data through the Carrier::modifyReply method.
bool canEscape() const override
Check if carrier can encode administrative messages, as opposed to just user data.
bool isPush() const override
Check if carrier is "push" or "pull" style.
const PortWriter & modifyOutgoingData(const PortWriter &writer) override
Modify outgoing payload data, if appropriate.
bool isTextMode() const override
Check if carrier is textual in nature.
void prepareDisconnect() override
Do cleanup and preparation for the coming disconnect, if necessary.
void setCarrierParams(const yarp::os::Property &params) override
Configure carrier from port administrative commands.
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
yarp::os::ConnectionReader & modifyIncomingData(yarp::os::ConnectionReader &reader) override
Modify incoming payload data, if appropriate.
void getHeader(yarp::os::Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
void getCarrierParams(yarp::os::Property &params) const override
Get carrier configuration and deliver it by port administrative commands.
PortReader & modifyReply(PortReader &reader) override
Modify reply payload data, if appropriate.
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
bool modifiesOutgoingData() const override
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.
bool modifiesIncomingData() const override
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.
bool isBroadcast() const override
Check if this carrier uses a broadcast mechanism.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
A class for storing options and configuration information.
Definition: Property.h:37
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
#define YARP_UNUSED(var)
Definition: api.h:159