YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
AbstractContactable.cpp
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
7#include <yarp/os/Type.h>
8
9bool yarp::os::AbstractContactable::open(const std::string& name)
10{
11 return asPort().open(name);
12}
13
15 bool registerName)
16{
17 return asPort().open(contact, registerName);
18}
19
20bool yarp::os::AbstractContactable::addOutput(const std::string& name)
21{
22 return asPort().addOutput(name);
23}
25bool yarp::os::AbstractContactable::addOutput(const std::string& name,
26 const std::string& carrier)
27{
28 return asPort().addOutput(name, carrier);
29}
30
32{
33 return asPort().addOutput(contact);
34}
35
37{
38 asPort().close();
39}
40
45
47{
48 asPort().resume();
49}
50
52{
53 return asPort().where();
54}
55
57{
58 return asPort().getName();
59}
60
62{
63 return asPort().setEnvelope(envelope);
64}
65
67{
68 return asPort().getEnvelope(envelope);
69}
70
75
80
85
90
95
97{
98 return asPort().isWriting();
99}
100
102{
103 asPort().setReader(reader);
104}
105
107{
108 asPort().setAdminReader(reader);
109}
110
115
120
122{
124}
125
127{
128 return asPort().getType();
129}
130
135
137{
138 return asPort().acquireProperties(readOnly);
139}
140
145
147 const PortWriter* callback) const
148{
149 return asPort().write(writer, callback);
150}
151
153 PortReader& reader,
154 const PortWriter* callback) const
155{
156 return asPort().write(writer, reader, callback);
157}
158
160 bool willReply)
161{
162 return asPort().read(reader, willReply);
163}
164
166{
167 return asPort().reply(writer);
168}
169
171{
172 return asPort().replyAndDrop(writer);
173}
174
179
181{
182 return asPort().setCallbackLock(mutex);
183}
184
189
191{
192 return asPort().lockCallback();
193}
194
199
int getInputCount() override
Determine how many connections are arriving into this port.
void unlockCallback() override
Unlock callbacks.
bool reply(PortWriter &writer) override
Send an object as a reply to an object read from the port.
bool lockCallback() override
Lock callbacks until unlockCallback() is called.
Type getType() override
Get the type of data the port has committed to send/receive.
void setAdminReader(PortReader &reader) override
Set an external reader for unrecognized administrative port messages.
void setRpcMode(bool expectRpc) override
Configure the port to be RPC only.
void resetReporter() override
Remove the callback which is called upon any future connections and disconnections to/from the port.
int getOutputCount() override
Determine how many output connections this port has.
bool isWriting() override
Report whether the port is currently writing data.
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
void releaseProperties(Property *prop) override
End access unstructured port properties.
bool getEnvelope(PortReader &envelope) override
Get the envelope information (e.g., a timestamp) from the last message received on the port.
bool removeCallbackLock() override
Remove a lock on callbacks added with setCallbackLock()
void setReporter(PortReport &reporter) override
Set a callback to be called upon any future connections and disconnections to/from the port.
void resume() override
Put the port back in an operative state after interrupt() has been called.
bool replyAndDrop(PortWriter &writer) override
Same as reply(), but closes connection after reply.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
bool setCallbackLock(std::mutex *mutex=nullptr) override
Add a lock to use when invoking callbacks.
void includeNodeInName(bool flag) override
Choose whether to prepend a node name (if one is available) to the port's name.
Contact where() const override
Returns information about how this port can be reached.
std::string getName() const override
Get name of port.
void setOutputMode(bool expectOutput) override
Configure the port to allow or forbid outputs.
virtual Port & asPort()=0
Get the concrete Port being used for communication.
bool addOutput(const std::string &name) override
Add an output connection to the specified port.
void promiseType(const Type &typ) override
Commit the port to a particular type of data.
void setReader(PortReader &reader) override
Set an external reader for port data.
void close() override
Stop port activity.
void getReport(PortReport &reporter) override
Get information on the state of the port - connections etc.
Property * acquireProperties(bool readOnly) override
Access unstructured port properties.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void setInputMode(bool expectInput) override
Configure the port to allow or forbid inputs.
bool tryLockCallback() override
Try to lock callbacks until unlockCallback() is called.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
bool read(PortReader &reader, bool willReply=false) override
Read an object from the port.
A mini-server for performing network communication in the background.
bool removeCallbackLock() override
Remove a lock on callbacks added with setCallbackLock()
void setRpcMode(bool expectRpc) override
Configure the port to be RPC only.
void promiseType(const Type &typ) override
Commit the port to a particular type of data.
void includeNodeInName(bool flag) override
Choose whether to prepend a node name (if one is available) to the port's name.
void resume() override
Put the port back in an operative state after interrupt() has been called.
void setAdminReader(PortReader &reader) override
Set an external reader for unrecognized administrative port messages.
bool tryLockCallback() override
Try to lock callbacks until unlockCallback() is called.
bool getEnvelope(PortReader &envelope) override
Get the envelope information (e.g., a timestamp) from the last message received on the port.
bool setCallbackLock(std::mutex *mutex) override
Add a lock to use when invoking callbacks.
void close() override
Stop port activity.
void releaseProperties(Property *prop) override
End access unstructured port properties.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
void setReader(PortReader &reader) override
Set an external reader for port data.
void setOutputMode(bool expectOutput) override
Configure the port to allow or forbid outputs.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void setReporter(PortReport &reporter) override
Set a callback to be called upon any future connections and disconnections to/from the port.
int getInputCount() override
Determine how many connections are arriving into this port.
bool isWriting() override
Report whether the port is currently writing data.
void getReport(PortReport &reporter) override
Get information on the state of the port - connections etc.
T * read(bool shouldWait=true) override
Read an available object from the port.
bool addOutput(const std::string &name) override
Add an output connection to the specified port.
bool lockCallback() override
Lock callbacks until unlockCallback() is called.
int getOutputCount() override
Determine how many output connections this port has.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
void resetReporter() override
Remove the callback which is called upon any future connections and disconnections to/from the port.
void setInputMode(bool expectInput) override
Configure the port to allow or forbid inputs.
void unlockCallback() override
Unlock callbacks.
Represents how to reach a part of a YARP network.
Definition Contact.h:33
std::string getName() const
Get the name associated with this Contact.
Definition Contact.cpp:205
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
A base class for objects that want information about port status changes.
Definition PortReport.h:25
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