YARP
Yet Another Robot Platform
Carrier.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include <yarp/os/Carrier.h>
11 #include <yarp/os/impl/TcpFace.h>
12 
13 using namespace yarp::os;
14 
16 {
17  return false;
18 }
19 
20 void Carrier::handleEnvelope(const std::string& envelope)
21 {
22  YARP_UNUSED(envelope);
23 }
24 
25 bool Carrier::isPush() const
26 {
27  return true;
28 }
29 
31 {
32  return "tcp";
33 }
34 
35 int Carrier::connect(const Contact& src,
36  const Contact& dest,
37  const ContactStyle& style,
38  int mode,
39  bool reversed)
40 {
41  YARP_UNUSED(src);
42  YARP_UNUSED(dest);
43  YARP_UNUSED(style);
44  YARP_UNUSED(mode);
45  YARP_UNUSED(reversed);
46  return -1;
47 }
48 
50 {
51  return false;
52 }
53 
54 
56 {
57  return reader;
58 }
59 
61 {
62  YARP_UNUSED(reader);
63  return true;
64 }
65 
66 
68 {
69  return false;
70 }
71 
72 
74 {
75  return writer;
76 }
77 
79 {
80  return false;
81 }
82 
84 {
85 }
86 
88 {
89 }
90 
91 Carrier::~Carrier() = default;
92 
94 {
95  return reader;
96 }
97 
99 {
100  YARP_UNUSED(writer);
101  return true;
102 }
103 
104 
106 {
107  YARP_UNUSED(proto);
108  return true;
109 }
110 
112 {
113  YARP_UNUSED(options);
114  return true;
115 }
116 
117 
119 {
120  YARP_UNUSED(params);
121 }
122 
124 {
125  YARP_UNUSED(params);
126 }
127 
129 {
130  return new yarp::os::impl::TcpFace();
131 }
yarp::os::ContactStyle
Preferences for how to communicate with a contact.
Definition: ContactStyle.h:27
yarp::os::Carrier::isBroadcast
bool isBroadcast() const override
Check if this carrier uses a broadcast mechanism.
Definition: Carrier.cpp:15
yarp::os::Carrier::modifiesOutgoingData
bool modifiesOutgoingData() const override
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.
Definition: Carrier.cpp:67
yarp::os::Carrier::~Carrier
virtual ~Carrier()
Destructor.
yarp::os::Carrier::modifyOutgoingData
const PortWriter & modifyOutgoingData(const PortWriter &writer) override
Modify outgoing payload data, if appropriate.
Definition: Carrier.cpp:73
yarp::os::Carrier::configureFromProperty
virtual bool configureFromProperty(yarp::os::Property &options)
Definition: Carrier.cpp:111
yarp::os::Carrier::isPush
bool isPush() const override
Check if carrier is "push" or "pull" style.
Definition: Carrier.cpp:25
YARP_UNUSED
#define YARP_UNUSED(var)
Definition: api.h:159
yarp::os::Carrier::acceptOutgoingData
bool acceptOutgoingData(const PortWriter &writer) override
Determine whether outgoing data should be accepted.
Definition: Carrier.cpp:98
yarp::os::Carrier::prepareDisconnect
void prepareDisconnect() override
Do cleanup and preparation for the coming disconnect, if necessary.
Definition: Carrier.cpp:83
yarp::os::Carrier::setCarrierParams
void setCarrierParams(const Property &params) override
Configure carrier from port administrative commands.
Definition: Carrier.cpp:118
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::Carrier::modifiesReply
bool modifiesReply() const override
Check if this carrier modifies outgoing data through the Carrier::modifyReply method.
Definition: Carrier.cpp:78
yarp::os::impl::TcpFace
Communicating with a port via TCP.
Definition: TcpFace.h:27
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::Carrier::modifiesIncomingData
bool modifiesIncomingData() const override
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.
Definition: Carrier.cpp:49
TcpFace.h
yarp::os::Carrier::handleEnvelope
void handleEnvelope(const std::string &envelope) override
Carriers that do not distinguish data from administrative headers (i.e.
Definition: Carrier.cpp:20
yarp::os::Carrier::modifyIncomingData
ConnectionReader & modifyIncomingData(ConnectionReader &reader) override
Modify incoming payload data, if appropriate.
Definition: Carrier.cpp:55
yarp::os::Carrier::acceptIncomingData
bool acceptIncomingData(ConnectionReader &reader) override
Determine whether incoming data should be accepted.
Definition: Carrier.cpp:60
yarp::os::Carrier::close
virtual void close()
Close the carrier.
Definition: Carrier.cpp:87
yarp::os::Carrier::getBootstrapCarrierName
virtual std::string getBootstrapCarrierName() const
Get the name of the carrier that should be used prior to handshaking, if a port is registered with th...
Definition: Carrier.cpp:30
yarp::os::Carrier::createFace
virtual yarp::os::Face * createFace() const
Create new Face object that the carrier needs.
Definition: Carrier.cpp:128
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::os::Carrier::configure
virtual bool configure(ConnectionState &proto)
Give carrier a shot at looking at how the connection is set up.
Definition: Carrier.cpp:105
yarp::os::ConnectionState
The basic state of a connection - route, streams in use, etc.
Definition: ConnectionState.h:31
Carrier.h
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
yarp::os::Carrier::getCarrierParams
void getCarrierParams(Property &params) const override
Get carrier configuration and deliver it by port administrative commands.
Definition: Carrier.cpp:123
yarp::os::Contact
Represents how to reach a part of a YARP network.
Definition: Contact.h:39
yarp::os::Carrier::connect
virtual int connect(const Contact &src, const Contact &dest, const ContactStyle &style, int mode, bool reversed)
Some carrier types may require special connection logic.
Definition: Carrier.cpp:35
yarp::os::Carrier::modifyReply
PortReader & modifyReply(PortReader &reader) override
Modify reply payload data, if appropriate.
Definition: Carrier.cpp:93
yarp::os::Face
The initial point-of-contact with a port.
Definition: Face.h:24
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37