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.  More... | |
| Subscriber (const std::string &_topic, const std::string &_nUuid, const NodeOptions &_nOpts, const std::string &_hUuid) | |
| Constructor.  More... | |
| Subscriber (Subscriber &&_other) | |
| Move constructor.  More... | |
| virtual | ~Subscriber () | 
| Destructor. Unsubscribe to the topic and remove the subcription handler.  More... | |
| operator bool () | |
| Allows this class to be evaluated as a boolean.  More... | |
| operator bool () const | |
| Allows this class to be evaluated as a boolean (const).  More... | |
| Node::Subscriber & | operator= (Subscriber &&_other) | 
| Move assignment operator.  More... | |
| bool | Unsubscribe () | 
| Unsubscribe from the topic.  More... | |
| bool | Valid () const | 
| Return true if valid information, such as a non-empty topic name, node and handler UUIDs.  More... | |
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: