- new_docker_build.sh: --run-coverage now instruments the RelWithDebInfo build with -O0 -g --coverage (CMAKE_*_FLAGS_RELWITHDEBINFO), runs ctest and collects an lcov report (capture/extract/genhtml/summary) under <pipeline-root>/coverage/<project>/<os>; the lcov steps share an ignore-errors list for the -O0 data quirks (inconsistent, count, ...). - Lts/DDS/DTC/generic_dtc.h: remove the one-line forwarders that called the pure virtuals of GenericDtcSC (latent infinite recursion, and an undefined symbol at link time at -O0, e.g. coverage builds); the concrete classes in generic_dtc_impl.h implement every method final, and the 'using' declarations keep the base methods accessible. - README.md: document the coverage flow (Step 6), update the option rows and add a troubleshooting entry for the -O0 pure-virtual link failure.
136 lines
5.6 KiB
C++
136 lines
5.6 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* DTC TypeDefinitions
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Include Qt headers FIRST to prevent namespace pollution when RTI DDS headers include Qt
|
|
#include <QtCore/QString>
|
|
#include <QtCore/QUrl>
|
|
#include <QtCore/QFlag>
|
|
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
|
|
#include <dds/sub/LoanedSamples.hpp>
|
|
|
|
namespace NGLLogger
|
|
{
|
|
class INGLLogger;
|
|
}
|
|
|
|
namespace DTC
|
|
{
|
|
class SubscriberListener;
|
|
|
|
template <typename DRO_OBJECT, typename SC> 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<TopicType> readAlive() const = 0;
|
|
virtual bool readAlive(TopicType& data) = 0;
|
|
virtual dds::sub::LoanedSamples<TopicType> takeAlive() const = 0;
|
|
virtual bool takeAlive(TopicType& data) = 0;
|
|
virtual dds::sub::LoanedSamples<TopicType> 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 <typename DRO_OBJECT>
|
|
class GenericDtc
|
|
: public GenericDtcSC<DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, DataModification)>>
|
|
{
|
|
public:
|
|
using BaseClass = GenericDtcSC<DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, DataModification)>>;
|
|
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 <typename DRO_OBJECT>
|
|
class GenericDtcSampleInfo
|
|
: public GenericDtcSC<DRO_OBJECT,
|
|
std::function<void(const typename DRO_OBJECT::TopicType&, const dds::sub::SampleInfo&)>>
|
|
{
|
|
public:
|
|
using BaseClass = GenericDtcSC<DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, const dds::sub::SampleInfo&)>>;
|
|
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 <typename DRO_OBJECT>
|
|
class Ddtc
|
|
: public GenericDtcSC<
|
|
DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, const std::string&, DataModification)>>
|
|
{
|
|
public:
|
|
using BaseClass = GenericDtcSC<DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, const std::string&, DataModification)>>;
|
|
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 <typename DRO_OBJECT>
|
|
class DdtcSampleInfo
|
|
: public GenericDtcSC<DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, const std::string&,
|
|
const dds::sub::SampleInfo&)>>
|
|
{
|
|
public:
|
|
using BaseClass = GenericDtcSC<DRO_OBJECT, std::function<void(const typename DRO_OBJECT::TopicType&, const std::string&, const dds::sub::SampleInfo&)>>;
|
|
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
|