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
template<typename TopicMsgType>
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 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.
◆ AddSubscriber()
|
inlineoverridevirtual |
Add one subscriber to this Topic
- Parameters
-
sub_ptr The abstraction of subscriber interface
Implements simulation_framework::core::ITopic.
◆ ClearPubSub()
|
inlineoverridevirtual |
Remove all publisher and subscriber which are asociated with this Topic
Implements simulation_framework::core::ITopic.
◆ GetId()
|
inlineoverridevirtual |
- Returns
- A unique ID of this topic
Implements simulation_framework::core::ITopic.
◆ GetPublishers()
|
inlineoverridevirtual |
- Returns
- The list of assigned publisher which are publishing message to this Topic
Implements simulation_framework::core::ITopic.
◆ GetSubscribers()
|
inlineoverridevirtual |
- Returns
- The list of assigned subscriber which are listening to this Topic
Implements simulation_framework::core::ITopic.
◆ GetType()
|
inlineoverridevirtual |
- Returns
- The type of this topic
Implements simulation_framework::core::ITopic.
◆ 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.
◆ SubscriberCount()
|
inlineoverridevirtual |
- Returns
- The number of subscriber which is listening to this topic
Implements simulation_framework::core::ITopic.
The documentation for this class was generated from the following file: