55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "ddkit/access/DdsWrap.hpp"
|
|
|
|
|
|
namespace ddkit {
|
|
namespace access {
|
|
|
|
/// @brief wraps dds::pub::qos::DataWriterQos and dds::sub::qos::DataReaderQos
|
|
/// allows defining an arbitrary list of qos-settings.
|
|
class QosPattern {
|
|
|
|
public:
|
|
QosPattern();
|
|
QosPattern get();
|
|
|
|
dds::sub::qos::DataReaderQos& qosRead();
|
|
dds::pub::qos::DataWriterQos& qosWrite();
|
|
dds::topic::qos::TopicQos& qosTopic();
|
|
dds::sub::qos::SubscriberQos& qosSub();
|
|
dds::pub::qos::PublisherQos& qosPub();
|
|
QosPattern& qosReadWrite();
|
|
|
|
template <typename T>
|
|
QosPattern& operator<<(T const& rhs) {
|
|
qosRead() << rhs;
|
|
qosWrite() << rhs;
|
|
qosTopic() << rhs;
|
|
return *this;
|
|
}
|
|
|
|
private:
|
|
dds::sub::qos::DataReaderQos m_dataReaderQos;
|
|
dds::pub::qos::DataWriterQos m_dataWriterQos;
|
|
dds::topic::qos::TopicQos m_topicQos;
|
|
dds::sub::qos::SubscriberQos m_subscriberQos;
|
|
dds::pub::qos::PublisherQos m_publisherQos;
|
|
};
|
|
|
|
|
|
class QosPatternDefault : public QosPattern {
|
|
|
|
public:
|
|
QosPatternDefault() {
|
|
using namespace dds::core::policy;
|
|
qosReadWrite() << Ownership(OwnershipKind::SHARED)
|
|
<< Reliability(ReliabilityKind::RELIABLE)
|
|
<< Durability(DurabilityKind::TRANSIENT_LOCAL);
|
|
}
|
|
};
|
|
|
|
|
|
} // namespace access
|
|
} // namespace ddkit
|