This commit is contained in:
2025-09-24 10:53:28 +08:00
commit f8e4df77fb
856 changed files with 140098 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_PUB_DETAIL_ANYDATAWRITER_HPP_
#define OMG_DDS_PUB_DETAIL_ANYDATAWRITER_HPP_
#include <dds/pub/detail/TAnyDataWriterImpl.hpp>
#include <org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp>
namespace dds { namespace pub { namespace detail {
typedef dds::pub::TAnyDataWriter<org::eclipse::cyclonedds::pub::AnyDataWriterDelegate> AnyDataWriter;
} } }
#endif /* OMG_DDS_PUB_DETAIL_ANYDATAWRITER_HPP_ */

View File

@@ -0,0 +1,26 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_PUB_DETAIL_COHERENT_SET_HPP_
#define OMG_DDS_PUB_DETAIL_COHERENT_SET_HPP_
#include <dds/pub/detail/TCoherentSetImpl.hpp>
#include <org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp>
namespace dds {
namespace pub {
namespace detail {
typedef dds::pub::TCoherentSet<org::eclipse::cyclonedds::pub::CoherentSetDelegate> CoherentSet;
}
}
}
#endif /* OMG_DDS_PUB_DETAIL_COHERENT_SET_HPP_ */

View File

@@ -0,0 +1,195 @@
#ifndef OMG_DDS_PUB_DETAIL_DATA_WRITER_HPP_
#define OMG_DDS_PUB_DETAIL_DATA_WRITER_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/topic/Topic.hpp>
#include <dds/pub/AnyDataWriter.hpp>
#include <dds/topic/detail/Topic.hpp>
#include <org/eclipse/cyclonedds/core/EntityDelegate.hpp>
#include <org/eclipse/cyclonedds/topic/TopicTraits.hpp>
#include <org/eclipse/cyclonedds/core/ScopedLock.hpp>
#include <org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp>
#include <dds/dds.h>
namespace dds {
namespace pub {
template <typename T>
class DataWriterListener;
namespace detail {
template <typename T>
class DataWriter;
}
template <typename T, template <typename Q> class DELEGATE>
class DataWriter;
}
}
/***************************************************************************
*
* dds/pub/detail/DataWriter<> DELEGATE declaration.
* Implementation can be found in dds/pub/detail/DataWriterImpl.hpp
*
***************************************************************************/
template <typename T>
class dds::pub::detail::DataWriter : public ::org::eclipse::cyclonedds::pub::AnyDataWriterDelegate {
public:
typedef typename ::dds::core::smart_ptr_traits< DataWriter<T> >::ref_type ref_type;
typedef typename ::dds::core::smart_ptr_traits< DataWriter<T> >::weak_ref_type weak_ref_type;
DataWriter(const dds::pub::Publisher& pub,
const ::dds::topic::Topic<T>& topic,
const dds::pub::qos::DataWriterQos& qos,
dds::pub::DataWriterListener<T>* listener,
const dds::core::status::StatusMask& mask);
virtual ~DataWriter();
void init(ObjectDelegate::weak_ref_type weak_ref);
bool is_loan_supported();
T& loan_sample();
void return_loan(T& sample);
void write_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample);
void write_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample, const dds::core::Time& timestamp);
void dispose_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample);
void dispose_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample, const dds::core::Time& timestamp);
void unregister_instance_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample);
void unregister_instance_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample, const dds::core::Time& timestamp);
void write(const T& sample);
void write(const T& sample, const dds::core::Time& timestamp);
void write(const T& sample, const ::dds::core::InstanceHandle& instance);
void write(const T& sample,
const ::dds::core::InstanceHandle& instance,
const dds::core::Time& timestamp);
void write(const dds::topic::TopicInstance<T>& i);
void write(const dds::topic::TopicInstance<T>& i,
const dds::core::Time& timestamp);
void writedispose(const T& sample);
void writedispose(const T& sample, const dds::core::Time& timestamp);
void writedispose(const T& sample, const ::dds::core::InstanceHandle& instance);
void writedispose(const T& sample,
const ::dds::core::InstanceHandle& instance,
const dds::core::Time& timestamp);
void writedispose(const dds::topic::TopicInstance<T>& i);
void writedispose(const dds::topic::TopicInstance<T>& i,
const dds::core::Time& timestamp);
template <typename FWIterator>
void writedispose(const FWIterator& begin, const FWIterator& end);
template <typename FWIterator>
void writedispose(const FWIterator& begin, const FWIterator& end,
const dds::core::Time& timestamp);
template <typename SamplesFWIterator, typename HandlesFWIterator>
void writedispose(const SamplesFWIterator& data_begin,
const SamplesFWIterator& data_end,
const HandlesFWIterator& handle_begin,
const HandlesFWIterator& handle_end);
template <typename SamplesFWIterator, typename HandlesFWIterator>
void writedispose(const SamplesFWIterator& data_begin,
const SamplesFWIterator& data_end,
const HandlesFWIterator& handle_begin,
const HandlesFWIterator& handle_end,
const dds::core::Time& timestamp);
const ::dds::core::InstanceHandle register_instance(const T& key,
const dds::core::Time& timestamp);
void unregister_instance(const ::dds::core::InstanceHandle& handle,
const dds::core::Time& timestamp);
void unregister_instance(const T& sample,
const dds::core::Time& timestamp);
void dispose_instance(const ::dds::core::InstanceHandle& handle,
const dds::core::Time& timestamp);
void dispose_instance(const T& sample,
const dds::core::Time& timestamp);
dds::topic::TopicInstance<T>& key_value(dds::topic::TopicInstance<T>& i,
const ::dds::core::InstanceHandle& h);
T& key_value(T& sample, const ::dds::core::InstanceHandle& h);
dds::core::InstanceHandle lookup_instance(const T& key);
const dds::topic::Topic<T>& topic() const;
virtual const dds::pub::Publisher& publisher() const;
void listener(DataWriterListener<T>* listener,
const ::dds::core::status::StatusMask& mask);
DataWriterListener<T>* listener() const;
virtual void close();
dds::pub::DataWriter<T, dds::pub::detail::DataWriter> wrapper();
void on_offered_deadline_missed(dds_entity_t,
org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &sd);
void on_offered_incompatible_qos(dds_entity_t,
org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &sd);
void on_liveliness_lost(dds_entity_t,
org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &sd);
void on_publication_matched(dds_entity_t,
org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &sd);
private:
dds::pub::Publisher pub_;
dds::topic::Topic<T> topic_;
};
#endif /* OMG_DDS_PUB_DETAIL_DATA_WRITER_HPP_ */

