6#ifndef YARP_OS_PUBLISHER_H
7#define YARP_OS_PUBLISHER_H
35 buffered_port =
nullptr;
63 bool topic(
const std::string& name)
70 bool open(
const std::string& name)
override
73 return port.
open(name);
77 bool open(
const Contact& contact,
bool registerName =
true)
override
80 return port.
open(contact, registerName);
125 return buffer().prepare();
135 return buffer().unprepare();
186 return *buffered_port;
193 if (!buffered_port) {
194 buffered_port =
new BufferedPort<T>(port);
196 return *buffered_port;
201 if (!buffered_port) {
204 delete buffered_port;
205 buffered_port =
nullptr;
A mini-server for performing network communication in the background.
Type getType() override
Get the type of data the port has committed to send/receive.
int getPendingReads() override
Get the number of objects ready to be read.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
A mini-server for network communication.
void setRpcMode(bool expectRpc) override
Configure the port to be RPC only.
void setInputMode(bool expectInput) override
Configure the port to allow or forbid inputs.
void includeNodeInName(bool flag) override
Choose whether to prepend a node name (if one is available) to the port's name.
void promiseType(const Type &typ) override
Commit the port to a particular type of data.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void setOutputMode(bool expectOutput) override
Configure the port to allow or forbid outputs.
A port specialized for publishing data of a constant type on a topic.
void close() override
Stop port activity.
virtual int getPendingReads()
void resume() override
Put the port back in an operative state after interrupt() has been called.
bool topic(const std::string &name)
Set topic to publish to.
void setReader(PortReader &reader) override
Set an external reader for port data.
bool open(const Contact &contact, bool registerName=true) override
Start port operation with user-chosen network parameters.
Publisher(const std::string &name="")
Constructor.
const Port & asPort() const override
Get the concrete Port being used for communication, const version.
virtual ~Publisher()
Destructor.
Port & asPort() override
Get the concrete Port being used for communication.
bool unprepare()
Give the last prepared object back to YARP without writing it.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void write(bool forceStrict=false)
Write the current object being returned by Publisher::prepare.
void waitForWrite()
Wait for any pending writes to complete.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::Publisher::write.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
An interface to the operating system, including Port based communication.