65 if (!readBackground) {
84 yCError(PORTCOREADAPTER,
"Closing port that was sending data (slowly)");
92 while (produce.check()) {
94 while (readBlock.check()) {
102 if (permanentReadDelegate !=
nullptr) {
103 bool result = permanentReadDelegate->read(reader);
113 if (readDelegate !=
nullptr) {
114 readResult = readDelegate->read(reader);
123 yCDebug(PORTCOREADAPTER,
"Port::read shutting down");
129 if (!readBackground) {
135 if (readDelegate !=
nullptr) {
136 readResult = readDelegate->read(reader);
139 yCDebug(PORTCOREADAPTER,
"data received in Port, no reader for it");
143 if (!readBackground) {
144 readDelegate =
nullptr;
145 writeDelegate =
nullptr;
147 bool result = readResult;
149 if (!readBackground) {
152 if (result && willReply) {
155 yCDebug(PORTCOREADAPTER,
"Port::read shutting down");
159 if (writeDelegate !=
nullptr) {
162 if (writer !=
nullptr) {
163 result = readResult = writeDelegate->write(*writer);
184 reply(emptyMessage,
false,
false);
194 readDelegate = &reader;
196 writeDelegate =
nullptr;
197 this->willReply = willReply;
203 if (!readBackground) {
204 readDelegate =
nullptr;
206 bool result = readResult;
223 writeDelegate = &writer;
226 bool result = readResult;
239 readBackground =
true;
240 readDelegate = &reader;
241 permanentReadDelegate = &reader;
250 adminReadDelegate = &reader;
251 setAdminReadHandler(reader);
257 recReadCreator = &creator;
258 setReadCreator(creator);
263 if (waitAfterSend && isManual()) {
264 yCError(PORTCOREADAPTER,
"Cannot use background-mode writes on a fake port");
266 recWaitAfterSend = waitAfterSend ? 1 : 0;
267 setWaitAfterSend(waitAfterSend);
270 #ifndef YARP_NO_DEPRECATED
275 recCallbackLock =
nullptr;
276 old_recCallbackLock = lock;
277 haveCallbackLock =
true;
278 return setCallbackLock(lock);
285 recCallbackLock = lock;
286 #ifndef YARP_NO_DEPRECATED
287 old_recCallbackLock =
nullptr;
289 haveCallbackLock =
true;
290 return setCallbackLock(lock);
295 recCallbackLock =
nullptr;
296 #ifndef YARP_NO_DEPRECATED
297 old_recCallbackLock =
nullptr;
299 haveCallbackLock =
false;
300 return removeCallbackLock();
310 return adminReadDelegate;
315 return recReadCreator;
320 return recWaitAfterSend;
331 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.