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
@@ -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";
|
||||
}
|
||||
|
||||
+2
@@ -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)
|
||||
{}
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user