|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
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 // Since YARP 3.3
275 recCallbackLock =
nullptr;
276 old_recCallbackLock = lock;
277 haveCallbackLock =
true;
278 return setCallbackLock(lock);
285 recCallbackLock = lock;
286 #ifndef YARP_NO_DEPRECATED // Since YARP 3.3
287 old_recCallbackLock =
nullptr;
289 haveCallbackLock =
true;
290 return setCallbackLock(lock);
295 recCallbackLock =
nullptr;
296 #ifndef YARP_NO_DEPRECATED // Since YARP 3.3
297 old_recCallbackLock =
nullptr;
299 haveCallbackLock =
false;
300 return removeCallbackLock();
310 return adminReadDelegate;
315 return recReadCreator;
320 return recWaitAfterSend;
331 this->opened = opened;
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
A simple collection of objects that can be described and transmitted in a portable way.
PortCoreAdapter(Port &owner)
void setContactable(Contactable *contactable)
void configAdminReader(PortReader &reader)
PortReaderCreator * checkReadCreator()
void configReadCreator(PortReaderCreator &creator)
void setOpen(bool opened)
virtual bool isValid() const =0
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
static double nowSystem()
A mini-server for network communication.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
An interface for writing to a network connection.
static void delaySystem(double seconds)
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
bool read(ConnectionReader &reader) override
Callback for data.
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
bool unconfigCallbackLock()
An interface for reading from a network connection.
void includeNodeInName(bool flag)
PortReader * checkAdminPortReader()
#define yCError(component,...)
#define yCDebug(component,...)
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Basic wrapper for mutual exclusion.
PortReader * checkPortReader()
bool configCallbackLock(Mutex *lock)
#define YARP_OS_LOG_COMPONENT(name, name_string)
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.
void configWaitAfterSend(bool waitAfterSend)
virtual void requestDrop()=0
Tag the connection to be dropped after the current message.
void configReader(PortReader &reader)
bool reply(PortWriter &writer, bool drop, bool interrupted)