#pragma once /** * @file generic_data_reader.h * @brief Generic Data Reader wrapper for DDS * * Provides GenericDataReader template class that wraps RTI DataReader * when BUILD_RTI=ON, or provides stub implementation when BUILD_RTI=OFF. */ #include #include #ifdef BUILD_RTI // RTI DDS is available - include full implementation from Lts // MUST be included BEFORE namespace DDSGeneric to avoid namespace pollution #include #include namespace DDSGeneric { // Full implementation is in Lts/DDS/Generic/generic_data_reader.h // This file just provides the include path redirection } // namespace DDSGeneric #else // BUILD_RTI=OFF: Provide minimal stub definitions for RTI types namespace dds { namespace sub { namespace detail { // Dummy delegate class to serve as default template parameter template class DataReaderImpl { // Empty stub implementation }; } // namespace detail // Forward declaration stub for DataReader // Must match RTI 7.7 signature for compatibility template class DELEGATE = detail::DataReaderImpl> class DataReader { public: // Minimal stub interface - add methods as needed by the codebase T read() { return T{}; } void take() {} }; } // namespace sub } // namespace dds namespace DDSGeneric { // GenericDataReader stub template (only when BUILD_RTI=OFF) template class GenericDataReader { public: using TopicType = T; using TopicTypeRead = T; using DataReader = void*; using DataTopic = void*; using DataReaderQos = void*; using SubscriberCallback = std::function; using SubscriberCallbackWithSampleInfo = std::function; GenericDataReader() : m_dataReader(nullptr), m_ddsTopic(nullptr), m_bHaveSubscriberCallback(false) { } virtual ~GenericDataReader() { m_ddsTopic = nullptr; m_dataReader = nullptr; } DataReader getDataReader() const { return m_dataReader; } bool create(const void* domainParticipant, const void* ddsSubscriber, const std::string& topicName = std::string(), bool bCreateDataReader = true) { return false; } bool hasSamples() const { return false; } void* readAlive(bool& bSeenNewSamples) { bSeenNewSamples = false; return nullptr; } void* takeAlive(bool& bSeenNewSamples) { bSeenNewSamples = false; return nullptr; } void* takeDisposed() { return nullptr; } template bool read(C callbackFunc) { return false; } void setHaveSubscriberCallback(bool bHave) { m_bHaveSubscriberCallback = bHave; } std::string topicName() const { return std::string(); } DataReader dataReader() const { return m_dataReader; } virtual void recreateReader() { } protected: DataReader m_dataReader; DataReaderQos m_dataReaderQos; DataTopic m_ddsTopic; bool m_bHaveSubscriberCallback; }; template class GenericDataReaderContentFilter { public: using DataType = T; // Minimal stub - extend as needed }; // DynamicDataReader stub for BUILD_RTI=OFF class DynamicDataReader { public: using TopicType = void*; using DataReader = void*; using DataTopic = void*; DynamicDataReader() {} ~DynamicDataReader() {} bool create(const void* domainParticipant, const void* ddsSubscriber, const std::string& specialTopicName, const void* structType) { return false; } bool hasSamples() const { return false; } }; } // namespace DDSGeneric #endif // BUILD_RTI