Skip to main content

AVxcelerate Simulation Framework 2026 R1 SP01

Class simulation_framework::core::Topic

Last update: 22.04.2026

Definition: core/communication/topic.h (line 38)

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:

Topic<GenericBytesMessage> osi_topic_1("topic_1");
Topic<GenericBytesMessage> osi_topic_2("topic_2");

Template parameters:

Inherits from:

Members

Public types

Typedef PublisherCallback

Definition: core/communication/topic.h (line 41)

using simulation_framework::core::Topic< TopicMsgType >::PublisherCallback =  std::function<TopicMsgType()>

Return type: std::function< TopicMsgType()>

Typedef SubscriberMessageCallback

Definition: core/communication/topic.h (line 42)

using simulation_framework::core::Topic< TopicMsgType >::SubscriberMessageCallback =  std::function<void(const TopicMsgType&)>

Return type: std::function< void(const TopicMsgType &)>

Typedef TopicMessageType

Definition: core/communication/topic.h (line 43)

using simulation_framework::core::Topic< TopicMsgType >::TopicMessageType =  TopicMsgType

Return type: TopicMsgType

Public functions

Function Topic

simulation_framework::core::Topic< TopicMsgType >::Topic(const TopicId &topic_id, const TopicType topic_type=TopicType::kRTIDDS)

Parameters:

  • const TopicId & topic_id
  • const TopicType topic_type = TopicType::kRTIDDS

Return type:

Function GetId

TopicId simulation_framework::core::Topic< TopicMsgType >::GetId() const override

Returns:

A unique ID of this topic

Return type: TopicId

Reimplements: GetId

Function GetType

TopicType simulation_framework::core::Topic< TopicMsgType >::GetType() const override

Returns:

The type of this topic

Return type: TopicType

Reimplements: GetType

Function AddPublisher

void simulation_framework::core::Topic< TopicMsgType >::AddPublisher(std::unique_ptr< IPublisher > pub_ptr) override

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

Parameters:

  • std::unique_ptr< IPublisher > pub_ptr

Return type: void

Reimplements: AddPublisher

Function AddSubscriber

void simulation_framework::core::Topic< TopicMsgType >::AddSubscriber(std::unique_ptr< ISubscriber > sub_ptr) override

Add one subscriber to this Topic

Parameters:

  • sub_ptr: The abstraction of subscriber interface

Parameters:

  • std::unique_ptr< ISubscriber > sub_ptr

Return type: void

Reimplements: AddSubscriber

Function SubscriberCount

std::size_t simulation_framework::core::Topic< TopicMsgType >::SubscriberCount() const override

Returns:

The number of subscriber which is listening to this topic

Return type: std::size_t

Reimplements: SubscriberCount

Function PublisherCount

std::size_t simulation_framework::core::Topic< TopicMsgType >::PublisherCount() const override

Returns:

The number of publisher which publishes message into this Topic. The max publisher count of a topic is limited to be one.

Return type: std::size_t

Reimplements: PublisherCount

Function ClearPubSub

void simulation_framework::core::Topic< TopicMsgType >::ClearPubSub() override

Remove all publisher and subscriber which are asociated with this Topic

Return type: void

Reimplements: ClearPubSub

Function GetSubscribers

const Subscribers & simulation_framework::core::Topic< TopicMsgType >::GetSubscribers() const override

Returns:

The list of assigned subscriber which are listening to this Topic

Return type: const Subscribers &

Reimplements: GetSubscribers

Function GetPublishers

const Publishers & simulation_framework::core::Topic< TopicMsgType >::GetPublishers() const override

Returns:

The list of assigned publisher which are publishing message to this Topic

Return type: const Publishers &

Reimplements: GetPublishers

Connect with Ansys