/** * @RDE_HEADER@ * DTC TypeDefinitions * $Id$ * $HeadURL$ * $Author$ */ #pragma once // Include Qt headers FIRST to prevent namespace pollution when RTI DDS headers include Qt #include #include #include #include #include namespace NGLLogger { class INGLLogger; } namespace DTC { class SubscriberListener; template class GenericDtcSC { public: using DataReaderObject = DRO_OBJECT; using SubscriberCallback = SC; using TopicType = typename DRO_OBJECT::TopicType; GenericDtcSC() = default; virtual ~GenericDtcSC() = default; virtual bool setSubscriberCallback(const SubscriberCallback& subscriberCallback) = 0; virtual dds::sub::LoanedSamples readAlive() const = 0; virtual bool readAlive(TopicType& data) = 0; virtual dds::sub::LoanedSamples takeAlive() const = 0; virtual bool takeAlive(TopicType& data) = 0; virtual dds::sub::LoanedSamples takeDisposed() const = 0; virtual bool takeDisposed(TopicType& data) = 0; virtual bool hasSamples() const = 0; virtual DataReaderObject* dataReader() const = 0; virtual bool waitForHistoricalData(int timeoutMSec) = 0; }; template class GenericDtc : public GenericDtcSC> { public: using BaseClass = GenericDtcSC>; using TopicType = typename BaseClass::TopicType; // Explicitly expose base class methods for accessibility through smart pointers using BaseClass::readAlive; using BaseClass::takeAlive; using BaseClass::takeDisposed; using BaseClass::SubscriberCallback; // NOTE: the methods of GenericDtcSC are deliberately NOT overridden here. // They stay pure and are implemented by the concrete classes in // generic_dtc_impl.h; calls through this class dispatch virtually. // One-line forwarders like `return BaseClass::readAlive(data);` must not be // re-introduced: they are a latent infinite recursion at runtime and an // undefined pure-virtual symbol at link time at -O0 (e.g. coverage builds). }; template class GenericDtcSampleInfo : public GenericDtcSC> { public: using BaseClass = GenericDtcSC>; using TopicType = typename BaseClass::TopicType; // Explicitly expose base class methods for accessibility through smart pointers using BaseClass::readAlive; using BaseClass::takeAlive; using BaseClass::takeDisposed; using BaseClass::SubscriberCallback; // NOTE: the methods of GenericDtcSC are deliberately NOT overridden here. // They stay pure and are implemented by the concrete classes in // generic_dtc_impl.h; calls through this class dispatch virtually. // One-line forwarders like `return BaseClass::readAlive(data);` must not be // re-introduced: they are a latent infinite recursion at runtime and an // undefined pure-virtual symbol at link time at -O0 (e.g. coverage builds). }; template class Ddtc : public GenericDtcSC< DRO_OBJECT, std::function> { public: using BaseClass = GenericDtcSC>; using TopicType = typename BaseClass::TopicType; // Explicitly expose base class methods for accessibility through smart pointers using BaseClass::readAlive; using BaseClass::takeAlive; using BaseClass::takeDisposed; using BaseClass::SubscriberCallback; // NOTE: the methods of GenericDtcSC are deliberately NOT overridden here. // They stay pure and are implemented by the concrete classes in // generic_dtc_impl.h; calls through this class dispatch virtually. // One-line forwarders like `return BaseClass::readAlive(data);` must not be // re-introduced: they are a latent infinite recursion at runtime and an // undefined pure-virtual symbol at link time at -O0 (e.g. coverage builds). }; template class DdtcSampleInfo : public GenericDtcSC> { public: using BaseClass = GenericDtcSC>; using TopicType = typename BaseClass::TopicType; // Explicitly expose base class methods for accessibility through smart pointers using BaseClass::readAlive; using BaseClass::takeAlive; using BaseClass::takeDisposed; using BaseClass::SubscriberCallback; // NOTE: the methods of GenericDtcSC are deliberately NOT overridden here. // They stay pure and are implemented by the concrete classes in // generic_dtc_impl.h; calls through this class dispatch virtually. // One-line forwarders like `return BaseClass::readAlive(data);` must not be // re-introduced: they are a latent infinite recursion at runtime and an // undefined pure-virtual symbol at link time at -O0 (e.g. coverage builds). }; } // namespace DTC