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.
80 lines
2.4 KiB
C++
Executable File
80 lines
2.4 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
*
|
|
* Subscriber (Common)
|
|
* Uses DDTCs to subscribe to data
|
|
*
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
#pragma once
|
|
|
|
#include "pub_sub_base.h"
|
|
|
|
#include <DDS/Generic/dynamic_data_reader.h>
|
|
#include <DDS/DTC/generic_dtc_impl.h>
|
|
#include <DDS/Generic/topic_description.h>
|
|
#include <rti/core/ListenerBinder.hpp>
|
|
|
|
namespace NGL
|
|
{
|
|
class INGLLogger;
|
|
}
|
|
|
|
namespace DDSConnector
|
|
{
|
|
class DDSCONNECTOR_EXPORT Subscriber : public PubSubBase
|
|
{
|
|
|
|
public:
|
|
Subscriber(const dds::domain::DomainParticipant &domainParticipant, const std::string &partition, bool bUseSubscriberListener = true);
|
|
virtual ~Subscriber();
|
|
|
|
dds::sub::Subscriber getDdsSubscriber() const { return m_ddsSubscriber; }
|
|
DDSGeneric::SubscriberListener *getSubscriberListener() { return m_subscriberListener; }
|
|
|
|
template <typename DTC_TYPE>
|
|
DTC_TYPE *create(std::function<void(const typename DTC_TYPE::TopicTypeRead &, DataModification modType)> cb)
|
|
{
|
|
DTC_TYPE* dtc = new DTC_TYPE;
|
|
if (!dtc->create(m_domainParticipant, m_ddsSubscriber, m_subscriberListener))
|
|
{
|
|
delete dtc;
|
|
return nullptr;
|
|
}
|
|
dtc->setSubscriberCallback(cb);
|
|
return dtc;
|
|
}
|
|
|
|
|
|
DTC::Ddtc<DDSGeneric::DynamicDataReader> *create(const std::function<void(const DDSGeneric::DynamicData &, const std::string &, DataModification modType)> &cb,
|
|
const dds::core::xtypes::StructType &structType,
|
|
DDSGeneric::SubscriberListener *listener = nullptr,
|
|
const std::string &specialTopicName = std::string())
|
|
{
|
|
if (!listener)
|
|
listener = getSubscriberListener();
|
|
|
|
DTC::DdtcImpl<DDSGeneric::DynamicDataReader> *ddtc =
|
|
new DTC::DdtcImpl<DDSGeneric::DynamicDataReader>(getDomainParticipant(),
|
|
getDdsSubscriber(),
|
|
listener,
|
|
structType,
|
|
specialTopicName);
|
|
ddtc->setSubscriberCallback(cb);
|
|
return ddtc;
|
|
}
|
|
|
|
protected:
|
|
void initDDS();
|
|
void deleteDDS();
|
|
|
|
protected:
|
|
dds::sub::Subscriber m_ddsSubscriber;
|
|
DDSGeneric::SubscriberListener *m_subscriberListener;
|
|
rti::core::ListenerBinder< dds::sub::Subscriber, dds::sub::SubscriberListener> m_subscriberListenerBinder;
|
|
};
|
|
|
|
}
|