|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
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;
213 #endif // YARP_OS_PUBLISHER_H
void close() override
Stop port activity.
void setReader(PortReader &reader) override
Set an external reader for port data.
void includeNodeInName(bool flag) override
Choose whether to prepend a node name (if one is available) to the port's name.
bool open(const Contact &contact, bool registerName=true) override
Start port operation with user-chosen network parameters.
void interrupt() override
Interrupt any current reads or writes attached to the port.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A port specialized for publishing data of a constant type on a topic.
virtual ~Publisher()
Destructor.
void resume() override
Put the port back in an operative state after interrupt() has been called.
A mini-server for network communication.
A mini-server for performing network communication in the background.
bool topic(const std::string &name)
Set topic to publish to.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
void write(bool forceStrict=false)
Write the current object being returned by Publisher::prepare.
const Port & asPort() const override
Get the concrete Port being used for communication, const version.
Publisher(const std::string &name="")
Constructor.
Port & asPort() override
Get the concrete Port being used for communication.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void setRpcMode(bool expectRpc) override
Configure the port to be RPC only.
virtual int getPendingReads()
void waitForWrite()
Wait for any pending writes to complete.
The main, catch-all namespace for YARP.
void setOutputMode(bool expectOutput) override
Configure the port to allow or forbid outputs.
bool unprepare()
Give the last prepared object back to YARP without writing it.
void setInputMode(bool expectInput) override
Configure the port to allow or forbid inputs.
void promiseType(const Type &typ) override
Commit the port to a particular type of data.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::Publisher::write.