|
Modulo 5.0.0
|
The PublisherHandler handles different types of ROS publishers to activate, deactivate and publish data with those publishers. More...
#include <PublisherHandler.hpp>
Public Member Functions | |
| PublisherHandler (PublisherType type, std::shared_ptr< PubT > publisher) | |
| Constructor with the publisher type and the pointer to the ROS publisher. | |
| ~PublisherHandler () override | |
| Destructor to explicitly reset the publisher pointer. | |
| virtual void | activate () override |
| Activate ROS publisher of a derived PublisherHandler instance through the PublisherInterface pointer. | |
| virtual void | deactivate () override |
| Deactivate ROS publisher of a derived PublisherHandler instance through the PublisherInterface pointer. | |
| void | publish () override |
| Publish the data stored in the message pair through the ROS publisher of a derived PublisherHandler instance through the PublisherInterface pointer. | |
| void | publish (const MsgT &message) const |
| Publish the ROS message through the ROS publisher. | |
| std::shared_ptr< PublisherInterface > | create_publisher_interface (const std::shared_ptr< MessagePairInterface > &message_pair) |
| Create a PublisherInterface instance from the current PublisherHandler. | |
Public Member Functions inherited from modulo_core::communication::PublisherInterface | |
| PublisherInterface (PublisherType type, std::shared_ptr< MessagePairInterface > message_pair=nullptr) | |
| Constructor with the message type and message pair. | |
| PublisherInterface (const PublisherInterface &publisher)=default | |
| Copy constructor from another PublisherInterface. | |
| virtual | ~PublisherInterface ()=default |
| Default virtual destructor. | |
| template<typename PubT , typename MsgT > | |
| std::shared_ptr< PublisherHandler< PubT, MsgT > > | get_handler (bool validate_pointer=true) |
| Get a pointer to a derived PublisherHandler instance from a PublisherInterface pointer. | |
| std::shared_ptr< MessagePairInterface > | get_message_pair () const |
| Get the pointer to the message pair of the PublisherInterface. | |
| void | set_message_pair (const std::shared_ptr< MessagePairInterface > &message_pair) |
| Set the pointer to the message pair of the PublisherInterface. | |
| PublisherType | get_type () const |
| Get the type of the publisher interface. | |
Additional Inherited Members | |
Protected Attributes inherited from modulo_core::communication::PublisherInterface | |
| std::shared_ptr< MessagePairInterface > | message_pair_ |
| The pointer to the stored MessagePair instance. | |
The PublisherHandler handles different types of ROS publishers to activate, deactivate and publish data with those publishers.
| PubT | The ROS publisher type |
| MsgT | The ROS message type of the ROS publisher |
Definition at line 13 of file PublisherInterface.hpp.
| modulo_core::communication::PublisherHandler< PubT, MsgT >::PublisherHandler | ( | PublisherType | type, |
| std::shared_ptr< PubT > | publisher ) |
Constructor with the publisher type and the pointer to the ROS publisher.
| type | The publisher type |
| publisher | The pointer to the ROS publisher |
Definition at line 69 of file PublisherHandler.hpp.
|
override |
Destructor to explicitly reset the publisher pointer.
Definition at line 73 of file PublisherHandler.hpp.
|
inlineoverridevirtual |
Activate ROS publisher of a derived PublisherHandler instance through the PublisherInterface pointer.
This throws an InvalidPointerCastException if the PublisherInterface does not point to a valid PublisherHandler instance or if the type of the message pair does not match the type of the PublisherHandler instance.
| modulo_core::exceptions::NullPointerException | if the message pair pointer is null |
Reimplemented from modulo_core::communication::PublisherInterface.
Definition at line 78 of file PublisherHandler.hpp.
|
inline |
Create a PublisherInterface instance from the current PublisherHandler.
| message_pair | The message pair of the PublisherInterface |
Definition at line 142 of file PublisherHandler.hpp.
|
inlineoverridevirtual |
Deactivate ROS publisher of a derived PublisherHandler instance through the PublisherInterface pointer.
This throws an InvalidPointerCastException if the PublisherInterface does not point to a valid PublisherHandler instance or if the type of the message pair does not match the type of the PublisherHandler instance.
| modulo_core::exceptions::NullPointerException | if the message pair pointer is null |
Reimplemented from modulo_core::communication::PublisherInterface.
Definition at line 92 of file PublisherHandler.hpp.
|
inlineoverridevirtual |
Publish the data stored in the message pair through the ROS publisher of a derived PublisherHandler instance through the PublisherInterface pointer.
This throws an InvalidPointerCastException if the PublisherInterface does not point to a valid PublisherHandler instance or if the type of the message pair does not match the type of the PublisherHandler instance.
| modulo_core::exceptions::CoreException | if the publishing failed for some reason (translation, null pointer, pointer cast, ...) |
Reimplemented from modulo_core::communication::PublisherInterface.
Definition at line 106 of file PublisherHandler.hpp.
| void modulo_core::communication::PublisherHandler< PubT, MsgT >::publish | ( | const MsgT & | message | ) | const |
Publish the ROS message through the ROS publisher.
| message | The ROS message to publish |
| modulo_core::exceptions::NullPointerException | if the publisher pointer is null |
Definition at line 129 of file PublisherHandler.hpp.