9 #ifndef YARP_OS_PUBLISHER_H
10 #define YARP_OS_PUBLISHER_H
39 buffered_port =
nullptr;
67 bool topic(
const std::string& name)
74 bool open(
const std::string& name)
override
77 return port.
open(name);
81 bool open(
const Contact& contact,
bool registerName =
true)
override
84 return port.
open(contact, registerName);
129 return buffer().prepare();
139 return buffer().unprepare();
152 void write(
bool forceStrict =
false)
154 buffer().write(forceStrict);
168 return buffered_port->getPendingReads();
189 return *buffered_port;
195 if (!buffered_port) {
196 buffered_port =
new BufferedPort<T>(port);
198 return *buffered_port;
205 delete buffered_port;
206 buffered_port =
nullptr;
A mini-server for performing network communication in the background.
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.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::Publisher::write.
virtual ~Publisher()
Destructor.
const Port & asPort() const override
Get the concrete Port being used for communication, const version.
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.
Port & asPort() override
Get the concrete Port being used for communication.
void waitForWrite()
Wait for any pending writes to complete.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
The main, catch-all namespace for YARP.