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:
torsten committed 2026-08-21 21:57:27 +02:00
1 parent 6588fc7d3f
commit 3cc3129de0
27 files changed
+339 -92

No files matched your search

@@ -60,7 +60,9 @@ include_directories(${CMAKE_SOURCE_DIR}/Lts/Viewer/SituationMap/Symbology)
include_directories(${CMAKE_SOURCE_DIR}/Lts/Viewer/LtsDataView)
include_directories(${CMAKE_SOURCE_DIR}/Lts/Proxies/TrainingAreaBase)
include_directories(${CMAKE_SOURCE_DIR}/include/ProjectDataManagement)
include_directories(${CMAKE_BINARY_DIR}/Lts/Services/ProjectDataManagement)
include_directories(${CMAKE_SOURCE_DIR}/Lts/Proxies/GuezNasat)
include_directories(${CMAKE_SOURCE_DIR}/Lts/DDS)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED 14)
SET(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
@@ -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
@@ -15,9 +15,14 @@ SET(pdm_combobox_gui_SRCS
)
NGL_WRAP_UI(pdm_combobox_gui_SRCS pdm_charge_selector.ui)
NGL_ADD_LIBRARY(WS PdmComboBoxGui STATIC ${pdm_combobox_gui_SRCS})
# Get include directories from svcPdmCommon (contains export header location)
GET_TARGET_PROPERTY(SVCPDMCOMMON_INCLUDE_DIRS svcPdmCommon INTERFACE_INCLUDE_DIRECTORIES)
NGL_TARGET_INCLUDE_DIRECTORIES(PdmComboBoxGui
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../..
${SVCPDMCOMMON_INCLUDE_DIRS}
)
NGL_TARGET_LINK_LIBRARIES(PdmComboBoxGui
PRIVATE
@@ -27,6 +32,7 @@ NGL_TARGET_LINK_LIBRARIES(PdmComboBoxGui
PdmGuiPluginInterface
Qt6::Core
svcPdmClient
svcPdmCommon
)
SET(pdm_combobox_gui_plugin_SRCS
@@ -43,6 +43,8 @@ NGL_TARGET_INCLUDE_DIRECTORIES(tabTelegrams
NGL_TARGET_LINK_LIBRARIES(tabTelegrams
PUBLIC
${_QT_CORE_TARGET}
Qt6::Gui
${_QT_NETWORK_TARGET}
)
# install on RPM build and copy for local builds so that LogView automatically finds the training_area_telegrams.h file
@@ -68,13 +70,12 @@ SET(SRCS_common
tab_export.h
)
# Generate tab_enums.idl / tab.idl
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
# Generate tab_db_impl.cpp/.h, tab_db.h
CODEGEN_DATABASE(SRCS_common ${xml_FILE})
# Generate *.cpp/*.hpp from idl (only with BUILD_RTI)
IF(BUILD_RTI)
# Generate tab_enums.idl / tab.idl
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
# Generate tab_db_impl.cpp/.h, tab_db.h
CODEGEN_DATABASE(SRCS_common ${xml_FILE})
# Generate *.cpp/*.hpp from idl (only with BUILD_RTI)
RTIDDSGEN(SRCS_common tab_enums.idl)
RTIDDSGEN(SRCS_common tab.idl)
# Generate tab_dt[s,c]_types.h, tab_ft[s,c]_types.h
@@ -82,10 +83,12 @@ IF(BUILD_RTI)
# generate tab_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
ELSE()
# Stub files for BUILD_RTI=OFF
SET(SRCS_common ${SRCS_common}
# Stub files for BUILD_RTI=OFF - NO code generation
LIST(APPEND SRCS_common
stubs/tab_enums_stub.hpp
stubs/tab_stub.hpp
stubs/tab_db_stub.hpp
stubs/tab_topic_type_plugin_stub.cpp
)
ENDIF()
@@ -109,7 +112,9 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcTabCommon
NGL_TARGET_LINK_LIBRARIES(svcTabCommon
PUBLIC
Qt6::Core
Qt6::Gui
Qt6::Sql
Qt6::Network
NGLLogger
ngldb
svcPdmCommon
@@ -131,8 +136,11 @@ NGL_INSTALL_TARGET(svcTabCommon)
SET(SRCS_client
tab_export.h
)
# generate tab_[d|f]tc_impl.[cpp|h]
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
IF(BUILD_RTI)
# generate tab_[d|f]tc_impl.[cpp|h]
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
ENDIF()
NGL_ADD_LIBRARY2(AAR SV WS HLA svcTabClient SHARED ${SRCS_client})
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabClient
@@ -160,8 +168,11 @@ SET(SRCS_server
tx_mixin.cpp
tx_mixin.h
)
# generate tab_[d|f]ts.h, tab_[d|f]ts_impl.[cpp|h]
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
IF(BUILD_RTI)
# generate tab_[d|f]ts.h, tab_[d|f]ts_impl.[cpp|h]
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
ENDIF()
NGL_ADD_LIBRARY2(AAR HLA SV svcTabServer SHARED ${SRCS_server}) # NGL_ADD_LIBRARY2 won't work here - no time for investigations
if(BUILD_SV OR BUILD_HLA)
@@ -173,27 +184,35 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcTabServer
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcTabServer
PRIVATE
RTI::nddscpp2
ddsconnector
ddsfts
PUBLIC
svcTabCommon
ngldb
${_QT_CORE_TARGET}
Qt6::Gui
${_QT_NETWORK_TARGET}
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcTabServer
PRIVATE
RTI::nddscpp2
ddsconnector
ddsfts
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcTabServer)
#
# --- Topic Type Plugin --------------------------------------------------------------
#
IF(BUILD_RTI)
CREATE_TOPIC_TYPE_PLUGIN(${xml_FILE})
ENDIF()
#
# --- RecordReplayPlugin --------------------------------------------------------------
#
IF(BUILD_RTI)
CREATE_RECORD_REPLAY_PLUGIN_SHARED(${xml_FILE})
IF (TARGET tabRecordReplayPlugin)
TARGET_SOURCES(tabRecordReplayPlugin
@@ -202,6 +221,7 @@ IF (TARGET tabRecordReplayPlugin)
tab_record_replay_plugin_custom.h
)
ENDIF()
ENDIF()
#
# --- Executable svcTrainingAreaBase (sTAB) -------------------------------------------------
@@ -251,8 +271,10 @@ SET(SRCS_exe
${xml_FILE}
)
# Generate tab.sql, tab.xml
CODEGEN_SQL(SRCS_exe ${xml_FILE})
IF(BUILD_RTI)
# Generate tab.sql, tab.xml
CODEGEN_SQL(SRCS_exe ${xml_FILE})
ENDIF()
NGL_ADD_SVC_ICON(SRCS_exe)
NGL_ADD_EXECUTABLE(AAR SV svcTrainingAreaBase ${SRCS_exe})
@@ -10,7 +10,7 @@ namespace TrainingAreaBase
{
using LOGGER_T = NGL::INGLLogger &;
TAB_COMMON_EXPORT LOGGER_T getLogger(const char *name);
SVCTABCOMMON_EXPORT LOGGER_T getLogger(const char *name);
inline LOGGER_T getLogger(const QString &loggerName)
{
return getLogger(loggerName.toUtf8().constData());
@@ -1,11 +0,0 @@
// Stub for tab_enums.hpp when BUILD_RTI=OFF
#pragma once
namespace TrainingAreaBase {
// Stub enums - replace with actual values as needed
enum class DataModification {
INSERT = 0,
UPDATE = 1,
DELETE = 2
};
}
@@ -1,7 +0,0 @@
// Stub for tab.hpp when BUILD_RTI=OFF
#pragma once
// Forward declarations and stubs for RTI types
namespace TrainingAreaBase {
// Add stub types as needed
}
@@ -67,14 +67,13 @@ public:
bool txData(const TetraIcd::OcCommand &data) override;
bool txData(const TrainingAreaBase::TetraIcd::ExFireReadiness &) override ;
bool txData(const TrainingAreaBase::TetraIcd::ExFiredReport &) override ;
bool txData(const TrainingAreaBase::TetraIcd::ExConfirmationReport &) override ;
private:
NGL::INGLLogger &m_logger;
bool txData(const TrainingAreaBase::TetraIcd::ExConfirmationReport &) override;
bool txData(const TetraIcd::UAVPerformMission &data) override;
bool txData(const TetraIcd::UAVChangeState &data) override;
template<typename T>
bool txDataToAll(const T &data);
private:
NGL::INGLLogger &m_logger;
QVector<std::shared_ptr<SendToTab>> m_txHandler;
@@ -8,7 +8,9 @@
#include "dds_handler.h"
#if BUILD_RTI
#include <DDS/Core/pacemaker.h>
#endif
namespace GuezMinelayerProcessing
{
@@ -16,14 +18,14 @@ namespace GuezMinelayerProcessing
#if BUILD_RTI
DdsHandler::DdsHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
: m_ddsConnector(ddsConnector)
, m_logger(getNGLLogger("GuezMinelayerProcessing.DdsHandler"))
, m_logger(getLogger("GuezMinelayerProcessing.DdsHandler"))
, m_topicLockMaster(std::make_shared<Core::TopicLockMaster>())
{
DEBUG_LOG(m_logger) << "DdsHandler(" << ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
#else
DdsHandler::DdsHandler()
: m_logger(getNGLLogger("GuezMinelayerProcessing.DdsHandler"))
: m_logger(getLogger("GuezMinelayerProcessing.DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler() - RTI DDS not enabled";
}
@@ -28,6 +28,7 @@ namespace GuezMinelayerProcessing
HandlerMinelayerData::HandlerMinelayerData(const std::shared_ptr<DdsHandler> &ddsHandler,
QObject *parent)
: QObject(parent)
, m_logger(getLogger("GuezMinelayerProcessing.HandlerMinelayerData"))
, m_ddsHandler(ddsHandler)
#if BUILD_RTI
, m_tabDtc(nullptr)
@@ -375,6 +376,7 @@ namespace GuezMinelayerProcessing
HandlerMinelayerData::HandlerMinelayerData(const std::shared_ptr<DdsHandler> &ddsHandler,
QObject *parent)
: QObject(parent)
, m_logger(getLogger("GuezMinelayerProcessing.HandlerMinelayerData"))
, m_ddsHandler(ddsHandler)
{}
@@ -16,7 +16,8 @@
using namespace GuezMinelayerProcessing;
Initialization::Initialization()
: m_ddsHandler(nullptr)
: m_logger(getLogger("GuezMinelayerProcessing.Initialization"))
, m_ddsHandler(nullptr)
#if BUILD_RTI
, m_handlerMinelayerData(nullptr)
#endif
@@ -56,7 +57,6 @@ bool Initialization::initialize(
return false;
}
#else
Q_UNUSED(ddsConnector)
// initialize DDS stub
m_ddsHandler.reset(new DdsHandler());
if (!m_ddsHandler->init())
@@ -4,8 +4,6 @@
# $Author$
#
IF(BUILD_RTI)
INCLUDE(MacroRTIDDSGen)
INCLUDE(MacroCodeGenIdl)
@@ -22,43 +20,75 @@ SET(SRCS_common
logger.h
)
# Generate pdm_enums.idl / pdm.idl
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
IF(BUILD_RTI)
# Generate pdm_enums.idl / pdm.idl
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
# Generate pdm_db.h
CODEGEN_DATABASE_STRUCTS(SRCS_common ${xml_FILE})
# Generate pdm_db_impl.cpp/.h,
CODEGEN_DATABASE_SQL(SRCS_common ${xml_FILE})
# Generate pdm_db.h
CODEGEN_DATABASE_STRUCTS(SRCS_common ${xml_FILE})
# Generate pdm_db_impl.cpp/.h,
CODEGEN_DATABASE_SQL(SRCS_common ${xml_FILE})
# Generate *.cpp/*.hpp from idl
RTIDDSGEN(SRCS_common pdm_enums.idl)
RTIDDSGEN(SRCS_common pdm.idl)
# Generate *.cpp/*.hpp from idl
RTIDDSGEN(SRCS_common pdm_enums.idl)
RTIDDSGEN(SRCS_common pdm.idl)
# Generate pdm_dt[s,c]_types.h, pdm_ft[s,c]_types.h
CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
# generate pdm_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
# Generate pdm_dt[s,c]_types.h, pdm_ft[s,c]_types.h
CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
# generate pdm_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
ELSE()
# Stub files for BUILD_RTI=OFF - NO code generation
LIST(APPEND SRCS_common
stubs/pdm_enums_stub.hpp
stubs/pdm_stub.hpp
stubs/pdm_db_stub.hpp
)
ENDIF()
# Create target only if component flags allow
NGL_ADD_LIBRARY2(AAR SV WS HLA svcPdmCommon SHARED ${SRCS_common})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPdmCommon
# Generate export header ALWAYS (needed even if target not built)
IF(NOT TARGET svcPdmCommon)
# Create a dummy static library just for export header generation
ADD_LIBRARY(svcPdmCommon STATIC ${SRCS_common})
ENDIF()
# Generate export header BEFORE setting include directories
GENERATE_EXPORT_HEADER(svcPdmCommon EXPORT_FILE_NAME "svcpdmcommon_export.h")
# Include directories for svcPdmCommon (must include build dir for export header)
IF(TARGET svcPdmCommon)
TARGET_INCLUDE_DIRECTORIES(svcPdmCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include/ProjectDataManagement
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
${CMAKE_CURRENT_SOURCE_DIR}/stubs
${CMAKE_CURRENT_BINARY_DIR}/stubs
)
ENDIF()
NGL_TARGET_LINK_LIBRARIES(svcPdmCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
Qt6::Core
NGLLogger
LtsUtilsCore
ngldb
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcPdmCommon
PRIVATE
RTI::nddscpp2
PUBLIC
Qt6::Core
ddscore
NGLLogger
LtsUtilsCore
ngldb
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcPdmCommon)
IF(BUILD_RTI)
#
# --- Library svcPdmClient --------------------------------------------------------------------------------
#
@@ -9,13 +9,14 @@
#pragma once
#include <NGLLogger/INGLLogger.h>
#include <QString>
#include "svcpdmcommon_export.h"
namespace ProjectDataManagement
{
using LOGGER_T = NGL::INGLLogger &;
PDM_COMMON_EXPORT LOGGER_T getLogger(const char *name);
SVCPDMCOMMON_EXPORT LOGGER_T getLogger(const char *name);
inline LOGGER_T getLogger(const QString &loggerName)
{
return getLogger(loggerName.toUtf8().constData());
@@ -13,6 +13,10 @@
namespace ProjectDataManagement
{
// Forward declaration for helper function
static QString toString(VulnerabilityState vs);
//
// VulnerabilityState + VulnerabilityClass
//
@@ -97,7 +101,6 @@ static QString toStringSoldier(VulnerabilityState vs)
case 14:
case 15:
case 16:
case 4:
case 6:
case 0:
case 17:
@@ -24,15 +24,17 @@ namespace RoutingService
Connection::Connection(const dds::domain::DomainParticipant &domainParticipant,
const std::string &partition,
const std::vector<TopicDispatcherInterface *> &topicsToRoute,
const std::string &desc) : m_output(nullptr)
const std::string &desc)
: m_output(nullptr)
, m_domainParticipant(domainParticipant)
, m_publisher(new DDSConnector::Publisher(domainParticipant, partition))
, m_subscriber(new DDSConnector::Subscriber(domainParticipant, partition, false))
, m_dataWriterTask(nullptr)
, m_topicsToRoute(topicsToRoute)
, m_partition(partition)
, m_description(desc),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
, m_description(desc)
, m_logger(getLogger("Connection"))
{
INFO_LOG(m_logger) << "Create connection: " << partition
<< ", domain: " << domainParticipant.domain_id()
<< ", direction: " << m_description
@@ -39,7 +39,6 @@ public:
dds::sub::Subscriber subscriber() const;
private:
NGL::INGLLogger &m_logger;
bool initTopics();
private:
@@ -11,13 +11,15 @@
namespace RoutingService
{
DataWriterTask::DataWriterTask()
: m_doShutdown(false)
: m_logger(getLogger("DataWriterTask"))
, m_doShutdown(false)
{
DEBUG_LOG(m_logger) << this << ": init ";
}
DataWriterTask::~DataWriterTask()
{
#if BUILD_RTI
std::lock_guard<std::mutex> lock(m_queueLock);
DEBUG_LOG(m_logger) << this << ": Cleaning up remaining writers: " << m_writerQueue.size();
while (!m_writerQueue.empty())
@@ -25,8 +27,10 @@ DataWriterTask::~DataWriterTask()
delete m_writerQueue.front();
m_writerQueue.pop();
}
#endif
}
#if BUILD_RTI
void DataWriterTask::enqueue(SampleWriterInterface *swi)
{
std::lock_guard<std::mutex> lock(m_queueLock);
@@ -100,5 +104,6 @@ void DataWriterTask::writeSamples()
}
}
}
#endif // BUILD_RTI
} // namespace RoutingService
@@ -12,10 +12,11 @@
#include <mutex>
#include <condition_variable>
#include "logger.h"
#if BUILD_RTI
#include <DDS/Routing/routing_plugin.h>
#endif
#include "logger.h"
namespace RoutingService
{
@@ -25,16 +26,27 @@ public:
DataWriterTask();
~DataWriterTask();
#if BUILD_RTI
void enqueue(SampleWriterInterface *swi) override;
void shutdown();
bool waitForData();
SampleWriterInterface *getNextSampleWriter();
void writeSamples();
#else
// Stub methods when BUILD_RTI is disabled
void enqueue(void* /*swi*/) override {}
void shutdown() {}
bool waitForData() { return false; }
void *getNextSampleWriter() { return nullptr; }
void writeSamples() {}
#endif
private:
NGL::INGLLogger &m_logger;
#if BUILD_RTI
std::queue<SampleWriterInterface *> m_writerQueue;
#endif
std::mutex m_queueLock;
std::condition_variable m_waitForDataCondition;
bool m_doShutdown;
@@ -12,9 +12,12 @@
#if BUILD_RTI
namespace RoutingService
{
Session::Session(const QString &partitionNameSv, const QString &partitionNameWs) : m_partitionNameSv(partitionNameSv.toStdString())
, m_partitionNameWs(partitionNameWs.toStdString()),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
Session::Session(const QString &partitionNameSv, const QString &partitionNameWs)
: m_partitionNameSv(partitionNameSv.toStdString())
, m_partitionNameWs(partitionNameWs.toStdString())
, m_logger(getLogger("Session"))
{
}
Session::~Session()
{
@@ -10,6 +10,9 @@
#include <string>
#include <QString>
#include "logger.h"
#if BUILD_RTI
#include "connection.h"
#endif
@@ -1,6 +0,0 @@
// Auto-generated export macro for PDM Common
// Stub for BUILD_RTI=OFF or missing dependency
#ifndef PDM_COMMON_EXPORT
#define PDM_COMMON_EXPORT
#endif