Ignition Gazebo

API Reference

6.9.0
MsgManager Class Reference

Class to handle messages and subscriptions. More...

#include <MsgManager.hh>

Public Member Functions

 MsgManager ()
 Default constructor. More...
 
void AddInbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg)
 Add a new message to the inbound queue. More...
 
void AddOutbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg)
 Add a new message to the outbound queue. More...
 
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 posible to bind to this address using a different model. More...
 
Registry Copy () const
 Get a copy of the data structure containing subscriptions and data queues. More...
 
RegistryData ()
 Get a mutable reference to the data containing subscriptions and data queues. More...
 
const RegistryDataConst () const
 Get an inmutable reference to the data containing subscriptions and data queues. More...
 
void DeliverMsgs ()
 This function delivers all the messages in the inbound queue to the appropriate subscribers. This function also clears the inbound queue. More...
 
bool RemoveInbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg)
 Remove a message from the inbound queue. More...
 
bool RemoveOutbound (const std::string &_address, const msgs::DataframeSharedPtr &_msg)
 Remove a message from the outbound queue. More...
 
bool RemoveSubscriber (const std::string &_address, const std::string &_topic)
 Remove an existing subscriber. More...
 
void Set (const Registry &_newContent)
 Set the data structure containing subscriptions and data queues. More...
 

Detailed Description

Class to handle messages and subscriptions.

Constructor & Destructor Documentation

◆ 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]_addressThe destination address.
[in]_msgThe message.

◆ AddOutbound()

void AddOutbound ( const std::string _address,
const msgs::DataframeSharedPtr _msg 
)

Add a new message to the outbound queue.

Parameters
[in]_addressThe sender address.
[in]_msgThe 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 posible to bind to this address using a different model.

Parameters
[in]_addressThe subscriber address.
[in]_modelNameThe model name.
[in]_topicThe 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 inmutable 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]_addressThe destination address.
[in]_MsgMessage 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]_addressThe sender address.
[in]_msgMessage 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]_addressThe subscriber address.
[in]_topicThe 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]_newContentNew content to be set.

The documentation for this class was generated from the following file: