Skip to main content

AVxcelerate Simulation Framework 2024 R2

i_topic

Last update: 12.07.2024
1 
5 
6 #pragma once
7 
8 #include "core/communication/i_publisher.h"
9 #include "core/communication/i_subscriber.h"
10 
11 namespace simulation_framework
12 {
13 namespace core
14 {
15 
21 enum class TopicType
22 {
23  kRTIDDS = 0,
24  kGRPC
25 };
26 using TopicId = std::string;
27 
32 class ITopic
33 {
34  public:
35  virtual ~ITopic() = default;
36 
40  virtual TopicId GetId() const = 0;
41 
45  virtual TopicType GetType() const = 0;
46 
50  virtual std::size_t SubscriberCount() const = 0;
51 
56  virtual std::size_t PublisherCount() const = 0;
57 
63  virtual void AddPublisher(std::unique_ptr<IPublisher> pub_ptr) = 0;
64 
69  virtual void AddSubscriber(std::unique_ptr<ISubscriber> sub_ptr) = 0;
70 
74  virtual void ClearPubSub() = 0;
75 
79  virtual const Subscribers& GetSubscribers() const = 0;
80 
84  virtual const Publishers& GetPublishers() const = 0;
85 };
86 
87 using TopicIdVector = std::vector<TopicId>;
88 using Topics = std::vector<std::shared_ptr<ITopic>>;
89 
90 } // namespace core
91 } // namespace simulation_framework

Connect with Ansys