Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#
# $Id$
# $HeadURL$
# $Author$
#
ADD_LIBRARY(ddsdts INTERFACE)
TARGET_INCLUDE_DIRECTORIES(ddsdts
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/../../
)
TARGET_LINK_LIBRARIES(ddsdts
INTERFACE
Qt5::Core
ddsgen
NGLLogger
)
SET(SRCS
${CMAKE_CURRENT_SOURCE_DIR}/generic_dts.h
${CMAKE_CURRENT_SOURCE_DIR}/generic_dts_impl.h
)
TARGET_SOURCES(ddsdts INTERFACE ${SRCS})
+34
View File
@@ -0,0 +1,34 @@
/**
* @RDE_HEADER@
* Interface for DataTopicServers (DTSs) - generic
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <dds/domain/DomainParticipant.hpp>
#include <dds/pub/Publisher.hpp>
#include <dds/sub/SampleInfo.hpp>
namespace DTS
{
class Base
{
public:
Base() = default;
virtual ~Base() = default;
};
template <typename TopicType>
class GenericDts : public Base
{
public:
GenericDts() = default;
virtual ~GenericDts() = default;
virtual bool write(const TopicType &data,
const dds::core::optional<dds::sub::SampleInfo> &si = dds::core::optional<dds::sub::SampleInfo>()) = 0;
virtual bool remove(const TopicType &data, bool errorMsgIfNotExists = true) = 0;
};
}
+93
View File
@@ -0,0 +1,93 @@
/**
* @RDE_HEADER@
* DataTopicServers (DTSs) - generic
* $Id$
* $HeadURL$
* $Author$
*/
#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:
// DataWriterObjects (DWOs)
DataWriterObject *m_dataWriterObject;
NGL::INGLLogger &m_logger;
};
} // Namespace DTS