#include <yarp/os/impl/PortCore.h>
Inheritance diagram for yarp::os::impl::PortCore:Public Member Functions | |
| PortCore () | |
| Constructor. | |
| ~PortCore () | |
| Destructor. | |
| bool | addOutput (const std::string &dest, void *id, yarp::os::OutputStream *os, bool onlyIfNeeded=false) |
| Add an output connection to this port. | |
| void | addOutput (OutputProtocol *op) |
| Add another output to the port. | |
| bool | removeInput (const std::string &src, void *id, yarp::os::OutputStream *os) |
| Remove an input connection. | |
| bool | removeOutput (const std::string &dest, void *id, yarp::os::OutputStream *os) |
| Remove an output connection. | |
| bool | removeIO (const Route &route, bool synch=false) |
| Remove any connection matching the supplied route. | |
| void | describe (void *id, yarp::os::OutputStream *os) |
| Produce a text description of the port and its connections. | |
| void | describe (yarp::os::PortReport &reporter) |
| Generate a description of the connections associated with the port. | |
| bool | readBlock (ConnectionReader &reader, void *id, yarp::os::OutputStream *os) |
| Read a block of regular payload data. | |
| bool | adminBlock (ConnectionReader &reader, void *id) |
| Read a block of administrative data. | |
| void | setName (const std::string &name) |
| Set the name of this port. | |
| std::string | getName () |
| void | setEnvelope (const std::string &envelope) |
| Set some envelope information to pass along with a message without actually being part of the message. | |
| bool | setEnvelope (yarp::os::PortWriter &envelope) |
| Set some extra meta data to pass along with the message. | |
| std::string | getEnvelope () |
| bool | getEnvelope (yarp::os::PortReader &envelope) |
| Get any meta data associated with the last message received. | |
| void | report (const yarp::os::PortInfo &info) |
| Handle a port event (connection, disconnection, etc) Generate a description of the connections associated with the port. | |
| void | reportUnit (PortCoreUnit *unit, bool active) |
| Called by a connection handler with active=true just after it is fully configured, and with active=false just before it shuts itself down. | |
| void | setFlags (unsigned int flags) |
| Configure the port to meet certain restrictions in behavior. | |
| void | setContactable (Contactable *contactable) |
| unsigned int | getFlags () |
| Check current configuration of port. | |
| bool | listen (const Contact &address, bool shouldAnnounce=true) |
| Begin service at a given address. | |
| bool | isWriting () |
| Check if a message is currently being sent. | |
| int | getInputCount () |
| Check how many input connections there are. | |
| int | getOutputCount () |
| Check how many output connections there are. | |
| void | setReadHandler (yarp::os::PortReader &reader) |
| Set a callback for incoming data. | |
| void | setAdminReadHandler (yarp::os::PortReader &reader) |
| Set a callback for incoming administrative messages. | |
| void | setReadCreator (yarp::os::PortReaderCreator &creator) |
| Set a callback for creating callbacks for incoming data. | |
| void | setWaitBeforeSend (bool waitBeforeSend) |
| Upon being asked to send a message, should we wait for any existing message to be sent to all destinations? | |
| void | setWaitAfterSend (bool waitAfterSend) |
| After sending a message, should we wait for it to be sent to all destinations before returning? | |
| bool | read (yarp::os::ConnectionReader &reader) override |
| Callback for data. | |
| bool | start () override |
| Begin main thread. | |
| bool | manualStart (const char *sourceName) |
| Start up the port, but without a main thread. | |
| bool | send (const yarp::os::PortWriter &writer, yarp::os::PortReader *reader=nullptr, const yarp::os::PortWriter *callback=nullptr) |
| Send a normal message. | |
| bool | sendHelper (const yarp::os::PortWriter &writer, int mode, yarp::os::PortReader *reader=nullptr, const yarp::os::PortWriter *callback=nullptr) |
| Send a message with a specific mode (normal or log). | |
| void | close () override |
| Shut down port. | |
| void | run () override |
| The body of the main thread. | |
| int | getEventCount () |
| A diagnostic for testing purposes. | |
| const Contact & | getAddress () const |
| Get the address associated with the port. | |
| void | resetPortName (const std::string &str) |
| yarp::os::PortReaderCreator * | getReadCreator () |
| Get the creator of callbacks. | |
| void | notifyCompletion (void *tracker) |
| Call the right onCompletion() after sending message. | |
| void | setControlRegistration (bool flag) |
| Normally the port will unregister its name with the name server when shutting down. | |
| void | interrupt () |
| Prepare the port to be shut down. | |
| void | resume () |
| Undo an interrupt() | |
| void | setReportCallback (yarp::os::PortReport *reporter) |
| Set a callback to be notified of changes in port status. | |
| void | resetReportCallback () |
| Reset the callback to be notified of changes in port status. | |
| bool | isListening () const |
| bool | isManual () const |
| bool | isInterrupted () const |
| void | setTimeout (float timeout) |
| bool | setCallbackLock (std::mutex *mutex=nullptr) |
| bool | removeCallbackLock () |
| bool | lockCallback () |
| bool | tryLockCallback () |
| void | unlockCallback () |
| yarp::os::impl::PortDataModifier & | getPortModifier () |
| void | checkType (PortReader &reader) |
| yarp::os::Type | getType () |
| void | promiseType (const Type &typ) |
Public Member Functions inherited from yarp::os::impl::ThreadImpl | |
| virtual | ~ThreadImpl () |
| int | join (double seconds=-1) |
| void | askToClose () |
| bool | isClosing () |
| bool | isRunning () |
| virtual void | beforeStart () |
| virtual void | afterStart (bool success) |
| virtual bool | threadInit () |
| virtual void | threadRelease () |
| long int | getKey () |
| void | notify (bool s) |
| void | notifyOpened (bool s) |
| void | synchroWait () |
| void | synchroPost () |
| int | setPriority (int priority=-1, int policy=-1) |
| int | getPriority () |
| int | getPolicy () |
| long | getTid () |
Public Member Functions inherited from yarp::os::PortReader | |
| virtual | ~PortReader () |
| Destructor. | |
| virtual Type | getReadType () const |
Additional Inherited Members | |
Static Public Member Functions inherited from yarp::os::impl::ThreadImpl | |
| static int | getCount () |
| static long int | getKeyOfCaller () |
| static void | yield () |
Public Attributes inherited from yarp::os::impl::ThreadImpl | |
| long | tid {-1} |
| std::thread::id | id |
Definition at line 141 of file PortCore.h.
|
default |
Constructor.
| PortCore::~PortCore | ( | ) |
Destructor.
Definition at line 64 of file PortCore.cpp.
| bool PortCore::addOutput | ( | const std::string & | dest, |
| void * | id, | ||
| yarp::os::OutputStream * | os, | ||
| bool | onlyIfNeeded = false |
||
| ) |
Add an output connection to this port.
| dest | the name of the target |
| id | an opaque tracker for the connection |
| os | the output stream for messages about this operation |
| onlyIfNeeded | if true, don't add the connection if there is already a connection to the named target |
Definition at line 841 of file PortCore.cpp.
| void PortCore::addOutput | ( | OutputProtocol * | op | ) |
Add another output to the port.
Definition at line 696 of file PortCore.cpp.
| bool PortCore::adminBlock | ( | ConnectionReader & | reader, |
| void * | id | ||
| ) |
Read a block of administrative data.
Process an administrative message.
| reader | source of data |
| id | opaque identifier of connection providing data |
Definition at line 1530 of file PortCore.cpp.
| void PortCore::checkType | ( | PortReader & | reader | ) |
Definition at line 2257 of file PortCore.cpp.
|
overridevirtual |
Shut down port.
Reimplemented from yarp::os::impl::ThreadImpl.
Definition at line 267 of file PortCore.cpp.
| void PortCore::describe | ( | void * | id, |
| yarp::os::OutputStream * | os | ||
| ) |
Produce a text description of the port and its connections.
| id | opaque identifier of connection that needs the description |
| os | stream to write on |
Definition at line 1051 of file PortCore.cpp.
| void PortCore::describe | ( | yarp::os::PortReport & | reporter | ) |
Generate a description of the connections associated with the port.
Definition at line 1109 of file PortCore.cpp.
Get the address associated with the port.
Definition at line 2164 of file PortCore.cpp.
| std::string PortCore::getEnvelope | ( | ) |
Definition at line 1474 of file PortCore.cpp.
| bool PortCore::getEnvelope | ( | yarp::os::PortReader & | envelope | ) |
Get any meta data associated with the last message received.
Definition at line 1479 of file PortCore.cpp.
| int PortCore::getEventCount | ( | ) |
A diagnostic for testing purposes.
Definition at line 531 of file PortCore.cpp.
Check current configuration of port.
Definition at line 300 of file PortCore.h.
| int PortCore::getInputCount | ( | ) |
Check how many input connections there are.
Definition at line 1417 of file PortCore.cpp.
| std::string PortCore::getName | ( | ) |
Definition at line 2149 of file PortCore.cpp.
| int PortCore::getOutputCount | ( | ) |
Check how many output connections there are.
Definition at line 1426 of file PortCore.cpp.
| yarp::os::impl::PortDataModifier & PortCore::getPortModifier | ( | ) |
Definition at line 2252 of file PortCore.cpp.
| yarp::os::PortReaderCreator * PortCore::getReadCreator | ( | ) |
Get the creator of callbacks.
Definition at line 2174 of file PortCore.cpp.
| yarp::os::Type PortCore::getType | ( | ) |
Definition at line 2269 of file PortCore.cpp.
| void PortCore::interrupt | ( | ) |
Prepare the port to be shut down.
Definition at line 330 of file PortCore.cpp.
| bool PortCore::isInterrupted | ( | ) | const |
Definition at line 2194 of file PortCore.cpp.
| bool PortCore::isListening | ( | ) | const |
Definition at line 2184 of file PortCore.cpp.
| bool PortCore::isManual | ( | ) | const |
Definition at line 2189 of file PortCore.cpp.
| bool PortCore::isWriting | ( | ) |
Check if a message is currently being sent.
Definition at line 1398 of file PortCore.cpp.
Begin service at a given address.
Definition at line 71 of file PortCore.cpp.
| bool PortCore::lockCallback | ( | ) |
Definition at line 2227 of file PortCore.cpp.
Start up the port, but without a main thread.
Definition at line 307 of file PortCore.cpp.
Call the right onCompletion() after sending message.
Definition at line 1436 of file PortCore.cpp.
Definition at line 2277 of file PortCore.cpp.
|
inlineoverridevirtual |
Callback for data.
Implements yarp::os::PortReader.
Reimplemented in yarp::os::impl::PortCoreAdapter.
Definition at line 361 of file PortCore.h.
| bool PortCore::readBlock | ( | ConnectionReader & | reader, |
| void * | id, | ||
| yarp::os::OutputStream * | os | ||
| ) |
Read a block of regular payload data.
| reader | source of data |
| id | opaque identifier of connection providing data |
| os | stream to write error messages on |
Definition at line 1202 of file PortCore.cpp.
| bool PortCore::removeCallbackLock | ( | ) |
Definition at line 2217 of file PortCore.cpp.
| bool PortCore::removeInput | ( | const std::string & | src, |
| void * | id, | ||
| yarp::os::OutputStream * | os | ||
| ) |
Remove an input connection.
| src | the name of the source port |
| id | an opaque tracker for the connection |
| os | the output stream for messages about this operation |
Definition at line 1031 of file PortCore.cpp.
Remove any connection matching the supplied route.
| route | the source/target/carrier associated with the connection |
| synch | true if we should wait for removal to complete |
Definition at line 2139 of file PortCore.cpp.
| bool PortCore::removeOutput | ( | const std::string & | dest, |
| void * | id, | ||
| yarp::os::OutputStream * | os | ||
| ) |
Remove an output connection.
| dest | the name of the target port |
| id | an opaque tracker for the connection |
| os | the output stream for messages about this operation |
Definition at line 1011 of file PortCore.cpp.
| void PortCore::report | ( | const yarp::os::PortInfo & | info | ) |
Handle a port event (connection, disconnection, etc) Generate a description of the connections associated with the port.
| info | the event description |
Definition at line 1188 of file PortCore.cpp.
| void PortCore::reportUnit | ( | PortCoreUnit * | unit, |
| bool | active | ||
| ) |
Called by a connection handler with active=true just after it is fully configured, and with active=false just before it shuts itself down.
| unit | the connection handler starting up / shutting down |
| active | true if the handler is starting up, false if shutting down |
Definition at line 2084 of file PortCore.cpp.
Definition at line 2169 of file PortCore.cpp.
| void PortCore::resetReportCallback | ( | ) |
Reset the callback to be notified of changes in port status.
Definition at line 1182 of file PortCore.cpp.
| void PortCore::resume | ( | ) |
Undo an interrupt()
Definition at line 324 of file PortCore.cpp.
|
overridevirtual |
The body of the main thread.
Reimplemented from yarp::os::impl::ThreadImpl.
Definition at line 168 of file PortCore.cpp.
| bool PortCore::send | ( | const yarp::os::PortWriter & | writer, |
| yarp::os::PortReader * | reader = nullptr, |
||
| const yarp::os::PortWriter * | callback = nullptr |
||
| ) |
Send a normal message.
| writer | the message |
| reader | where to direct replies |
| callback | who to call onCompletion() on when message sent. |
Definition at line 1251 of file PortCore.cpp.
| bool PortCore::sendHelper | ( | const yarp::os::PortWriter & | writer, |
| int | mode, | ||
| yarp::os::PortReader * | reader = nullptr, |
||
| const yarp::os::PortWriter * | callback = nullptr |
||
| ) |
Send a message with a specific mode (normal or log).
| writer | the message |
| reader | where to direct replies |
| callback | who to call onCompletion() on when message sent. |
Definition at line 1275 of file PortCore.cpp.
| void PortCore::setAdminReadHandler | ( | yarp::os::PortReader & | reader | ) |
Set a callback for incoming administrative messages.
Definition at line 151 of file PortCore.cpp.
| bool PortCore::setCallbackLock | ( | std::mutex * | mutex = nullptr | ) |
Definition at line 2204 of file PortCore.cpp.
|
inline |
Definition at line 292 of file PortCore.h.
Normally the port will unregister its name with the name server when shutting down.
This can be inhibited.
Definition at line 2179 of file PortCore.cpp.
Set some envelope information to pass along with a message without actually being part of the message.
| envelope | the extra message to send |
Definition at line 1460 of file PortCore.cpp.
| bool PortCore::setEnvelope | ( | yarp::os::PortWriter & | envelope | ) |
Set some extra meta data to pass along with the message.
Definition at line 1449 of file PortCore.cpp.
Configure the port to meet certain restrictions in behavior.
Definition at line 287 of file PortCore.h.
Set the name of this port.
| name | the name of this port |
Definition at line 2144 of file PortCore.cpp.
| void PortCore::setReadCreator | ( | yarp::os::PortReaderCreator & | creator | ) |
Set a callback for creating callbacks for incoming data.
Definition at line 159 of file PortCore.cpp.
| void PortCore::setReadHandler | ( | yarp::os::PortReader & | reader | ) |
Set a callback for incoming data.
Definition at line 143 of file PortCore.cpp.
| void PortCore::setReportCallback | ( | yarp::os::PortReport * | reporter | ) |
Set a callback to be notified of changes in port status.
Definition at line 1174 of file PortCore.cpp.
Definition at line 2199 of file PortCore.cpp.
After sending a message, should we wait for it to be sent to all destinations before returning?
Definition at line 353 of file PortCore.h.
Upon being asked to send a message, should we wait for any existing message to be sent to all destinations?
Definition at line 344 of file PortCore.h.
|
overridevirtual |
Begin main thread.
Reimplemented from yarp::os::impl::ThreadImpl.
Definition at line 276 of file PortCore.cpp.
| bool PortCore::tryLockCallback | ( | ) |
Definition at line 2236 of file PortCore.cpp.
| void PortCore::unlockCallback | ( | ) |
Definition at line 2244 of file PortCore.cpp.