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 }
yarp::os::NullConnection
Definition: NullConnection.h:20
NullConnection.h
yarp::os::NullConnection::modifiesIncomingData
bool modifiesIncomingData() const override
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.
Definition: NullConnection.cpp:65
yarp::os::NullConnection::handleEnvelope
void handleEnvelope(const std::string &envelope) override
Carriers that do not distinguish data from administrative headers (i.e.
Definition: NullConnection.cpp:32
yarp::os::NullConnection::getHeader
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...
Definition: NullConnection.cpp:117
yarp::os::NullConnection::isBroadcast
bool isBroadcast() const override
Check if this carrier uses a broadcast mechanism.
Definition: NullConnection.cpp:56
yarp::os::Time::isValid
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
yarp::os::NullConnection::modifiesOutgoingData
bool modifiesOutgoingData() const override
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.
Definition: NullConnection.cpp:81
yarp::os::NullConnection::isConnectionless
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
Definition: NullConnection.cpp:52
yarp::os::NullConnection::acceptIncomingData
bool acceptIncomingData(yarp::os::ConnectionReader &reader) override
Determine whether incoming data should be accepted.
Definition: NullConnection.cpp:75
yarp::os::NullConnection::modifyIncomingData
yarp::os::ConnectionReader & modifyIncomingData(yarp::os::ConnectionReader &reader) override
Modify incoming payload data, if appropriate.
Definition: NullConnection.cpp:70
YARP_UNUSED
#define YARP_UNUSED(var)
Definition: api.h:159
yarp::os::NullConnection::supportReply
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
Definition: NullConnection.cpp:40
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
PortWriter.h
yarp::os::NullConnection::setCarrierParams
void setCarrierParams(const yarp::os::Property &params) override
Configure carrier from port administrative commands.
Definition: NullConnection.cpp:107
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::NullConnection::getName
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
Definition: NullConnection.cpp:128
yarp::os::Bytes::get
const char * get() const
Definition: Bytes.cpp:30
yarp::os::Bytes::length
size_t length() const
Definition: Bytes.cpp:25
yarp::os::NullConnection::isActive
bool isActive() const override
Check if carrier is alive and error free.
Definition: NullConnection.cpp:60
yarp::os::NullConnection::isPush
bool isPush() const override
Check if carrier is "push" or "pull" style.
Definition: NullConnection.cpp:48
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::os::NullConnection::requireAck
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
Definition: NullConnection.cpp:36
yarp::os::NullConnection::modifiesReply
bool modifiesReply() const override
Check if this carrier modifies outgoing data through the Carrier::modifyReply method.
Definition: NullConnection.cpp:97
yarp::os::NullConnection::canEscape
bool canEscape() const override
Check if carrier can encode administrative messages, as opposed to just user data.
Definition: NullConnection.cpp:28
yarp::os::NullConnection::getCarrierParams
void getCarrierParams(yarp::os::Property &params) const override
Get carrier configuration and deliver it by port administrative commands.
Definition: NullConnection.cpp:112
Bytes.h
PortReader.h
yarp::os::NullConnection::isTextMode
bool isTextMode() const override
Check if carrier is textual in nature.
Definition: NullConnection.cpp:24
yarp::os::NullConnection::isLocal
bool isLocal() const override
Check if carrier operates within a single process.
Definition: NullConnection.cpp:44
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37
yarp::os::NullConnection::modifyReply
PortReader & modifyReply(PortReader &reader) override
Modify reply payload data, if appropriate.
Definition: NullConnection.cpp:102
yarp::os::NullConnection::prepareDisconnect
void prepareDisconnect() override
Do cleanup and preparation for the coming disconnect, if necessary.
Definition: NullConnection.cpp:124
yarp::os::NullConnection::acceptOutgoingData
bool acceptOutgoingData(const PortWriter &writer) override
Determine whether outgoing data should be accepted.
Definition: NullConnection.cpp:91
yarp::os::NullConnection::modifyOutgoingData
const PortWriter & modifyOutgoingData(const PortWriter &writer) override
Modify outgoing payload data, if appropriate.
Definition: NullConnection.cpp:86