#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 namespace DDSGeneric { #ifdef BUILD_RTI // RTI DDS is available - include full DynamicDataReader implementation #include // Forward declaration stub for DataReader // RTI 7.7 signature: template class DELEGATE = dds::sub::detail::DataReaderImpl> template class GenericDataReader { public: using DataType = T; using ReaderType = dds::sub::DataReader; // Minimal interface - extend as needed bool has_data() const { return false; } T read_data() { return T{}; } void cleanup() {} // Access to underlying RTI reader if needed ReaderType& reader() { return m_reader; } const ReaderType& reader() const { return m_reader; } private: ReaderType m_reader; }; template class GenericDataReaderContentFilter { public: using DataType = T; // Minimal stub - extend as needed }; #else // BUILD_RTI=OFF: Provide minimal stub definitions 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 // GenericDataReader stub template template class GenericDataReader { public: using DataType = T; // Minimal stub methods - extend as needed bool has_data() const { return false; } T read_data() { return T{}; } void cleanup() {} }; 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; } }; #endif // BUILD_RTI } // namespace DDSGeneric