View File

@@ -0,0 +1,982 @@
#ifndef OMG_DDS_PUB_DATA_WRITER_IMPL_HPP_
#define OMG_DDS_PUB_DATA_WRITER_IMPL_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/***************************************************************************
*
* dds/pub/DataWriter<> WRAPPER implementation.
* Declaration can be found in dds/pub/DataWriter.hpp
*
***************************************************************************/
#include <dds/topic/Topic.hpp>
#include <dds/pub/PublisherListener.hpp>
#include <dds/domain/DomainParticipantListener.hpp>
#include <org/eclipse/cyclonedds/core/ListenerDispatcher.hpp>
namespace dds
{
namespace pub
{
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>::DataWriter(
const dds::pub::Publisher& pub,
const dds::topic::Topic<T>& topic) :
dds::core::Reference< DELEGATE<T> >(
new DELEGATE<T>(pub, topic, pub.default_datawriter_qos(), NULL, dds::core::status::StatusMask::none()))
{
this->delegate()->init(this->impl_);
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>::DataWriter(const dds::pub::Publisher& pub,
const ::dds::topic::Topic<T>& topic,
const dds::pub::qos::DataWriterQos& qos,
dds::pub::DataWriterListener<T>* listener,
const dds::core::status::StatusMask& mask) :
dds::core::Reference< DELEGATE<T> >(
new DELEGATE<T>(pub, topic, qos, listener, mask))
{
this->delegate()->init(this->impl_);
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::write(const T& sample)
{
this->delegate()->write(sample);
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::write(const T& sample, const dds::core::Time& timestamp)
{
this->delegate()->write(sample, timestamp);
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::write(const T& sample, const ::dds::core::InstanceHandle& instance)
{
this->delegate()->write(sample, instance);
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::write(const T& sample,
const ::dds::core::InstanceHandle& instance,
const dds::core::Time& timestamp)
{
this->delegate()->write(sample, instance, timestamp);
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::write(const dds::topic::TopicInstance<T>& i)
{
this->delegate()->write(i);
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::write(const dds::topic::TopicInstance<T>& i,
const dds::core::Time& timestamp)
{
this->delegate()->write(i, timestamp);
}
template <typename T, template <typename Q> class DELEGATE>
template <typename FWIterator>
void
DataWriter<T, DELEGATE>::write(const FWIterator& begin, const FWIterator& end)
{
FWIterator b = begin;
while(b != end)
{
this->delegate()->write(*b);
++b;
}
}
template <typename T, template <typename Q> class DELEGATE>
template <typename FWIterator>
void
DataWriter<T, DELEGATE>::write(const FWIterator& begin, const FWIterator& end,
const dds::core::Time& timestamp)
{
FWIterator b = begin;
while(b != end)
{
this->delegate()->write(*b, timestamp);
++b;
}
}
template <typename T, template <typename Q> class DELEGATE>
template <typename SamplesFWIterator, typename HandlesFWIterator>
void
DataWriter<T, DELEGATE>::write(const SamplesFWIterator& data_begin,
const SamplesFWIterator& data_end,
const HandlesFWIterator& handle_begin,
const HandlesFWIterator& handle_end)
{
SamplesFWIterator data = data_begin;
HandlesFWIterator handle = handle_begin;
while(data != data_end && handle != handle_end)
{
this->delegate()->write(*data, *handle);
++data;
++handle;
}
}
template <typename T, template <typename Q> class DELEGATE>
template <typename SamplesFWIterator, typename HandlesFWIterator>
void
DataWriter<T, DELEGATE>::write(const SamplesFWIterator& data_begin,
const SamplesFWIterator& data_end,
const HandlesFWIterator& handle_begin,
const HandlesFWIterator& handle_end,
const dds::core::Time& timestamp)
{
SamplesFWIterator data = data_begin;
HandlesFWIterator handle = handle_begin;
while(data != data_end && handle != handle_end)
{
this->delegate()->write(*data, *handle, timestamp);
++data;
++handle;
}
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::operator <<(const ::dds::pub::qos::DataWriterQos& qos)
{
this->delegate()->qos(qos);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::operator << (const T& data)
{
this->write(data);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::operator << (const std::pair<T, dds::core::Time>& data)
{
this->write(data.first, data.second);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::operator << (const std::pair<T, ::dds::core::InstanceHandle>& data)
{
this->write(data.first, data.second);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::operator <<(DataWriter & (*manipulator)(DataWriter&))
{
return manipulator(*this);
}
template <typename T, template <typename Q> class DELEGATE>
const dds::core::InstanceHandle
DataWriter<T, DELEGATE>::register_instance(const T& key)
{
/* Invalid time will be used as current time. */
return this->delegate()->register_instance(key, dds::core::Time::invalid());
}
template <typename T, template <typename Q> class DELEGATE>
const dds::core::InstanceHandle
DataWriter<T, DELEGATE>::register_instance(const T& key,
const dds::core::Time& timestamp)
{
return this->delegate()->register_instance(key, timestamp);
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::unregister_instance(const ::dds::core::InstanceHandle& i)
{
/* Invalid time will be used as current time. */
this->delegate()->unregister_instance(i, dds::core::Time::invalid());
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::unregister_instance(const ::dds::core::InstanceHandle& i,
const dds::core::Time& timestamp)
{
this->delegate()->unregister_instance(i, timestamp);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::unregister_instance(const T& key)
{
/* Invalid time will be used as current time. */
this->delegate()->unregister_instance(key, dds::core::Time::invalid());
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::unregister_instance(const T& key,
const dds::core::Time& timestamp)
{
this->delegate()->unregister_instance(key, timestamp);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::dispose_instance(const ::dds::core::InstanceHandle& i)
{
/* Invalid time will be used as current time. */
this->delegate()->dispose_instance(i, dds::core::Time::invalid());
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::dispose_instance(const ::dds::core::InstanceHandle& i,
const dds::core::Time& timestamp)
{
this->delegate()->dispose_instance(i, timestamp);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::dispose_instance(const T& key)
{
/* Invalid time will be used as current time. */
this->delegate()->dispose_instance(key, dds::core::Time::invalid());
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
DataWriter<T, DELEGATE>&
DataWriter<T, DELEGATE>::dispose_instance(const T& key,
const dds::core::Time& timestamp)
{
this->delegate()->dispose_instance(key, timestamp);
return *this;
}
template <typename T, template <typename Q> class DELEGATE>
dds::topic::TopicInstance<T>&
DataWriter<T, DELEGATE>::key_value(dds::topic::TopicInstance<T>& i,
const ::dds::core::InstanceHandle& h)
{
return this->delegate()->key_value(i, h);
}
template <typename T, template <typename Q> class DELEGATE>
T&
DataWriter<T, DELEGATE>::key_value(T& sample, const ::dds::core::InstanceHandle& h)
{
return this->delegate()->key_value(sample, h);
}
template <typename T, template <typename Q> class DELEGATE>
dds::core::InstanceHandle
DataWriter<T, DELEGATE>::lookup_instance(const T& key)
{
return this->delegate()->lookup_instance(key);
}
template <typename T, template <typename Q> class DELEGATE>
const dds::topic::Topic<T>&
DataWriter<T, DELEGATE>::topic() const
{
return this->delegate()->topic();
}
template <typename T, template <typename Q> class DELEGATE>
void
DataWriter<T, DELEGATE>::listener(DataWriterListener<T>* listener,
const ::dds::core::status::StatusMask& mask)
{
this->delegate()->listener(listener, mask);
}
template <typename T, template <typename Q> class DELEGATE>
DataWriterListener<T>*
DataWriter<T, DELEGATE>::listener() const
{
return this->delegate()->listener();
}
}
}
/***************************************************************************
*
* dds/pub/detail/DataWriter<> DELEGATE implementation.
* Declaration can be found in dds/pub/detail/DataWriter.hpp
*
* Implementation and declaration have been separated because some circular
* dependencies, like with DataWriterListener and AnyDataWriter.
*
***************************************************************************/
#include <dds/pub/AnyDataWriter.hpp>
#include <dds/pub/DataWriterListener.hpp>
#include <org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp>
template <typename T>
dds::pub::detail::DataWriter<T>::DataWriter(
const dds::pub::Publisher& pub,
const ::dds::topic::Topic<T>& topic,
const dds::pub::qos::DataWriterQos& qos,
dds::pub::DataWriterListener<T>* listener,
const dds::core::status::StatusMask& mask)
: ::org::eclipse::cyclonedds::pub::AnyDataWriterDelegate(qos, topic), pub_(pub), topic_(topic)
{
DDSCXX_WARNING_MSVC_OFF(6326)
if (dds::topic::is_topic_type<T>::value == 0) {
ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, "DataWriter cannot be created, topic information not found");
}
DDSCXX_WARNING_MSVC_ON(6326)
org::eclipse::cyclonedds::pub::qos::DataWriterQosDelegate dwQos = qos.delegate();
dds_entity_t ddsc_pub = static_cast<dds_entity_t>(pub.delegate()->get_ddsc_entity());
dds_entity_t ddsc_topic = static_cast<dds_entity_t>(topic.delegate()->get_ddsc_entity());
// get and validate the ddsc qos
dwQos.check();
dds_qos_t *ddsc_qos = dwQos.ddsc_qos();
std::string name = topic.name() + "_datawriter";
dds_entity_t ddsc_writer = dds_create_writer (ddsc_pub, ddsc_topic, ddsc_qos, NULL);
dds_delete_qos(ddsc_qos);
ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ddsc_writer, "Could not create DataWriter.");
topic_.delegate()->incrNrDependents();
this->set_ddsc_entity(ddsc_writer);
this->listener(listener, mask);
}
template <typename T>
dds::pub::detail::DataWriter<T>::~DataWriter<T>()
{
if (!this->closed) {
try {
this->close();
} catch (...) {
/* Empty: the exception throw should have already traced an error. */
}
}
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::init(ObjectDelegate::weak_ref_type weak_ref)
{
/* Set weak_ref before passing ourselves to other isocpp objects. */
this->set_weak_ref(weak_ref);
/* Add weak_ref to the map of entities */
this->add_to_entity_map(weak_ref);
/* Register writer at publisher. */
this->pub_.delegate()->add_datawriter(*this);
// Because listeners are added after writer is created (which is in enabled state, because
// disabled state is not yet supported), events could have occured before listeners were
// registered. Therefore the event handlers for those events are called here.
if (this->listener_get()) {
dds::core::status::StatusMask writerStatus = status_changes();
if (listener_mask.to_ulong() & dds::core::status::StatusMask::liveliness_lost().to_ulong()
&& writerStatus.test(DDS_LIVELINESS_LOST_STATUS_ID))
{
dds::core::status::LivelinessLostStatus status = liveliness_lost_status();
on_liveliness_lost(this->ddsc_entity, status);
}
if (listener_mask.to_ulong() & dds::core::status::StatusMask::offered_deadline_missed().to_ulong()
&& writerStatus.test(DDS_OFFERED_DEADLINE_MISSED_STATUS_ID))
{
dds::core::status::OfferedDeadlineMissedStatus status = offered_deadline_missed_status();
on_offered_deadline_missed(this->ddsc_entity, status);
}
if (listener_mask.to_ulong() & dds::core::status::StatusMask::offered_incompatible_qos().to_ulong()
&& writerStatus.test(DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID))
{
dds::core::status::OfferedIncompatibleQosStatus status = offered_incompatible_qos_status();
on_offered_incompatible_qos(this->ddsc_entity, status);
}
if (listener_mask.to_ulong() & dds::core::status::StatusMask::publication_matched().to_ulong()
&& writerStatus.test(DDS_PUBLICATION_MATCHED_STATUS_ID))
{
dds::core::status::PublicationMatchedStatus status = publication_matched_status();
on_publication_matched(this->ddsc_entity, status);
}
}
/* Enable when needed. */
if (this->pub_.delegate()->is_auto_enable()) {
this->enable();
}
}
template <typename T>
bool
dds::pub::detail::DataWriter<T>::is_loan_supported()
{
this->check();
return AnyDataWriterDelegate::is_loan_supported(static_cast<dds_entity_t>(this->ddsc_entity));
}
template <typename T>
T&
dds::pub::detail::DataWriter<T>::loan_sample()
{
T *sample;
this->check();
AnyDataWriterDelegate::loan_sample(static_cast<dds_entity_t>(this->ddsc_entity), reinterpret_cast<void **>(&sample));
return *sample;
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::return_loan(T& sample)
{
this->check();
AnyDataWriterDelegate::return_loan(static_cast<dds_entity_t>(this->ddsc_entity), &sample);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample)
{
this->check();
AnyDataWriterDelegate::write_cdr(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write_cdr(
const org::eclipse::cyclonedds::topic::CDRBlob& sample,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::write_cdr(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::dispose_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample)
{
this->check();
AnyDataWriterDelegate::dispose_cdr(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::dispose_cdr(
const org::eclipse::cyclonedds::topic::CDRBlob& sample,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::dispose_cdr(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::unregister_instance_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample)
{
this->check();
AnyDataWriterDelegate::unregister_instance_cdr(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::unregister_instance_cdr(
const org::eclipse::cyclonedds::topic::CDRBlob& sample,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::unregister_instance_cdr(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write(const T& sample)
{
this->check();
AnyDataWriterDelegate::write(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write(const T& sample, const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::write(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write(const T& sample, const ::dds::core::InstanceHandle& instance)
{
this->check();
AnyDataWriterDelegate::write(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
instance,
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write(const T& sample,
const ::dds::core::InstanceHandle& instance,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::write(static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
instance,
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write(const dds::topic::TopicInstance<T>& i)
{
this->check();
AnyDataWriterDelegate::write(static_cast<dds_entity_t>(this->ddsc_entity),
&i.sample(),
i.handle(),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::write(const dds::topic::TopicInstance<T>& i,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::write(static_cast<dds_entity_t>(this->ddsc_entity),
&i.sample(),
i.handle(),
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::writedispose(const T& sample)
{
this->check();
AnyDataWriterDelegate::writedispose(
static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::writedispose(const T& sample, const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::writedispose(
static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
dds::core::InstanceHandle(dds::core::null),
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::writedispose(const T& sample, const ::dds::core::InstanceHandle& instance)
{
this->check();
AnyDataWriterDelegate::writedispose(
static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
instance,
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::writedispose(
const T& sample,
const ::dds::core::InstanceHandle& instance,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::writedispose(
static_cast<dds_entity_t>(this->ddsc_entity),
&sample,
instance,
timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::writedispose(const dds::topic::TopicInstance<T>& i)
{
this->check();
AnyDataWriterDelegate::writedispose(
static_cast<dds_entity_t>(this->ddsc_entity),
&i.sample(),
i.handle(),
dds::core::Time::invalid());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::writedispose(
const dds::topic::TopicInstance<T>& i,
const dds::core::Time& timestamp)
{
this->check();
AnyDataWriterDelegate::writedispose(
static_cast<dds_entity_t>(this->ddsc_entity),
&i.sample(),
i.handle(),
timestamp);
}
template <typename T>
template <typename FWIterator>
void
dds::pub::detail::DataWriter<T>::writedispose(const FWIterator& begin, const FWIterator& end)
{
FWIterator b = begin;
while(b != end)
{
this->writedispose(*b);
++b;
}
}
template <typename T>
template <typename FWIterator>
void
dds::pub::detail::DataWriter<T>::writedispose(const FWIterator& begin, const FWIterator& end,
const dds::core::Time& timestamp)
{
FWIterator b = begin;
while(b != end)
{
this->writedispose(*b, timestamp);
++b;
}
}
template <typename T>
template <typename SamplesFWIterator, typename HandlesFWIterator>
void
dds::pub::detail::DataWriter<T>::writedispose(
const SamplesFWIterator& data_begin,
const SamplesFWIterator& data_end,
const HandlesFWIterator& handle_begin,
const HandlesFWIterator& handle_end)
{
SamplesFWIterator data = data_begin;
HandlesFWIterator handle = handle_begin;
while(data != data_end && handle != handle_end)
{
this->writedispose(*data, *handle);
++data;
++handle;
}
}
template <typename T>
template <typename SamplesFWIterator, typename HandlesFWIterator>
void
dds::pub::detail::DataWriter<T>::writedispose(
const SamplesFWIterator& data_begin,
const SamplesFWIterator& data_end,
const HandlesFWIterator& handle_begin,
const HandlesFWIterator& handle_end,
const dds::core::Time& timestamp)
{
SamplesFWIterator data = data_begin;
HandlesFWIterator handle = handle_begin;
while(data != data_end && handle != handle_end)
{
this->writedispose(*data, *handle, timestamp);
++data;
++handle;
}
}
template <typename T>
const ::dds::core::InstanceHandle
dds::pub::detail::DataWriter<T>::register_instance(const T& key,
const dds::core::Time& timestamp)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
dds::core::InstanceHandle handle(AnyDataWriterDelegate::register_instance(static_cast<dds_entity_t>(this->ddsc_entity), &key, timestamp));
return handle;
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::unregister_instance(const ::dds::core::InstanceHandle& handle,
const dds::core::Time& timestamp)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
AnyDataWriterDelegate::unregister_instance(static_cast<dds_entity_t>(this->ddsc_entity), handle, timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::unregister_instance(const T& sample,
const dds::core::Time& timestamp)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
AnyDataWriterDelegate::unregister_instance(static_cast<dds_entity_t>(this->ddsc_entity), &sample, timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::dispose_instance(const ::dds::core::InstanceHandle& handle,
const dds::core::Time& timestamp)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
AnyDataWriterDelegate::dispose_instance(static_cast<dds_entity_t>(this->ddsc_entity), handle, timestamp);
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::dispose_instance(const T& sample,
const dds::core::Time& timestamp)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
AnyDataWriterDelegate::dispose_instance(static_cast<dds_entity_t>(this->ddsc_entity), &sample, timestamp);
}
template <typename T>
dds::topic::TopicInstance<T>&
dds::pub::detail::DataWriter<T>::key_value(dds::topic::TopicInstance<T>& i,
const ::dds::core::InstanceHandle& h)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
T sample;
AnyDataWriterDelegate::get_key_value(static_cast<dds_entity_t>(this->ddsc_entity), &sample, h);
i.handle(h);
i.sample(sample);
return i;
}
template <typename T>
T&
dds::pub::detail::DataWriter<T>::key_value(T& sample, const ::dds::core::InstanceHandle& h)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
AnyDataWriterDelegate::get_key_value(static_cast<dds_entity_t>(this->ddsc_entity), &sample, h);
return sample;
}
template <typename T>
dds::core::InstanceHandle
dds::pub::detail::DataWriter<T>::lookup_instance(const T& key)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
dds::core::InstanceHandle handle(AnyDataWriterDelegate::lookup_instance(static_cast<dds_entity_t>(this->ddsc_entity), &key));
return handle;
}
template <typename T>
const dds::topic::Topic<T>&
dds::pub::detail::DataWriter<T>::topic() const
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
return this->topic_;
}
template <typename T>
const dds::pub::Publisher&
dds::pub::detail::DataWriter<T>::publisher() const
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
return this->pub_;
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::listener(DataWriterListener<T>* listener,
const ::dds::core::status::StatusMask& mask)
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
this->listener_set(listener, mask);
}
template <typename T>
dds::pub::DataWriterListener<T>*
dds::pub::detail::DataWriter<T>::listener() const
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->check();
return reinterpret_cast<dds::pub::DataWriterListener<T>*>(this->listener_get());
}
template <typename T>
void
dds::pub::detail::DataWriter<T>::close()
{
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
this->listener_set(NULL, dds::core::status::StatusMask::none());
topic_.delegate()->decrNrDependents();
this->pub_.delegate()->remove_datawriter(*this);
org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::close();
scopedLock.unlock();
}
template <typename T>
dds::pub::DataWriter<T, dds::pub::detail::DataWriter>
dds::pub::detail::DataWriter<T>::wrapper()
{
typename DataWriter::ref_type ref =
::std::dynamic_pointer_cast<DataWriter<T> >(this->get_strong_ref());
dds::pub::DataWriter<T, dds::pub::detail::DataWriter> writer(ref);
return writer;
}
template <typename T>
void dds::pub::detail::DataWriter<T>::on_offered_deadline_missed(dds_entity_t,
org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &sd)
{
dds::core::status::OfferedDeadlineMissedStatus s;
s.delegate() = sd;
dds::pub::DataWriter<T, dds::pub::detail::DataWriter> dw = wrapper();
dds::pub::DataWriterListener<T> *l =
reinterpret_cast<dds::pub::DataWriterListener<T> *>(this->listener_get());
l->on_offered_deadline_missed(dw, s);
}
template <typename T>
void dds::pub::detail::DataWriter<T>::on_offered_incompatible_qos(dds_entity_t,
org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &sd)
{
dds::core::status::OfferedIncompatibleQosStatus s;
s.delegate() = sd;
dds::pub::DataWriter<T, dds::pub::detail::DataWriter> dw = wrapper();
dds::pub::DataWriterListener<T> *l =
reinterpret_cast<dds::pub::DataWriterListener<T> *>(this->listener_get());
l->on_offered_incompatible_qos(dw, s);
}
template <typename T>
void dds::pub::detail::DataWriter<T>::on_liveliness_lost(dds_entity_t,
org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &sd)
{
dds::core::status::LivelinessLostStatus s;
s.delegate() = sd;
dds::pub::DataWriter<T, dds::pub::detail::DataWriter> dw = wrapper();
dds::pub::DataWriterListener<T> *l =
reinterpret_cast<dds::pub::DataWriterListener<T> *>(this->listener_get());
l->on_liveliness_lost(dw, s);
}
template <typename T>
void dds::pub::detail::DataWriter<T>::on_publication_matched(dds_entity_t,
org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &sd)
{
dds::core::status::PublicationMatchedStatus s;
s.delegate() = sd;
dds::pub::DataWriter<T, dds::pub::detail::DataWriter> dw = wrapper();
dds::pub::DataWriterListener<T> *l =
reinterpret_cast<dds::pub::DataWriterListener<T> *>(this->listener_get());
l->on_publication_matched(dw, s);
}
#endif /* OMG_DDS_PUB_DATA_WRITER_IMPL_HPP_ */

View File

@@ -0,0 +1,29 @@
#ifndef OMG_DDS_PUB_DETAIL_PUBLISHER_HPP_
#define OMG_DDS_PUB_DETAIL_PUBLISHER_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/pub/detail/TPublisherImpl.hpp>
#include <org/eclipse/cyclonedds/pub/PublisherDelegate.hpp>
namespace dds { namespace pub { namespace detail {
typedef dds::pub::TPublisher<org::eclipse::cyclonedds::pub::PublisherDelegate> Publisher;
} } }
#endif /* OMG_DDS_PUB_DETAIL_PUBLISHER_HPP_ */

View File

@@ -0,0 +1,22 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_PUB_DETAIL_SUSPENDED_PUBLICATION_HPP_
#define OMG_DDS_PUB_DETAIL_SUSPENDED_PUBLICATION_HPP_
#include <dds/pub/detail/TSuspendedPublicationImpl.hpp>
#include <org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp>
namespace dds { namespace pub { namespace detail {
typedef dds::pub::TSuspendedPublication<org::eclipse::cyclonedds::pub::SuspendedPublicationDelegate> SuspendedPublication;
} } }
#endif /* OMG_DDS_PUB_DETAIL_SUSPENDED_PUBLICATION_HPP_ */

View File

@@ -0,0 +1,121 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_PUB_DETAIL_TANYDATAWRITER_HPP_
#define OMG_DDS_PUB_DETAIL_TANYDATAWRITER_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/pub/TAnyDataWriter.hpp>
// Implementation
namespace dds
{
namespace pub
{
template <typename DELEGATE>
const dds::pub::Publisher&
TAnyDataWriter<DELEGATE>::publisher() const
{
return this->delegate()->publisher();
}
template <typename DELEGATE>
const dds::topic::TopicDescription&
TAnyDataWriter<DELEGATE>::topic_description() const
{
return this->delegate()->topic_description();
}
template <typename DELEGATE>
dds::pub::qos::DataWriterQos
TAnyDataWriter<DELEGATE>::qos() const
{
return this->delegate()->qos();
}
template <typename DELEGATE>
void
TAnyDataWriter<DELEGATE>::qos(const dds::pub::qos::DataWriterQos& qos)
{
this->delegate()->qos(qos);
}
template <typename DELEGATE>
TAnyDataWriter<DELEGATE>&
TAnyDataWriter<DELEGATE>::operator << (const dds::pub::qos::DataWriterQos& qos)
{
this->delegate()->qos(qos);
return *this;
}
template <typename DELEGATE>
const TAnyDataWriter<DELEGATE>&
TAnyDataWriter<DELEGATE>::operator >> (dds::pub::qos::DataWriterQos& qos) const
{
qos = this->delegate()->qos();
return *this;
}
template <typename DELEGATE>
void
TAnyDataWriter<DELEGATE>::wait_for_acknowledgments(const dds::core::Duration& timeout)
{
this->delegate()->wait_for_acknowledgments(timeout);
}
template <typename DELEGATE>
const ::dds::core::status::LivelinessLostStatus
TAnyDataWriter<DELEGATE>::liveliness_lost_status()
{
return this->delegate()->liveliness_lost_status();
}
template <typename DELEGATE>
const ::dds::core::status::OfferedDeadlineMissedStatus
TAnyDataWriter<DELEGATE>::offered_deadline_missed_status()
{
return this->delegate()->offered_deadline_missed_status();
}
template <typename DELEGATE>
const ::dds::core::status::OfferedIncompatibleQosStatus
TAnyDataWriter<DELEGATE>::offered_incompatible_qos_status()
{
return this->delegate()->offered_incompatible_qos_status();
}
template <typename DELEGATE>
const ::dds::core::status::PublicationMatchedStatus
TAnyDataWriter<DELEGATE>::publication_matched_status()
{
return this->delegate()->publication_matched_status();
}
template <typename DELEGATE>
void
TAnyDataWriter<DELEGATE>::assert_liveliness()
{
this->delegate()->assert_liveliness();
}
}
}
// End of implementation
#endif /* OMG_DDS_PUB_DETAIL_TANYDATAWRITER_HPP_ */

View File

@@ -0,0 +1,52 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_PUB_TCOHERENTSET_IMPL_HPP_
#define CYCLONEDDS_DDS_PUB_TCOHERENTSET_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/pub/TCoherentSet.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace pub
{
template <typename DELEGATE>
TCoherentSet<DELEGATE>::TCoherentSet(const dds::pub::Publisher& pub) : dds::core::Value<DELEGATE>(pub) { }
template <typename DELEGATE>
void TCoherentSet<DELEGATE>::end()
{
this->delegate().end();
}
template <typename DELEGATE>
TCoherentSet<DELEGATE>::~TCoherentSet()
{
this->delegate().end();
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_PUB_TCOHERENTSET_HPP_ */

View File

@@ -0,0 +1,120 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_PUB_TPUBLISHER_IMPL_HPP_
#define CYCLONEDDS_DDS_PUB_TPUBLISHER_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/pub/TPublisher.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace pub
{
template <typename DELEGATE>
TPublisher<DELEGATE>::TPublisher(const dds::domain::DomainParticipant& dp)
: ::dds::core::Reference<DELEGATE>(new DELEGATE(dp,
dp.default_publisher_qos(),
NULL,
dds::core::status::StatusMask::none()))
{
this->delegate()->init(this->impl_);
}
template <typename DELEGATE>
TPublisher<DELEGATE>::TPublisher(const dds::domain::DomainParticipant& dp,
const dds::pub::qos::PublisherQos& qos,
dds::pub::PublisherListener* listener,
const dds::core::status::StatusMask& mask)
: ::dds::core::Reference<DELEGATE>(new DELEGATE(dp, qos, listener, mask))
{
this->delegate()->init(this->impl_);
}
template <typename DELEGATE>
const dds::pub::qos::PublisherQos& TPublisher<DELEGATE>::qos() const
{
return this->delegate()->qos();
}
template <typename DELEGATE>
void TPublisher<DELEGATE>::qos(const dds::pub::qos::PublisherQos& pqos)
{
this->delegate()->qos(pqos);
}
template <typename DELEGATE>
TPublisher<DELEGATE>& TPublisher<DELEGATE>::operator <<(const dds::pub::qos::PublisherQos& qos)
{
this->qos(qos);
return *this;
}
template <typename DELEGATE>
TPublisher<DELEGATE>& TPublisher<DELEGATE>::operator >> (dds::pub::qos::PublisherQos& qos)
{
qos = this->qos();
return *this;
}
template <typename DELEGATE>
TPublisher<DELEGATE>& TPublisher<DELEGATE>::default_datawriter_qos(const dds::pub::qos::DataWriterQos& dwqos)
{
this->delegate()->default_datawriter_qos(dwqos);
return *this;
}
template <typename DELEGATE>
dds::pub::qos::DataWriterQos TPublisher<DELEGATE>::default_datawriter_qos() const
{
return this->delegate()->default_datawriter_qos();
}
template <typename DELEGATE>
void TPublisher<DELEGATE>::listener(Listener* plistener, const dds::core::status::StatusMask& event_mask)
{
this->delegate()->listener(plistener, event_mask);
}
template <typename DELEGATE>
typename TPublisher<DELEGATE>::Listener* TPublisher<DELEGATE>::listener() const
{
return this->delegate()->listener();
}
template <typename DELEGATE>
void TPublisher<DELEGATE>::wait_for_acknowledgments(const dds::core::Duration& timeout)
{
this->delegate()->wait_for_acknowledgments(timeout);
}
template <typename DELEGATE>
const dds::domain::DomainParticipant& TPublisher<DELEGATE>::participant() const
{
return this->delegate()->participant();
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_PUB_TPUBLISHER_IMPL_HPP_ */

View File

@@ -0,0 +1,52 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_PUB_TSUSPENDEDPUBLICATION_IMPL_HPP_
#define CYCLONEDDS_DDS_PUB_TSUSPENDEDPUBLICATION_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/pub/TSuspendedPublication.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace pub
{
template <typename DELEGATE>
TSuspendedPublication<DELEGATE>::TSuspendedPublication(const dds::pub::Publisher& pub) : dds::core::Value<DELEGATE>(pub) { }
template <typename DELEGATE>
void TSuspendedPublication<DELEGATE>::resume()
{
this->delegate().resume();
}
template <typename DELEGATE>
TSuspendedPublication<DELEGATE>::~TSuspendedPublication()
{
this->delegate().resume();
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_PUB_TSUSPENDEDPUBLICATION_IMPL_HPP_ */

View File

@@ -0,0 +1,17 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_PUB_PACKAGE_DETAIL_INCLUDE_HPP_
#define OMG_DDS_PUB_PACKAGE_DETAIL_INCLUDE_HPP_
#include "dds/pub/detail/DataWriterImpl.hpp"
#endif /* OMG_DDS_PUB_PACKAGE_DETAIL_INCLUDE_HPP_ */

View File

@@ -0,0 +1,62 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/**
* @file
*/
#ifndef CYCLONEDDS_DDS_PUB_DETAIL_DISCOVERY_HPP_
#define CYCLONEDDS_DDS_PUB_DETAIL_DISCOVERY_HPP_
#include <dds/pub/DataWriter.hpp>
namespace dds
{
namespace pub
{
template <typename FwdIterator>
void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end)
{
(void)dp;
(void)begin;
(void)end;
ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported");
}
template <typename T>
::dds::core::InstanceHandleSeq
matched_subscriptions(const dds::pub::DataWriter<T>& dw)
{
return dw.delegate()->matched_subscriptions();
}
template <typename T, typename FwdIterator>
uint32_t
matched_subscriptions(const dds::pub::DataWriter<T>& dw,
FwdIterator begin, uint32_t max_size)
{
return dw.delegate()->matched_subscriptions(begin, max_size);
}
template <typename T>
const dds::topic::SubscriptionBuiltinTopicData
matched_subscription_data(const dds::pub::DataWriter<T>& dw,
const ::dds::core::InstanceHandle& h)
{
return dw.delegate()->matched_subscription_data(h);
}
}
}
#endif /* CYCLONEDDS_DDS_PUB_DETAIL_DISCOVERY_HPP_ */

View File

@@ -0,0 +1,81 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
/**
* @file
*/
#ifndef CYCLONEDDS_DDS_PUB_DETAIL_FIND_HPP_
#define CYCLONEDDS_DDS_PUB_DETAIL_FIND_HPP_
#include <string>
#include <dds/pub/DataWriter.hpp>
#include <dds/pub/Publisher.hpp>
#include <org/eclipse/cyclonedds/pub/PublisherDelegate.hpp>
#include <org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp>
namespace dds
{
namespace pub
{
template <typename WRITER, typename FwdIterator>
uint32_t
find(const dds::pub::Publisher& pub, const std::string& topic_name,
FwdIterator begin, uint32_t max_size)
{
if(max_size > 0) {
org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::ref_type writer_base = pub.delegate()->find_datawriter(topic_name);
if (writer_base) {
/* Cast base writer to typed delegate: */
typename WRITER::DELEGATE_REF_T writer_typed =
::std::dynamic_pointer_cast<typename WRITER::DELEGATE_T>(writer_base);
WRITER dw(writer_typed);
if(dw != dds::core::null)
{
*begin = dw;
return 1;
}
}
}
return 0;
}
template <typename WRITER, typename BinIterator>
uint32_t
find(const dds::pub::Publisher& pub,
const std::string& topic_name,
BinIterator begin)
{
org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::ref_type writer_base = pub.delegate()->find_datawriter(topic_name);
if (writer_base) {
/* Cast base writer to typed delegate: */
typename WRITER::DELEGATE_REF_T writer_typed =
::std::dynamic_pointer_cast<typename WRITER::DELEGATE_T>(writer_base);
WRITER dw(writer_typed);
if(dw != dds::core::null)
{
*begin = dw;
return 1;
}
}
return 0;
}
}
}
#endif /* CYCLONEDDS_DDS_PUB_DETAIL_FIND_HPP_ */