    

 ## On this page

  

 

 # simulation\_framework::core::Topic&lt; TopicMsgType &gt; Class Template Reference

 Last update: 16.07.2025 

This is the concrete [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ...") 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](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ..."). Different Topics can hold same underlying message type but they are different topics for communication. [More...](classsimulation__framework_1_1core_1_1Topic.xhtml#details)

`#include <<a class="el" href="topic_8h_source.xhtml">topic.h</a>>`

Inheritance diagram for simulation_framework::core::Topic&lt; TopicMsgType &gt;:

![Inheritance graph](/sites/default/files/migrate-content/avxcelerate_simulation_framework_2024_r1/classsimulation__framework_1_1core_1_1Topic__inherit__graph.png)

\[[legend](graph_legend.xhtml)\]

Collaboration diagram for simulation_framework::core::Topic&lt; TopicMsgType &gt;:

![Collaboration graph](/sites/default/files/migrate-content/avxcelerate_simulation_framework_2024_r1/classsimulation__framework_1_1core_1_1Topic__coll__graph.png)

\[[legend](graph_legend.xhtml)\]

## <a id="pub-types" name="pub-types"></a>Public Types

<a id="a0f29e64e5b4720391091e07f6250e20a"></a>using **PublisherCallback** = std::function&lt; TopicMsgType()&gt; <a id="a2c04396e41962b68a36c63f8a3c215f1"></a>using **SubscriberMessageCallback** = std::function&lt; void(const TopicMsgType &amp;)&gt; <a id="aa28465d4f009835110d723ee902d17b4"></a>using **TopicMessageType** = TopicMsgType ## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

<a id="a9ff71b7b23ec021c0f39891008c45e22"></a> **Topic** (const TopicId &amp;topic\_id, const TopicType topic\_type=TopicType::kRTIDDS) TopicId [GetId](classsimulation__framework_1_1core_1_1Topic.xhtml#a6cef83adabcaab8aabd20cd3184dca3c) () const override TopicType [GetType](classsimulation__framework_1_1core_1_1Topic.xhtml#a6f459336816bf96dd43d4a827043485d) () const override void [AddPublisher](classsimulation__framework_1_1core_1_1Topic.xhtml#aa43d088454862297433595172d653ac4) (PublisherPtr pub\_ptr) override void [AddSubscriber](classsimulation__framework_1_1core_1_1Topic.xhtml#a4ef6fa59f00c18ca651be82620d7fc1c) (SubscriberPtr sub\_ptr) override std::size\_t [SubscriberCount](classsimulation__framework_1_1core_1_1Topic.xhtml#a71ce3df423a48cbc555cf9fb322726df) () const override std::size\_t [PublisherCount](classsimulation__framework_1_1core_1_1Topic.xhtml#a9056b30c90efc165ee8559b41e8a9064) () const override void [ClearPubSub](classsimulation__framework_1_1core_1_1Topic.xhtml#ac366c5dd53e4c5770b1a5f40ae2c8956) () override const Subscribers &amp; [GetSubscribers](classsimulation__framework_1_1core_1_1Topic.xhtml#a866d022f0c5454919d3c2b58c63eff72) () const override const Publishers &amp; [GetPublishers](classsimulation__framework_1_1core_1_1Topic.xhtml#add9a23a5901f71c1161b94c5a19b3ccf) () const override <a id="details" name="details"></a>## Detailed Description

### template&lt;typename TopicMsgType&gt;  
class simulation\_framework::core::Topic&lt; TopicMsgType &gt;

This is the concrete [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ...") 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](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ..."). Different Topics can hold same underlying message type but they are different topics for communication.

Example:

Topic&lt;GenericBytesMessage&gt; osi_topic_1("topic\_1");

Topic&lt;GenericBytesMessage&gt; osi_topic_2("topic\_2");





## Member Function Documentation

<a id="aa43d088454862297433595172d653ac4"></a>## [◆ ](#aa43d088454862297433595172d653ac4)AddPublisher()

template&lt;typename TopicMsgType &gt; 

 void [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::AddPublisher  ( PublisherPtr  *pub\_ptr*)   inlineoverridevirtual 

Add one publisher of this [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ..."). The max publisher count of a topic is limited to be one.

Parameters pub\_ptrThe abstraction of publisher interface Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a2c49892b2572e6c92ee9d53af1a30253).





<a id="a4ef6fa59f00c18ca651be82620d7fc1c"></a>## [◆ ](#a4ef6fa59f00c18ca651be82620d7fc1c)AddSubscriber()

template&lt;typename TopicMsgType &gt; 

 void [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::AddSubscriber  ( SubscriberPtr  *sub\_ptr*)   inlineoverridevirtual 

Add one subscriber to this [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ...")

Parameters sub\_ptrThe abstraction of subscriber interface Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a63dbfdb2de718cc769916e95e92674bb).





<a id="ac366c5dd53e4c5770b1a5f40ae2c8956"></a>## [◆ ](#ac366c5dd53e4c5770b1a5f40ae2c8956)ClearPubSub()

template&lt;typename TopicMsgType &gt; 

 void [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::ClearPubSub  ( )   inlineoverridevirtual 

Remove all publisher and subscriber which are asociated with this [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ...")

Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a470392793ee8cb2fc406b8b1e1b55d2d).





<a id="a6cef83adabcaab8aabd20cd3184dca3c"></a>## [◆ ](#a6cef83adabcaab8aabd20cd3184dca3c)GetId()

template&lt;typename TopicMsgType &gt; 

 TopicId [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::GetId  ( )  const  inlineoverridevirtual 

ReturnsA unique ID of this topic Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#ad4e077cd059e9c6f0ce9ad0df73ca3cd).





<a id="add9a23a5901f71c1161b94c5a19b3ccf"></a>## [◆ ](#add9a23a5901f71c1161b94c5a19b3ccf)GetPublishers()

template&lt;typename TopicMsgType &gt; 

 const Publishers&amp; [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::GetPublishers  ( )  const  inlineoverridevirtual 

ReturnsThe list of assigned publisher which are publishing message to this [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ...")Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a30c943aeecff120162c4a65082bcb4e6).





<a id="a866d022f0c5454919d3c2b58c63eff72"></a>## [◆ ](#a866d022f0c5454919d3c2b58c63eff72)GetSubscribers()

template&lt;typename TopicMsgType &gt; 

 const Subscribers&amp; [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::GetSubscribers  ( )  const  inlineoverridevirtual 

ReturnsThe list of assigned subscriber which are listening to this [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ...")Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a7630cb9d29b99d7bf23c31cf55501fab).





<a id="a6f459336816bf96dd43d4a827043485d"></a>## [◆ ](#a6f459336816bf96dd43d4a827043485d)GetType()

template&lt;typename TopicMsgType &gt; 

 TopicType [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::GetType  ( )  const  inlineoverridevirtual 

ReturnsThe type of this topic Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a461f8684a1e5190affbe69253f74fdb7).





<a id="a9056b30c90efc165ee8559b41e8a9064"></a>## [◆ ](#a9056b30c90efc165ee8559b41e8a9064)PublisherCount()

template&lt;typename TopicMsgType &gt; 

 std::size\_t [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::PublisherCount  ( )  const  inlineoverridevirtual 

ReturnsThe number of publisher which publishes message into this [Topic](classsimulation__framework_1_1core_1_1Topic.xhtml "This is the concrete Topic class that can be used for creation of a communication channel with given ..."). The max publisher count of a topic is limited to be one. Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a469c0e1f5fd07f9829e93fd8a43bd6f7).





<a id="a71ce3df423a48cbc555cf9fb322726df"></a>## [◆ ](#a71ce3df423a48cbc555cf9fb322726df)SubscriberCount()

template&lt;typename TopicMsgType &gt; 

 std::size\_t [simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)&lt; TopicMsgType &gt;::SubscriberCount  ( )  const  inlineoverridevirtual 

ReturnsThe number of subscriber which is listening to this topic Implements [simulation\_framework::core::ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml#a370ff9b0059ea1c200e6a5384671aac8).





---

The documentation for this class was generated from the following file:- [topic.h](topic_8h_source.xhtml)