#ifndef FAST_DDS_GENERATED__IPublisher_HPP #define FAST_DDS_GENERATED__IPublisher_HPP #include #include "testPubSubTypes.hpp" // 定义 PubSubType 模板类 template class PubSubType { // 可以在这里添加一些通用的成员函数或数据成员 }; // 定义基础模板结构体,用于生成新的类型名称 template struct MakePubSubType; // 默认实现,可以抛出编译错误或提供默认类型 template struct MakePubSubType { using Type = void; static_assert(std::is_void::value, "No appropriate MessageSubType found for MessageT"); }; // 特化 MakePubSubType 以关联 HelloSecurity 和 HelloSecurityPubSubType template <> struct MakePubSubType { using Type = HelloSecurityPubSubType; }; template <> struct MakePubSubType { using Type = OneMessagePubSubType; }; // 抽象接口类,使用模板参数 template class IPublisher { public: virtual ~IPublisher() {} virtual bool publish(const T& msg) = 0; std::string topicName_; std::string getTopic() const { return topicName_; } virtual void stop() = 0; }; #endif