A helper class to handle callbacks when messages arrive.
More...
#include <transport/transport.hh>
Inherited by CallbackHelperT< M >, RawCallbackHelper, and SubscriptionTransport.
|
| CallbackHelper (bool _latching=false) |
| Constructor.
|
|
virtual | ~CallbackHelper () |
| Destructor.
|
|
unsigned int | GetId () const |
| Get the unique ID of this callback.
|
|
bool | GetLatching () const |
| Is the callback latching?
|
|
virtual std::string | GetMsgType () const |
| Get the typename of the message that is handled.
|
|
virtual bool | HandleData (const std::string &_newdata, boost::function< void(uint32_t)> _cb, uint32_t _id)=0 |
| Process new incoming data.
|
|
virtual bool | HandleMessage (MessagePtr _newMsg)=0 |
| Process new incoming message.
|
|
virtual bool | IsLocal () const =0 |
| Is the callback local?
|
|
void | SetLatching (bool _latch) |
| Set whether this callback is latching.
|
|
|
bool | latching |
| True means that the callback helper will get the last published message on the topic.
|
|
std::mutex | latchingMutex |
| Mutex to protect the latching variable.
|
|
A helper class to handle callbacks when messages arrive.
◆ CallbackHelper()
Constructor.
- Parameters
-
[in] | _latching | Set to true to make the callback helper latching. |
◆ ~CallbackHelper()
◆ GetId()
unsigned int GetId |
( |
| ) |
const |
Get the unique ID of this callback.
- Returns
- The unique ID of this callback.
◆ GetLatching()
bool GetLatching |
( |
| ) |
const |
Is the callback latching?
- Returns
- true if the callback is latching, false otherwise
◆ GetMsgType()
virtual std::string GetMsgType |
( |
| ) |
const |
|
virtual |
◆ HandleData()
virtual bool HandleData |
( |
const std::string & | _newdata, |
|
|
boost::function< void(uint32_t)> | _cb, |
|
|
uint32_t | _id ) |
|
pure virtual |
Process new incoming data.
- Parameters
-
[in] | _newdata | Incoming data to be processed |
- Returns
- true if successfully processed; false otherwise
- Parameters
-
[in] | _cb | If non-null, callback to be invoked which signals that transmission is complete. |
[in] | _id | ID associated with the message data. |
Implemented in CallbackHelperT< M >, RawCallbackHelper, and SubscriptionTransport.
◆ HandleMessage()
◆ IsLocal()
virtual bool IsLocal |
( |
| ) |
const |
|
pure virtual |
◆ SetLatching()
void SetLatching |
( |
bool | _latch | ) |
|
◆ latching
True means that the callback helper will get the last published message on the topic.
◆ latchingMutex
Mutex to protect the latching variable.
The documentation for this class was generated from the following file: