A class that is used to store information about an subscriber. An instance of this class is returned from Node::CreateSubscribe. When the object is destroyed, the corresponding subscription handler is removed from the node. More...
#include <Node.hh>
Public Member Functions | |
| Subscriber () | |
| Default constructor. | |
| Subscriber (const std::string &_topic, const std::string &_nUuid, const NodeOptions &_nOpts, const std::string &_hUuid) | |
| Constructor. | |
| Subscriber (Subscriber &&_other) | |
| Move constructor. | |
| virtual | ~Subscriber () |
| Destructor. Unsubscribe to the topic and remove the subcription handler. | |
| operator bool () | |
| Allows this class to be evaluated as a boolean. | |
| operator bool () const | |
| Allows this class to be evaluated as a boolean (const). | |
| Node::Subscriber & | operator= (Subscriber &&_other) |
| Move assignment operator. | |
| bool | Unsubscribe () |
| Unsubscribe from the topic. | |
| bool | Valid () const |
| Return true if valid information, such as a non-empty topic name, node and handler UUIDs. | |
Detailed Description
A class that is used to store information about an subscriber. An instance of this class is returned from Node::CreateSubscribe. When the object is destroyed, the corresponding subscription handler is removed from the node.
Pseudo code example
std::function<void(const msgs::Int32 &)> cb = [](const msgs::Int32 &) { // Do something }; Node::Subscriber sub = myNode.CreateSubscriber("topic_name", cb);
Constructor & Destructor Documentation
◆ Subscriber() [1/3]
| Subscriber | ( | ) |
Default constructor.
◆ Subscriber() [2/3]
| Subscriber | ( | const std::string & | _topic, |
| const std::string & | _nUuid, | ||
| const NodeOptions & | _nOpts, | ||
| const std::string & | _hUuid | ||
| ) |
Constructor.
- Parameters
-
[in] _topic Subscribed topic name [in] _nUuid Node to which this subscriber belongs [in] _nOpts Node options for the node [in] _hUuid Subscriber's handler UUID
◆ ~Subscriber()
|
virtual |
Destructor. Unsubscribe to the topic and remove the subcription handler.
◆ Subscriber() [3/3]
| Subscriber | ( | Subscriber && | _other | ) |
Move constructor.
- Parameters
-
[in] _other The other Node::Subscriber
Member Function Documentation
◆ operator bool() [1/2]
| operator bool | ( | ) |
◆ operator bool() [2/2]
| operator bool | ( | ) | const |
◆ operator=()
| Node::Subscriber & operator= | ( | Subscriber && | _other | ) |
◆ Unsubscribe()
| bool Unsubscribe | ( | ) |
Unsubscribe from the topic.
- Returns
- True if the topic was successfully unsubscribed
◆ Valid()
| bool Valid | ( | ) | const |
Return true if valid information, such as a non-empty topic name, node and handler UUIDs.
- Returns
- True if this object has a valid subscription.
The documentation for this class was generated from the following file: