BUILD_RTI guards for DDS/Routing modules + logger init fixes
- Lts/DDS: Add BUILD_RTI guards to pacemaker.h, dds_connector.h, generic_fts_* files, generic_base.h, routing_plugin.h - Lts/Services/RoutingServiceNG: Add BUILD_RTI guards to session.h/cpp, connection.h/cpp, data_writer_task.h/cpp - Fix C++23 reference member initialization: use getLogger() instead of getNGLLogger() in constructor initializer lists - Root CMakeLists.txt: Add Lts/DDS to include_directories - Fix export header generation order (GENERATE_EXPORT_HEADER before TARGET_INCLUDE_DIRECTORIES) - Remove auto-generated stub files (external deps collected separately)
This commit is contained in:
1 parent
6588fc7d3f
commit
3cc3129de0
27 files changed
+339
-92
No files matched your search
@@ -4,7 +4,9 @@
|
||||
|
||||
#include "svccoreclient_export.h"
|
||||
|
||||
#if BUILD_RTI
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
#endif
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
@@ -25,36 +27,51 @@ class CORE_CLIENT_EXPORT Pacemaker final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
#if BUILD_RTI
|
||||
explicit Pacemaker(const std::shared_ptr<DDSConnector::DdsConnector>& ddsConnector) : Pacemaker(ddsConnector.get())
|
||||
{
|
||||
}
|
||||
|
||||
explicit Pacemaker(DDSConnector::DdsConnector* ddsConnector);
|
||||
#else
|
||||
explicit Pacemaker(void* /*ddsConnector*/) {}
|
||||
explicit Pacemaker() {}
|
||||
#endif
|
||||
~Pacemaker();
|
||||
|
||||
#if BUILD_RTI
|
||||
void startTimer();
|
||||
#endif
|
||||
|
||||
public Q_SLOTS:
|
||||
#if BUILD_RTI
|
||||
void setNewState(Core::RunningState newState, const QString& errorString = QString());
|
||||
void addPort(unsigned short number, Core::PortType portType, const QString& properties = QStringLiteral(""));
|
||||
|
||||
void publishState();
|
||||
#endif
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
#if BUILD_RTI
|
||||
void init(DDSConnector::DdsConnector* ddsConnector);
|
||||
void setNewStateInternal(Core::RunningState newState, const QString& errorString = QString());
|
||||
void addPortInternal(unsigned short number, Core::PortType portType,
|
||||
const QString& properties = QStringLiteral(""));
|
||||
#endif
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
static constexpr const int m_publishTimerDelay = 3000;
|
||||
|
||||
#if BUILD_RTI
|
||||
CurrentRunningState m_state;
|
||||
#endif
|
||||
QTimer* m_publishTimer = nullptr;
|
||||
QThread* m_paceThread = nullptr;
|
||||
|
||||
#if BUILD_RTI
|
||||
DTS::CurrentRunningStateImpl* m_dtsCurrentRunningState;
|
||||
#endif
|
||||
};
|
||||
} // namespace Core
|
||||
@@ -6,10 +6,13 @@
|
||||
#include <Lts/Common/ProjectConfig/project_defines.h>
|
||||
#include <QUrl>
|
||||
#include <QtCore/QStringList>
|
||||
#include <ddsconnector_export.h>
|
||||
|
||||
#if BUILD_RTI
|
||||
#include <dds/pub/CoherentSet.hpp>
|
||||
#include <dds/pub/Publisher.hpp>
|
||||
#include <dds/sub/Subscriber.hpp>
|
||||
#include <ddsconnector_export.h>
|
||||
#endif
|
||||
|
||||
class QObject;
|
||||
|
||||
@@ -21,11 +24,6 @@ enum class ConnectionType;
|
||||
}
|
||||
} // namespace DDS
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
namespace DDSGeneric
|
||||
{
|
||||
class WaitSetHandler;
|
||||
@@ -37,8 +35,17 @@ namespace DDSConnector
|
||||
class Publisher;
|
||||
class Subscriber;
|
||||
|
||||
#if !BUILD_RTI
|
||||
// Stub types for RTI DDS when BUILD_RTI=OFF
|
||||
namespace dds { namespace domain { class DomainParticipant; } }
|
||||
namespace dds { namespace pub { class Publisher; } }
|
||||
namespace dds { namespace sub { class Subscriber; } }
|
||||
namespace dds { namespace topic { template<typename T> class Filter; } }
|
||||
#endif
|
||||
|
||||
class DDSCONNECTOR_EXPORT DdsConnector
|
||||
{
|
||||
#if BUILD_RTI
|
||||
DdsConnector(int domainId, const dds::domain::DomainParticipant& domainParticipant,
|
||||
IDL::PartitionType defaultPartitionType, int partitionId, int exerciseId,
|
||||
DDS::QosProfile::ConnectionType connectionType, const QUrl& tcpConnectionUrl);
|
||||
@@ -169,6 +176,36 @@ class DDSCONNECTOR_EXPORT DdsConnector
|
||||
IDL::toStdString(m_defaultPartitionType), m_partitionId);
|
||||
return ftc;
|
||||
}
|
||||
#else
|
||||
// Stub constructor and methods when BUILD_RTI=OFF
|
||||
DdsConnector() = default;
|
||||
virtual ~DdsConnector() = default;
|
||||
|
||||
// Stub methods
|
||||
bool init(const QStringList& /*qosFileList*/ = QStringList()) { return false; }
|
||||
void* getDomainParticipant() const { return nullptr; }
|
||||
void setDomainParticipant(void* /*participant*/) {}
|
||||
Publisher* getPublisher() { return nullptr; }
|
||||
void* getDdsPublisher() const { return nullptr; }
|
||||
void setPublisher(Publisher* /*publisher*/) {}
|
||||
void enableBatchedWriter(bool /*bEnable*/) {}
|
||||
Subscriber* getSubscriber() { return nullptr; }
|
||||
void* getDdsSubscriber() const { return nullptr; }
|
||||
void setSubscriber(Subscriber* /*subscriber*/) {}
|
||||
void* getSubscriberListener() { return nullptr; }
|
||||
const void* getWaitSetHandler() const { return nullptr; }
|
||||
int getDomainId() const { return 0; }
|
||||
int getPartitionType() const { return 0; }
|
||||
int getPartitionId() const { return 0; }
|
||||
int getExerciseId() const { return 0; }
|
||||
std::string getDefaultPartition() const { return ""; }
|
||||
QUrl getTcpConnectionUrl() const { return QUrl(); }
|
||||
static std::string getPartitionString(int /*pt*/, int /*partitionId*/ = -1) { return ""; }
|
||||
void initPublisherSubscriber() {}
|
||||
void initPublisher() {}
|
||||
void initSubscriber() {}
|
||||
void initDomainParticipant() {}
|
||||
#endif
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
@@ -184,12 +221,15 @@ class DDSCONNECTOR_EXPORT DdsConnector
|
||||
|
||||
QUrl m_tcpConnectionUrl;
|
||||
DDS::QosProfile::ConnectionType m_connectionType;
|
||||
#if BUILD_RTI
|
||||
dds::domain::DomainParticipant m_domainParticipant;
|
||||
#endif
|
||||
DDSConnector::Publisher* m_publisher;
|
||||
DDSConnector::Subscriber* m_subscriber;
|
||||
DDSGeneric::WaitSetHandler* m_wsHandler;
|
||||
};
|
||||
|
||||
#if BUILD_RTI
|
||||
class CoherentSet
|
||||
{
|
||||
public:
|
||||
@@ -201,5 +241,15 @@ class CoherentSet
|
||||
NGL::INGLLogger& m_logger;
|
||||
dds::pub::CoherentSet m_coherentSet;
|
||||
};
|
||||
#else
|
||||
// Stub CoherentSet when BUILD_RTI=OFF
|
||||
class CoherentSet
|
||||
{
|
||||
public:
|
||||
explicit CoherentSet(const std::shared_ptr<DdsConnector>& /*connector*/) {}
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace DDSConnector
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if BUILD_RTI
|
||||
|
||||
#include "connext.h"
|
||||
#include "generic_fts_internal.h"
|
||||
|
||||
@@ -255,3 +257,5 @@ class GenericFtsImpl final : public GenericFts<TOPICTYPE_REQUEST, TOPICTYPE_REPL
|
||||
};
|
||||
|
||||
} // namespace FTS
|
||||
|
||||
#endif // BUILD_RTI
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
|
||||
#include "generic_fts_internal.h"
|
||||
|
||||
#if BUILD_RTI
|
||||
|
||||
#include <DDS/QosProfile/DDS_DefaultQos.h>
|
||||
#include <QMetaMethod>
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
@@ -45,4 +48,6 @@ void GenericFtsInternal::dataAvailable()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BUILD_RTI
|
||||
@@ -8,9 +8,9 @@
|
||||
#if BUILD_RTI
|
||||
#include <DDS/Core/topic_lock_master.h>
|
||||
#include <DDS/Generic/wait_set_handler.h>
|
||||
#endif
|
||||
#include <dds/sub/qos/DataReaderQos.hpp>
|
||||
#include <dds/pub/qos/DataWriterQos.hpp>
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@@ -25,9 +25,11 @@ namespace FTS
|
||||
protected:
|
||||
GenericFtsInternal() = default;
|
||||
|
||||
#if BUILD_RTI
|
||||
static void printDefaultQos(NGL::INGLLogger &logger);
|
||||
static dds::sub::qos::DataReaderQos readerQos(NGL::INGLLogger &logger);
|
||||
static dds::pub::qos::DataWriterQos writerQos(NGL::INGLLogger &logger);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#if BUILD_RTI
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if BUILD_RTI
|
||||
#include <dds/core/xtypes/DynamicData.hpp>
|
||||
#include <dds/core/xtypes/DynamicType.hpp>
|
||||
#include <dds/topic/Topic.hpp>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <ddsgen_export.h>
|
||||
@@ -26,6 +28,7 @@ struct topic_type_name {
|
||||
return dds::topic::topic_type_name<T>::value();
|
||||
}
|
||||
};
|
||||
#if BUILD_RTI
|
||||
template<>
|
||||
struct topic_type_name<dds::core::xtypes::DynamicData> {
|
||||
static std::string value() {
|
||||
@@ -38,6 +41,7 @@ struct topic_type_name<rti::core::xtypes::DynamicTypeImpl> {
|
||||
return "dds::topic::DynamicTypeImpl::value()";
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
namespace Helper
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <DDS/Generic/generic_base.h>
|
||||
#include <DDS/QosProfile/DDS_DefaultQos.h>
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
#if BUILD_RTI
|
||||
#include <dds/pub/DataWriter.hpp>
|
||||
#include <dds/pub/discovery.hpp>
|
||||
#include <dds/sub/DataReader.hpp>
|
||||
@@ -333,3 +335,99 @@ class FunctionTopicRequestDispatcher final : public TopicDispatcher<typename FTC
|
||||
};
|
||||
|
||||
} // namespace RoutingService
|
||||
|
||||
#else // BUILD_RTI=OFF - Stub declarations
|
||||
|
||||
namespace RoutingService
|
||||
{
|
||||
// Stub interfaces when BUILD_RTI=OFF
|
||||
class SampleWriterInterface
|
||||
{
|
||||
public:
|
||||
SampleWriterInterface() = default;
|
||||
virtual ~SampleWriterInterface() = default;
|
||||
virtual void writeSamples() = 0;
|
||||
virtual NGL::INGLLogger& logger() = 0;
|
||||
};
|
||||
|
||||
class DataWriterTaskInterface
|
||||
{
|
||||
public:
|
||||
DataWriterTaskInterface() = default;
|
||||
virtual ~DataWriterTaskInterface() = default;
|
||||
virtual void enqueue(SampleWriterInterface* /*swi*/) = 0;
|
||||
};
|
||||
|
||||
class TopicDispatcherInterface
|
||||
{
|
||||
public:
|
||||
TopicDispatcherInterface() = default;
|
||||
virtual ~TopicDispatcherInterface() = default;
|
||||
virtual bool init(DataWriterTaskInterface* /*dwt*/, void* /*dpIn*/, void* /*subIn*/, void* /*dpOut*/,
|
||||
void* /*pubOut*/) = 0;
|
||||
virtual void shutdown() = 0;
|
||||
};
|
||||
|
||||
// Stub template classes when BUILD_RTI=OFF
|
||||
template <typename TOPIC> class SampleWriter final : public SampleWriterInterface
|
||||
{
|
||||
public:
|
||||
SampleWriter(void* /*samples*/, void* /*dataWriter*/, bool /*bWithOriginalIdentity*/, NGL::INGLLogger& /*logger*/)
|
||||
{
|
||||
}
|
||||
void writeSamples() override {}
|
||||
NGL::INGLLogger& logger() override
|
||||
{
|
||||
static NGL::INGLLogger dummyLogger;
|
||||
return dummyLogger;
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
|
||||
template <typename TOPIC> class TopicDispatcher : public TopicDispatcherInterface
|
||||
{
|
||||
protected:
|
||||
explicit TopicDispatcher(NGL::INGLLogger& /*logger*/, const std::string& /*topicName*/, int /*topicType*/) {}
|
||||
~TopicDispatcher() { shutdown(); }
|
||||
bool init(DataWriterTaskInterface* /*dwt*/, void* /*dpIn*/, void* /*subIn*/, void* /*dpOut*/,
|
||||
void* /*pubOut*/) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void shutdown() override {}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
|
||||
template <typename TOPIC> class DataTopicDispatcher final : public TopicDispatcher<TOPIC>
|
||||
{
|
||||
public:
|
||||
explicit DataTopicDispatcher(NGL::INGLLogger& logger) : TopicDispatcher<TOPIC>(logger, "", 0) {}
|
||||
};
|
||||
|
||||
template <typename FTS_TOPIC>
|
||||
class FunctionTopicReplyDispatcher final : public TopicDispatcher<typename FTS_TOPIC::ReplyTopic>
|
||||
{
|
||||
public:
|
||||
explicit FunctionTopicReplyDispatcher(NGL::INGLLogger& logger)
|
||||
: TopicDispatcher<typename FTS_TOPIC::ReplyTopic>(logger, "", 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FTC_TOPIC>
|
||||
class FunctionTopicRequestDispatcher final : public TopicDispatcher<typename FTC_TOPIC::RequestTopic>
|
||||
{
|
||||
public:
|
||||
explicit FunctionTopicRequestDispatcher(NGL::INGLLogger& logger)
|
||||
: TopicDispatcher<typename FTC_TOPIC::RequestTopic>(logger, "", 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace RoutingService
|
||||
|
||||
#endif // BUILD_RTI
|
||||
Reference in new issue
Block a user