Class to handle messages and subscriptions. More...
#include <MsgManager.hh>
Public Member Functions | |
| MsgManager () | |
| Default constructor. | |
| void | AddInbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg) |
| Add a new message to the inbound queue. | |
| void | AddOutbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg) |
| Add a new message to the outbound queue. | |
| bool | AddSubscriber (const std::string &_address, const std::string &_modelName, const std::string &_topic) |
| Add a new subscriber. It's possible to associate multiple topics to the same address/model pair. However, the same address cannot be attached to multiple models. When all the subscribers are removed, it's possible to bind to this address using a different model. | |
| Registry | Copy () const |
| Get a copy of the data structure containing subscriptions and data queues. | |
| Registry & | Data () |
| Get a mutable reference to the data containing subscriptions and data queues. | |
| const Registry & | DataConst () const |
| Get an immutable reference to the data containing subscriptions and data queues. | |
| void | DeliverMsgs () |
| This function delivers all the messages in the inbound queue to the appropriate subscribers. This function also clears the inbound queue. | |
| bool | RemoveInbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg) |
| Remove a message from the inbound queue. | |
| bool | RemoveOutbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg) |
| Remove a message from the outbound queue. | |
| bool | RemoveSubscriber (const std::string &_address, const std::string &_topic) |
| Remove an existing subscriber. | |
| void | Set (const Registry &_newContent) |
| Set the data structure containing subscriptions and data queues. | |
Detailed Description
Class to handle messages and subscriptions.
Constructor & Destructor Documentation
◆ MsgManager()
| MsgManager | ( | ) |
Default constructor.
Member Function Documentation
◆ AddInbound()
| void AddInbound | ( | const std::string & | _address, |
| const msgs::DataframeSharedPtr & | _msg | ||
| ) |
Add a new message to the inbound queue.
- Parameters
-
[in] _address The destination address. [in] _msg The message.
◆ AddOutbound()
| void AddOutbound | ( | const std::string & | _address, |
| const msgs::DataframeSharedPtr & | _msg | ||
| ) |
Add a new message to the outbound queue.
- Parameters
-
[in] _address The sender address. [in] _msg The message.
◆ AddSubscriber()
| bool AddSubscriber | ( | const std::string & | _address, |
| const std::string & | _modelName, | ||
| const std::string & | _topic | ||
| ) |
Add a new subscriber. It's possible to associate multiple topics to the same address/model pair. However, the same address cannot be attached to multiple models. When all the subscribers are removed, it's possible to bind to this address using a different model.
- Parameters
-
[in] _address The subscriber address. [in] _modelName The model name. [in] _topic The subscriber topic.
- Returns
- True if the subscriber was successfully added or false otherwise.
◆ Copy()
| Registry Copy | ( | ) | const |
Get a copy of the data structure containing subscriptions and data queues.
- Returns
- A copy of the data.
◆ Data()
| Registry & Data | ( | ) |
Get a mutable reference to the data containing subscriptions and data queues.
- Returns
- A mutable reference to the data.
◆ DataConst()
| const Registry & DataConst | ( | ) | const |
Get an immutable reference to the data containing subscriptions and data queues.
- Returns
- A const reference to the data.
◆ DeliverMsgs()
| void DeliverMsgs | ( | ) |
This function delivers all the messages in the inbound queue to the appropriate subscribers. This function also clears the inbound queue.
◆ RemoveInbound()
| bool RemoveInbound | ( | const std::string & | _address, |
| const msgs::DataframeSharedPtr & | _msg | ||
| ) |
Remove a message from the inbound queue.
- Parameters
-
[in] _address The destination address. [in] _Msg Message pointer to remove.
- Returns
- True if the message was removed or false otherwise.
◆ RemoveOutbound()
| bool RemoveOutbound | ( | const std::string & | _address, |
| const msgs::DataframeSharedPtr & | _msg | ||
| ) |
Remove a message from the outbound queue.
- Parameters
-
[in] _address The sender address. [in] _msg Message pointer to remove.
- Returns
- True if the message was removed or false otherwise.
◆ RemoveSubscriber()
| bool RemoveSubscriber | ( | const std::string & | _address, |
| const std::string & | _topic | ||
| ) |
Remove an existing subscriber.
- Parameters
-
[in] _address The subscriber address. [in] _topic The Subscriber topic.
- Returns
- True if the subscriber was removed or false otherwise.
◆ Set()
| void Set | ( | const Registry & | _newContent | ) |
Set the data structure containing subscriptions and data queues.
- Parameters
-
[in] _newContent New content to be set.
The documentation for this class was generated from the following file: