Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS/DDSConnector/publisher.h
T
berrux-dev cfe15c72c4 Merge story/release-validation-scope
Bring the validation-scope line (in-tree Jenkins CI copy, lcov coverage
wiring, step-by-step release-scope README, TetraIF unit tests, the
LogView runtime icon/resource fix, Dockerfile, rpmbuild and the
new_docker_build.sh driver with the DEB output path) on top of the
XmlPatterns branch pruned to the Release 2 scope.

Conflict policy:
- Out-of-scope targets/modules: keep the prune (deletion wins).
- In-scope files that validation had deleted: restored from
  story/release-2-cleanup (the Release 2 closure, with the
  pruned-module guards).
- In-scope sources carrying migration work: XmlPatterns versions
  (Qt XmlPatterns rework on QDomDocument, DDS member and logger
  fixes, first-build fixes).
- Scope-aware CMakeLists (top level, PluginInterfaces, LtsWidgets)
  and .envrc: story/release-2-cleanup / ours versions.
2026-11-16 18:49:14 +01:00

77 lines
1.6 KiB
C++
Executable File

/**
* @RDE_HEADER@
*
* Publisher for DataSampleGeneration
* Uses DTSs to publish data
*
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QtCore/QMap>
#include <NGLLogger/INGLLogger.h>
#include <DDS/DTS/generic_dts_impl.h>
#include <DDS/Generic/generic_data_writer.h>
#include <rti/core/xtypes/DynamicDataImpl.hpp>
#include "pub_sub_base.h"
namespace DDSConnector
{
class DDSCONNECTOR_EXPORT Publisher : public PubSubBase
{
public:
Publisher(const dds::domain::DomainParticipant &domainParticipant, const std::string &partition);
~Publisher();
void enableBatchedWriter(bool bEnable);
dds::pub::Publisher getDdsPublisher() const { return m_ddsPublisher; }
template <typename T>
bool write(const T &data)
{
using myDWO = DDSGeneric::GenericDataWriter<T>;
using myDTS = DTS::GenericDtsImpl< myDWO >;
std::string dwoType = DDS::topic_type_name<T>::value();
DEBUG_LOG(m_logger) << "dwoType = " << dwoType;
myDTS *dts = static_cast<myDTS *>(m_dtsMap.value(dwoType));
if (dts == nullptr)
{
dts = new myDTS(m_domainParticipant, m_ddsPublisher);
m_dtsMap.insert(dwoType, dts);
}
return dts->write(data);
}
bool write(const dds::core::xtypes::DynamicData &data)
{
return write(data, data.type().name());
}
bool write(const dds::core::xtypes::DynamicData &data, const std::string &topicName);
protected:
void initDDS();
void deleteDDS();
protected:
dds::pub::Publisher m_ddsPublisher;
QMap<std::string, DTS::Base*> m_dtsMap;
QMap<std::string, dds::pub::AnyDataWriter*> m_dynamicTypeMap;
};
}