62 if (!readBackground) {
81 yCError(PORTCOREADAPTER,
"Closing port that was sending data (slowly)");
89 while (produce.check()) {
91 while (readBlock.check()) {
99 if (permanentReadDelegate !=
nullptr) {
100 bool result = permanentReadDelegate->read(reader);
110 if (readDelegate !=
nullptr) {
111 readResult = readDelegate->read(reader);
120 yCDebug(PORTCOREADAPTER,
"Port::read shutting down");
126 if (!readBackground) {
132 if (readDelegate !=
nullptr) {
133 readResult = readDelegate->read(reader);
136 yCDebug(PORTCOREADAPTER,
"data received in Port, no reader for it");
140 if (!readBackground) {
141 readDelegate =
nullptr;
142 writeDelegate =
nullptr;
144 bool result = readResult;
146 if (!readBackground) {
149 if (result && willReply) {
152 yCDebug(PORTCOREADAPTER,
"Port::read shutting down");
156 if (writeDelegate !=
nullptr) {
159 if (writer !=
nullptr) {
160 result = readResult = writeDelegate->write(*writer);
181 reply(emptyMessage,
false,
false);
191 readDelegate = &reader;
193 writeDelegate =
nullptr;
194 this->willReply = willReply;
200 if (!readBackground) {
201 readDelegate =
nullptr;
203 bool result = readResult;
220 writeDelegate = &writer;
223 bool result = readResult;
236 readBackground =
true;
237 readDelegate = &reader;
238 permanentReadDelegate = &reader;
247 adminReadDelegate = &reader;
248 setAdminReadHandler(reader);
254 recReadCreator = &creator;
255 setReadCreator(creator);
260 if (waitAfterSend && isManual()) {
261 yCError(PORTCOREADAPTER,
"Cannot use background-mode writes on a fake port");
263 recWaitAfterSend = waitAfterSend ? 1 : 0;
264 setWaitAfterSend(waitAfterSend);
267 #ifndef YARP_NO_DEPRECATED
272 recCallbackLock =
nullptr;
273 old_recCallbackLock = lock;
274 haveCallbackLock =
true;
275 return setCallbackLock(lock);
282 recCallbackLock = lock;
283 #ifndef YARP_NO_DEPRECATED
284 old_recCallbackLock =
nullptr;
286 haveCallbackLock =
true;
287 return setCallbackLock(lock);
292 recCallbackLock =
nullptr;
293 #ifndef YARP_NO_DEPRECATED
294 old_recCallbackLock =
nullptr;
296 haveCallbackLock =
false;
297 return removeCallbackLock();
307 return adminReadDelegate;
312 return recReadCreator;
317 return recWaitAfterSend;
328 this->opened = opened;
A simple collection of objects that can be described and transmitted in a portable way.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
An interface for reading from a network connection.
virtual void requestDrop()=0
Tag the connection to be dropped after the current message.
virtual bool isValid() const =0
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
An interface for writing to a network connection.
Basic wrapper for mutual exclusion.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
A mini-server for network communication.
static double nowSystem()
static void delaySystem(double seconds)
PortReaderCreator * checkReadCreator()
void includeNodeInName(bool flag)
void configWaitAfterSend(bool waitAfterSend)
void configReadCreator(PortReaderCreator &creator)
void configAdminReader(PortReader &reader)
bool configCallbackLock(Mutex *lock)
bool reply(PortWriter &writer, bool drop, bool interrupted)
PortReader * checkAdminPortReader()
PortReader * checkPortReader()
PortCoreAdapter(Port &owner)
bool unconfigCallbackLock()
void configReader(PortReader &reader)
void setOpen(bool opened)
bool read(ConnectionReader &reader) override
Callback for data.
void setContactable(Contactable *contactable)
#define yCError(component,...)
#define yCDebug(component,...)
#define YARP_OS_LOG_COMPONENT(name, name_string)
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.