- dynamic_data_reader.h: Add #include <rti/core/xtypes/DynamicDataImpl.hpp> to resolve incomplete type error when deleting DynamicDataImpl pointers - generic_dts_impl.h: Add m_logger member variable declaration (LOGGER_T&) - dynamic_data_reader.h: Add m_logger member variable declaration (LOGGER_T&) - pub_sub_base.cpp: Fix logger initialization to use NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger() instead of non-existent NGL::getNGLLogger() - lts_session_data_dds.h: Add DataPluginBase::Interface forward declaration to both #ifdef BUILD_RTI and #else blocks for consistent compilation - LtsUtilsCore/CMakeLists.txt: Fix include path from /.. to /../.. for LtsUtilsCoreHeaderOnly target - tests/CMakeLists.txt: Move Grantlee test filtering BEFORE executable creation to prevent build failures when Grantlee is disabled Build validation: - BUILD_RTI=OFF: ✅ 0 errors (previously completed) - BUILD_RTI=ON: ✅ DDS core components compile successfully - libddsconnector.so created successfully - Remaining build errors in unrelated modules (IsmDataPluginInterface, IsmShared, BuildingControlBsm) are pre-existing dependency issues C++ Standard: Enforcing C++17 across all builds due to RTI Connext DDS 7.7.0 incompatibility with C++20/C++23 (known header bugs with newer standards). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
78 lines
2.5 KiB
C++
78 lines
2.5 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include "generic_dts.h"
|
|
|
|
#include <DDS/Generic/generic_data_writer.h>
|
|
#include <DDS/Generic/generic_logger.h>
|
|
|
|
namespace DTS
|
|
{
|
|
template <typename DWO_OBJECT> class GenericDtsImpl final : public GenericDts<typename DWO_OBJECT::TopicType>
|
|
{
|
|
public:
|
|
using DataWriterObject = DWO_OBJECT;
|
|
using TopicType = typename DWO_OBJECT::TopicType;
|
|
using DataWriter = typename dds::pub::DataWriter<TopicType>;
|
|
|
|
GenericDtsImpl(
|
|
const dds::domain::DomainParticipant& domainParticipant, const dds::pub::Publisher& ddsPublisher,
|
|
const std::string& topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()))
|
|
: m_dataWriterObject(new DataWriterObject()),
|
|
m_logger(DDS::getLogger(DDS::topic_type_name<TopicType>::value(), DDS::DataType::DATA_TOPIC_SERVER))
|
|
{
|
|
Q_ASSERT(domainParticipant != nullptr);
|
|
Q_ASSERT(ddsPublisher != nullptr);
|
|
|
|
m_dataWriterObject->create(domainParticipant, ddsPublisher, topicName);
|
|
}
|
|
|
|
~GenericDtsImpl()
|
|
{
|
|
delete m_dataWriterObject;
|
|
}
|
|
|
|
bool write(const TopicType& data, const dds::core::optional<dds::sub::SampleInfo>& si =
|
|
dds::core::optional<dds::sub::SampleInfo>()) override final
|
|
{
|
|
DEBUG_LOG(m_logger) << "IN write (" << DDS::topic_type_name<TopicType>::value() << ")";
|
|
|
|
if (!m_dataWriterObject)
|
|
return false;
|
|
|
|
if (!m_dataWriterObject->write(data, si))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error writing for " << DDS::topic_type_name<TopicType>::value();
|
|
return false;
|
|
}
|
|
DEBUG_LOG(m_logger) << "TopicData (" << DDS::topic_type_name<TopicType>::value() << ") written";
|
|
|
|
return true;
|
|
}
|
|
|
|
bool remove(const TopicType& data, bool errorMsgIfNotExists = true) override final
|
|
{
|
|
DEBUG_LOG(m_logger) << "IN remove (" << DDS::topic_type_name<TopicType>::value() << ")";
|
|
|
|
if (!m_dataWriterObject)
|
|
return false;
|
|
|
|
if (!m_dataWriterObject->remove(data, errorMsgIfNotExists))
|
|
{
|
|
if (errorMsgIfNotExists)
|
|
ERROR_LOG(m_logger) << "Error removing for " << DDS::topic_type_name<TopicType>::value();
|
|
return false;
|
|
}
|
|
DEBUG_LOG(m_logger) << "TopicData (" << DDS::topic_type_name<TopicType>::value() << ") removed";
|
|
|
|
return true;
|
|
}
|
|
|
|
private:
|
|
DataWriterObject* m_dataWriterObject;
|
|
NGL::INGLLogger& m_logger;
|
|
};
|
|
|
|
} // namespace DTS
|