    

 ## On this page

  

 

 # i\_topic

 Last update: 16.07.2025 

<a name="l00001"></a> 1 

<a name="l00005"></a> 5 

<a name="l00006"></a> 6 \#pragma once

<a name="l00007"></a> 7 

<a name="l00008"></a> 8 \#include "core/communication/i\_publisher.h"

<a name="l00009"></a> 9 \#include "core/communication/i\_subscriber.h"

<a name="l00010"></a> 10 

<a name="l00011"></a> 11 namespace [simulation\_framework](namespacesimulation__framework.xhtml)

<a name="l00012"></a> 12 {

<a name="l00013"></a> 13 namespace [core](namespacecore.xhtml)

<a name="l00014"></a> 14 {

<a name="l00015"></a> 15 

<a name="l00021"></a> 21 enum class TopicType

<a name="l00022"></a> 22 {

<a name="l00023"></a> 23 kRTIDDS = 0,

<a name="l00024"></a> 24 kGRPC

<a name="l00025"></a> 25 };

<a name="l00026"></a> 26 using TopicId = std::string;

<a name="l00027"></a> 27 

<a name="l00032"></a>[ 32](classsimulation__framework_1_1core_1_1ITopic.xhtml) class [ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml)

<a name="l00033"></a> 33 {

<a name="l00034"></a> 34 public:

<a name="l00035"></a> 35 virtual ~[ITopic](classsimulation__framework_1_1core_1_1ITopic.xhtml)() = default;

<a name="l00036"></a> 36 

<a name="l00040"></a> 40 virtual TopicId [GetId](classsimulation__framework_1_1core_1_1ITopic.xhtml#ad4e077cd059e9c6f0ce9ad0df73ca3cd)() const = 0;

<a name="l00041"></a> 41 

<a name="l00045"></a> 45 virtual TopicType [GetType](classsimulation__framework_1_1core_1_1ITopic.xhtml#a461f8684a1e5190affbe69253f74fdb7)() const = 0;

<a name="l00046"></a> 46 

<a name="l00050"></a> 50 virtual std::size_t [SubscriberCount](classsimulation__framework_1_1core_1_1ITopic.xhtml#a370ff9b0059ea1c200e6a5384671aac8)() const = 0;

<a name="l00051"></a> 51 

<a name="l00056"></a> 56 virtual std::size_t [PublisherCount](classsimulation__framework_1_1core_1_1ITopic.xhtml#a469c0e1f5fd07f9829e93fd8a43bd6f7)() const = 0;

<a name="l00057"></a> 57 

<a name="l00063"></a> 63 virtual void [AddPublisher](classsimulation__framework_1_1core_1_1ITopic.xhtml#aadab7c49ae9beaa036d3fa9845aed85d)(std::unique_ptr&lt;IPublisher&gt; pub_ptr) = 0;

<a name="l00064"></a> 64 

<a name="l00069"></a> 69 virtual void [AddSubscriber](classsimulation__framework_1_1core_1_1ITopic.xhtml#a612d64a1aca7a60a8efc7f07f4d28311)(std::unique_ptr&lt;ISubscriber&gt; sub_ptr) = 0;

<a name="l00070"></a> 70 

<a name="l00074"></a> 74 virtual void [ClearPubSub](classsimulation__framework_1_1core_1_1ITopic.xhtml#a470392793ee8cb2fc406b8b1e1b55d2d)() = 0;

<a name="l00075"></a> 75 

<a name="l00079"></a> 79 virtual const Subscribers&amp; [GetSubscribers](classsimulation__framework_1_1core_1_1ITopic.xhtml#a7630cb9d29b99d7bf23c31cf55501fab)() const = 0;

<a name="l00080"></a> 80 

<a name="l00084"></a> 84 virtual const Publishers&amp; [GetPublishers](classsimulation__framework_1_1core_1_1ITopic.xhtml#a30c943aeecff120162c4a65082bcb4e6)() const = 0;

<a name="l00085"></a> 85 };

<a name="l00086"></a> 86 

<a name="l00087"></a> 87 using TopicIdVector = std::vector&lt;TopicId&gt;;

<a name="l00088"></a> 88 using Topics = std::vector&lt;std::shared_ptr&lt;ITopic&gt;&gt;;

<a name="l00089"></a> 89 

<a name="l00090"></a> 90 } // namespace core

<a name="l00091"></a> 91 } // namespace simulation\_framework