24 PortWriterBufferManager::~PortWriterBufferManager() =
default;
52 int ct = packets.getCount();
59 yCDebug(PORTWRITERBUFFERBASE,
"finishing writes");
63 if (port !=
nullptr) {
64 if (!port->isOpen()) {
74 completionSema.wait();
77 yCDebug(PORTWRITERBUFFERBASE,
"finished writes");
82 if (callback !=
nullptr) {
86 yCDebug(PORTWRITERBUFFERBASE,
"releasing unused buffer");
91 yCAssert(PORTWRITERBUFFERBASE, packet !=
nullptr);
93 yCDebug(PORTWRITERBUFFERBASE,
"creating a writer buffer");
95 yarp::os::PortWriterWrapper* wrapper = owner.create(*
this, packet);
97 packet->
setContent(wrapper->getInternal(),
false, wrapper,
true);
113 if (cback !=
nullptr) {
119 return cback !=
nullptr;
125 yCDebug(PORTWRITERBUFFERBASE,
"freeing up a writer buffer");
128 bool sig = finishing;
132 completionSema.post();
161 if (active !=
nullptr && port !=
nullptr) {
165 port->
write(*active, cback);
201 return mPriv->release();
207 return mPriv->getCount();
222 mPriv->write(strict);
227 mPriv->finishWrites();
void onCompletion(void *tracker) override
Private(PortWriterBufferBase &owner)
const void * getContent() const
virtual ~PortWriterBufferBase()
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
virtual void onCompletion() const
This is called when the port has finished all writing operations.
A mini-server for network communication.
void enableBackgroundWrite(bool backgroundFlag)
control whether writing from this port is done in the background.
A class for thread synchronization and mutual exclusion.
A single message, potentially being transmitted on multiple connections.
void setContent(const yarp::os::PortWriter *writable, bool owned=false, const yarp::os::PortWriter *callback=nullptr, bool ownedCallback=false)
Configure the object being sent and where to send notifications.
const yarp::os::PortWriter * getContent()
const yarp::os::PortWriter * getCallback()
A collection of messages being transmitted over connections.
#define yCAssert(component, x)
#define yCDebug(component,...)
#define YARP_OS_LOG_COMPONENT(name, name_string)
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.