simulation_framework::core::Topic< TopicMsgType > Class Template Reference
Last update: 16.07.2025This is the concrete Topic class that can be used for creation of a communication channel with given underlying message. As default type, DDS type will be applied. TopicId is globally unique and represents one single Topic. Different Topics can hold same underlying message type but they are different topics for communication. More...
#include <topic.h>


Public Types | |
| using | PublisherCallback = std::function< TopicMsgType()> |
| using | SubscriberMessageCallback = std::function< void(const TopicMsgType &)> |
| using | TopicMessageType = TopicMsgType |
Public Member Functions | |
| Topic (const TopicId &topic_id, const TopicType topic_type=TopicType::kRTIDDS) | |
| TopicId | GetId () const override |
| TopicType | GetType () const override |
| void | AddPublisher (std::unique_ptr< IPublisher > pub_ptr) override |
| void | AddSubscriber (std::unique_ptr< ISubscriber > sub_ptr) override |
| std::size_t | SubscriberCount () const override |
| std::size_t | PublisherCount () const override |
| void | ClearPubSub () override |
| const Subscribers & | GetSubscribers () const override |
| const Publishers & | GetPublishers () const override |
Detailed Description
class simulation_framework::core::Topic< TopicMsgType >
This is the concrete Topic class that can be used for creation of a communication channel with given underlying message. As default type, DDS type will be applied. TopicId is globally unique and represents one single Topic. Different Topics can hold same underlying message type but they are different topics for communication.
Example:
Member Typedef Documentation
◆ PublisherCallback
| using simulation_framework::core::Topic< TopicMsgType >::PublisherCallback = std::function<TopicMsgType()> |
◆ SubscriberMessageCallback
| using simulation_framework::core::Topic< TopicMsgType >::SubscriberMessageCallback = std::function<void(const TopicMsgType&)> |
◆ TopicMessageType
| using simulation_framework::core::Topic< TopicMsgType >::TopicMessageType = TopicMsgType |
Constructor & Destructor Documentation
◆ Topic()
|
inline |
Member Function Documentation
◆ AddPublisher()
|
inlineoverridevirtual |
Add one publisher of this Topic. The max publisher count of a topic is limited to be one.
- Parameters
-
pub_ptr The abstraction of publisher interface
Implements simulation_framework::core::ITopic.
Definition at line 52 of file topic.h.
◆ AddSubscriber()
|
inlineoverridevirtual |
Add one subscriber to this Topic
- Parameters
-
sub_ptr The abstraction of subscriber interface
Implements simulation_framework::core::ITopic.
Definition at line 61 of file topic.h.
◆ ClearPubSub()
|
inlineoverridevirtual |
Remove all publisher and subscriber which are asociated with this Topic
Implements simulation_framework::core::ITopic.
Definition at line 66 of file topic.h.
◆ GetId()
|
inlineoverridevirtual |
- Returns
- A unique ID of this topic
Implements simulation_framework::core::ITopic.
Definition at line 49 of file topic.h.
◆ GetPublishers()
|
inlineoverridevirtual |
- Returns
- The list of assigned publisher which are publishing message to this Topic
Implements simulation_framework::core::ITopic.
Definition at line 73 of file topic.h.
◆ GetSubscribers()
|
inlineoverridevirtual |
- Returns
- The list of assigned subscriber which are listening to this Topic
Implements simulation_framework::core::ITopic.
Definition at line 72 of file topic.h.
◆ GetType()
|
inlineoverridevirtual |
- Returns
- The type of this topic
Implements simulation_framework::core::ITopic.
Definition at line 50 of file topic.h.
◆ PublisherCount()
|
inlineoverridevirtual |
- Returns
- The number of publisher which publishes message into this Topic. The max publisher count of a topic is limited to be one.
Implements simulation_framework::core::ITopic.
Definition at line 64 of file topic.h.
◆ SubscriberCount()
|
inlineoverridevirtual |
- Returns
- The number of subscriber which is listening to this topic
Implements simulation_framework::core::ITopic.
Definition at line 63 of file topic.h.
The documentation for this class was generated from the following file: