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,32 @@
#ifndef OMG_DDS_PUB_ANY_DATA_WRITER_HPP_
#define OMG_DDS_PUB_ANY_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/pub/detail/AnyDataWriter.hpp>
namespace dds
{
namespace pub
{
typedef ::dds::pub::detail::AnyDataWriter AnyDataWriter;
}
}
#endif /* OMG_DDS_PUB_ANY_DATA_WRITER_HPP_ */

View File

@@ -0,0 +1,120 @@
#ifndef OMG_DDS_PUB_ANY_DATA_WRITER_LISTENER_HPP_
#define OMG_DDS_PUB_ANY_DATA_WRITER_LISTENER_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/AnyDataWriter.hpp>
namespace dds
{
namespace pub
{
class AnyDataWriterListener;
class NoOpAnyDataWriterListener;
}
}
/**
* @brief
* AnyDataWriter events Listener
*
* Because Publisher and DomainParticipant do not have knowledge of data types,
* they have to use non-data-type-listeners. In other words Any* listeners.
*
* <b><i>
* All operations for this interface must be implemented in the user-defined class, it is
* up to the application whether an operation is empty or contains some functionality.
*
* This class is used as a base for other listeners and is not used on its own.
* </i></b>
*
* @see dds::pub::PublisherListener
* @see dds::domain::DomainParticipantListener
*/
class OMG_DDS_API dds::pub::AnyDataWriterListener
{
public:
/** @cond */
virtual ~AnyDataWriterListener() { }
/** @endcond */
public:
/** @copydoc dds::pub::DataWriterListener::on_offered_deadline_missed() */
virtual void on_offered_deadline_missed(dds::pub::AnyDataWriter& writer,
const ::dds::core::status::OfferedDeadlineMissedStatus& status) = 0;
/** @copydoc dds::pub::DataWriterListener::on_offered_incompatible_qos() */
virtual void on_offered_incompatible_qos(dds::pub::AnyDataWriter& writer,
const ::dds::core::status::OfferedIncompatibleQosStatus& status) = 0;
/** @copydoc dds::pub::DataWriterListener::on_liveliness_lost() */
virtual void on_liveliness_lost(dds::pub::AnyDataWriter& writer,
const ::dds::core::status::LivelinessLostStatus& status) = 0;
/** @copydoc dds::pub::DataWriterListener::on_publication_matched() */
virtual void on_publication_matched(dds::pub::AnyDataWriter& writer,
const ::dds::core::status::PublicationMatchedStatus& status) = 0;
};
/**
* @brief
* AnyDataWriter events Listener
*
* This listener is just like AnyDataWriterListener, except
* that the application doesn't have to implement all operations.
*
* This class is used as a base for other listeners and is not used on its own.
*
* @see dds::pub::AnyDataWriterListener
* @see dds::pub::NoOpPublisherListener
* @see dds::domain::NoOpDomainParticipantListener
*/
class OMG_DDS_API dds::pub::NoOpAnyDataWriterListener : public virtual dds::pub::AnyDataWriterListener
{
/** @cond
* All these functions have already been documented in the non-NoOp listener.
* Ignore these functions for the doxygen API documentation for clarity.
*/
public:
virtual ~NoOpAnyDataWriterListener() { }
public:
virtual void on_offered_deadline_missed(
dds::pub::AnyDataWriter&,
const ::dds::core::status::OfferedDeadlineMissedStatus&) { }
virtual void on_offered_incompatible_qos(
dds::pub::AnyDataWriter&,
const ::dds::core::status::OfferedIncompatibleQosStatus&) { }
virtual void on_liveliness_lost(
dds::pub::AnyDataWriter&,
const ::dds::core::status::LivelinessLostStatus&) { }
virtual void on_publication_matched(
dds::pub::AnyDataWriter&,
const ::dds::core::status::PublicationMatchedStatus&) { }
/** @endcond */
};
#endif /* OMG_DDS_PUB_ANY_DATA_WRITER_LISTENER_HPP_ */

View File

@@ -0,0 +1,32 @@
/* 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.
*/
#ifndef OMG_DDS_PUB_COHERENT_SET_HPP_
#define OMG_DDS_PUB_COHERENT_SET_HPP_
#include <dds/pub/detail/CoherentSet.hpp>
namespace dds
{
namespace pub
{
typedef dds::pub::detail::CoherentSet CoherentSet;
}
}
#endif /* OMG_DDS_PUB_COHERENT_SET_HPP_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,258 @@
#ifndef OMG_DDS_PUB_DATA_WRITER_LISTENER_HPP_
#define OMG_DDS_PUB_DATA_WRITER_LISTENER_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/DataWriter.hpp>
namespace dds
{
namespace pub
{
/**
* * @brief
* DataWriter events Listener
*
* Since a DataWriter is an Entity, it has the ability to have a Listener
* associated with it. In this case, the associated Listener should be of type
* DataWriterListener. This interface must be implemented by the
* application. A user-defined class must be provided by the application which must
* extend from the DataWriterListener class.
*
* <b><i>
* All operations for this interface must be implemented in the user-defined class, it is
* up to the application whether an operation is empty or contains some functionality.
* </i></b>
*
* The DataWriterListener provides a generic mechanism (actually a
* callback function) for the Data Distribution Service to notify the application of
* relevant asynchronous status change events, such as a missed deadline, violation of
* a QosPolicy setting, etc. The DataWriterListener is related to
* changes in communication status StatusConditions.
*
* @code{.cpp}
* // Application example listener
* class ExampleListener :
* public virtual dds::pub::DataWriterListener<Foo::Bar>
* {
* public:
* virtual void on_offered_deadline_missed (
* dds::pub::DataWriter<Foo::Bar>& writer,
* const dds::core::status::OfferedDeadlineMissedStatus& status)
* {
* std::cout << "on_offered_deadline_missed" << std::endl;
* }
*
* virtual void on_offered_incompatible_qos (
* dds::pub::DataWriter<Foo::Bar>& writer,
* const dds::core::status::OfferedIncompatibleQosStatus& status)
* {
* std::cout << "on_offered_incompatible_qos" << std::endl;
* }
*
* virtual void on_liveliness_lost (
* dds::pub::DataWriter<Foo::Bar>& writer,
* const dds::core::status::LivelinessLostStatus& status)
* {
* std::cout << "on_liveliness_lost" << std::endl;
* }
*
* virtual void on_publication_matched (
* dds::pub::DataWriter<Foo::Bar>& writer,
* const dds::core::status::PublicationMatchedStatus& status)
* {
* std::cout << "on_publication_matched" << std::endl;
* }
* };
*
* // Create DataWriter with the listener
* dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id());
* dds::topic::Topic<Foo::Bar> topic(participant, "TopicName");
* dds::pub::Publisher publisher(participant);
* dds::pub::DataWriter<Foo::Bar> writer(publisher,
* topic,
* publisher.default_datawriter_qos(),
* new ExampleListener(),
* dds::core::status::StatusMask::all());
*
* @endcode
*
* @see for more information: @ref DCPS_Modules_Publication_DataWriter "Data Writer"
* @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information"
*/
template <typename T>
class DataWriterListener
{
public:
/** @cond */
virtual ~DataWriterListener() { }
/** @endcond */
public:
/**
* This operation is called by the Data Distribution Service when the
* OfferedDeadlineMissedStatus changes.
*
* This operation will only be called when
* the relevant DataWriterListener is installed and enabled for the offered
* deadline missed status (StatusMask::offered_deadline_missed()). The
* offered deadline missed status will change when the
* deadline that the DataWriter has committed through its DeadlineQosPolicy
* was not respected for a specific instance.
*
* @param writer contain a pointer to the DataWriter on which
* the OfferedDeadlineMissedStatus has changed (this is an input to the
* application)
* @param status contain the
* OfferedDeadlineMissedStatus object (this is an input to
* the application).
*/
virtual void on_offered_deadline_missed(
dds::pub::DataWriter<T>& writer,
const dds::core::status::OfferedDeadlineMissedStatus& status) = 0;
/**
* This operation called by the Data Distribution Service when the
* OfferedIncompatibleQosStatus changes.
*
* This operation will only be called when
* the relevant DataWriterListener is installed and enabled for the
* StatusMask::offered_incompatible_qos(). The incompatible Qos status will
* change when a DataReader object has been discovered by the DataWriter with
* the same Topic and a requested DataReaderQos that was incompatible with the
* one offered by the DataWriter.
*
* @param writer contain a pointer to the DataWriter on which
* the OfferedIncompatibleQosStatus has changed (this is an input to
* the application).
* @param status contain the OfferedIncompatibleQosStatus object (this is
* an input to the application).
*/
virtual void on_offered_incompatible_qos(
dds::pub::DataWriter<T>& writer,
const dds::core::status::OfferedIncompatibleQosStatus& status) = 0;
/**
* This operation is called by the Data Distribution Service when the
* LivelinessLostStatus changes.
*
* This operation will only be called when the relevant
* DataWriterListener is installed and enabled for the liveliness lost status
* (StatusMask::liveliness_lost()).
* The liveliness lost status will change when the liveliness that the DataWriter has
* committed through its LivelinessQosPolicy was not respected. In other words,
* the DataWriter failed to actively signal its liveliness within the offered liveliness
* period. As a result, the DataReader objects will consider the DataWriter as no
* longer “alive”.
*
* @param writer contains a pointer to the DataWriter on which
* the LivelinessLostStatus has changed (this is an input to
* the application).
* @param status contains the LivelinessLostStatus object (this is an input
* to the application).
*/
virtual void on_liveliness_lost(
dds::pub::DataWriter<T>& writer,
const dds::core::status::LivelinessLostStatus& status) = 0;
/**
* This operation is called by the Data
* Distribution Service when a new match has been discovered for the current
* publication, or when an existing match has ceased to exist.
*
* Usually this means that a
* new DataReader that matches the Topic and that has compatible Qos as the current
* DataWriter has either been discovered, or that a previously discovered
* DataReader has ceased to be matched to the current DataWriter. A DataReader
* may cease to match when it gets deleted, when it changes its Qos to a value that is
* incompatible with the current DataWriter or when either the DataWriter or the
* DataReader has chosen to put its matching counterpart on its ignore-list using the
* dds::sub::ignore or dds::pub::ignore operations.
*
* it will only be called when the relevant DataWriterListener is installed and enabled
* for the StatusMask::publication_matched().
*
* @param writer contains a pointer to the DataWriter for which
* a match has been discovered (this is an input to the application provided by the
* Data Distribution Service).
* @param status contains the
* PublicationMatchedStatus object (this is an input to the application
* provided by the Data Distribution Service).
*/
virtual void on_publication_matched(
dds::pub::DataWriter<T>& writer,
const dds::core::status::PublicationMatchedStatus& status) = 0;
};
/**
* @brief
* DataWriter events Listener
*
* This listener is just like DataWriterListener, except
* that the application doesn't have to implement all operations.
*
* @code{.cpp}
* class ExampleListener : public virtual dds::pub::NoOpDataWriterListener<Foo::Bar>
* {
* // Not necessary to implement any Listener operations.
* };
* @endcode
*
* @see dds::pub::DataWriterListener
*/
template <typename T>
class NoOpDataWriterListener : public virtual DataWriterListener<T>
{
/** @cond
* All these functions have already been documented in the non-NoOp listener.
* Ignore these functions for the doxygen API documentation for clarity.
*/
public:
virtual ~NoOpDataWriterListener() { }
public:
virtual void
on_offered_deadline_missed(
dds::pub::DataWriter<T>&,
const dds::core::status::OfferedDeadlineMissedStatus&) { }
virtual void
on_offered_incompatible_qos(
dds::pub::DataWriter<T>&,
const dds::core::status::OfferedIncompatibleQosStatus&) { }
virtual void
on_liveliness_lost(
dds::pub::DataWriter<T>&,
const dds::core::status::LivelinessLostStatus&) { }
virtual void
on_publication_matched(
dds::pub::DataWriter<T>&,
const dds::core::status::PublicationMatchedStatus&) { }
/** @endcond */
};
}
}
#endif /* OMG_DDS_PUB_DATA_WRITER_LISTENER_HPP_ */

View File

@@ -0,0 +1,32 @@
#ifndef OMG_DDS_PUB_PUBLISHER_HPP_
#define OMG_DDS_PUB_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/Publisher.hpp>
namespace dds
{
namespace pub
{
typedef dds::pub::detail::Publisher Publisher;
}
}
#endif /* OMG_DDS_PUB_PUBLISHER_HPP_ */

View File

@@ -0,0 +1,141 @@
#ifndef OMG_DDS_PUB_PUBLISHER_LISTENER_HPP_
#define OMG_DDS_PUB_PUBLISHER_LISTENER_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/AnyDataWriterListener.hpp>
namespace dds
{
namespace pub
{
class PublisherListener;
class NoOpPublisherListener;
}
}
DDSCXX_WARNING_MSVC_OFF(4250)
/**
* @brief
* Publisher events Listener
*
* Since a Publisher is an Entity, it has the ability to have a Listener
* associated with it. In this case, the associated Listener should be of type
* PublisherListener. This interface must be implemented by the
* application. A user-defined class must be provided by the application which must
* extend from the PublisherListener class.
*
* <b><i>
* All operations for this interface must be implemented in the user-defined class, it is
* up to the application whether an operation is empty or contains some functionality.
* </i></b>
*
* The PublisherListener provides a generic mechanism (actually a
* callback function) for the Data Distribution Service to notify the application of
* relevant asynchronous status change events, such as a missed deadline, violation of
* a QosPolicy setting, etc. The PublisherListener is related to
* changes in communication status StatusConditions.
*
* @code{.cpp}
* // Application example listener
* class ExampleListener :
* public virtual dds::pub::PublisherListener
* {
* public:
* virtual void on_offered_deadline_missed (
* dds::pub::AnyDataWriter& writer,
* const dds::core::status::OfferedDeadlineMissedStatus& status)
* {
* std::cout << "on_offered_deadline_missed" << std::endl;
* }
*
* virtual void on_offered_incompatible_qos (
* dds::pub::AnyDataWriter& writer,
* const dds::core::status::OfferedIncompatibleQosStatus& status)
* {
* std::cout << "on_offered_incompatible_qos" << std::endl;
* }
*
* virtual void on_liveliness_lost (
* dds::pub::AnyDataWriter& writer,
* const dds::core::status::LivelinessLostStatus& status)
* {
* std::cout << "on_liveliness_lost" << std::endl;
* }
*
* virtual void on_publication_matched (
* dds::pub::AnyDataWriter& writer,
* const dds::core::status::PublicationMatchedStatus& status)
* {
* std::cout << "on_publication_matched" << std::endl;
* }
* };
*
* // Create Publisher with the listener
* dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id());
* dds::pub::Publisher publisher(participant,
* participant.default_publisher_qos(),
* new ExampleListener(),
* dds::core::status::StatusMask::all());
*
* @endcode
*
* @see for more information: @ref DCPS_Modules_Publisher "Publisher"
* @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information"
*/
class OMG_DDS_API dds::pub::PublisherListener : public virtual dds::pub::AnyDataWriterListener
{
public:
/** @cond */
virtual ~PublisherListener() { }
/** @endcond */
};
/**
* @brief
* Publisher events Listener
*
* This listener is just like PublisherListener, except
* that the application doesn't have to implement all operations.
*
* @code{.cpp}
* class ExampleListener : public virtual dds::pub::NoOpPublisherListener
* {
* // Not necessary to implement any Listener operations.
* };
* @endcode
*
* @see dds::pub::PublisherListener
*/
class OMG_DDS_API dds::pub::NoOpPublisherListener :
public virtual dds::pub::PublisherListener,
public virtual dds::pub::NoOpAnyDataWriterListener
{
public:
/** @cond */
virtual ~NoOpPublisherListener() { }
/** @endcond */
};
DDSCXX_WARNING_MSVC_ON(4250)
#endif /* OMG_DDS_PUB_PUBLISHER_LISTENER_HPP_ */

View File

@@ -0,0 +1,32 @@
#ifndef OMG_DDS_PUB_SUSPENDED_PUBLICATION_HPP_
#define OMG_DDS_PUB_SUSPENDED_PUBLICATION_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/SuspendedPublication.hpp>
namespace dds
{
namespace pub
{
typedef dds::pub::detail::SuspendedPublication SuspendedPublication;
}
}
#endif /* OMG_DDS_PUB_SUSPENDED_PUBLICATION_HPP_ */

View File

@@ -0,0 +1,354 @@
#ifndef OMG_TDDS_PUB_ANY_DATA_WRITER_HPP_
#define OMG_TDDS_PUB_ANY_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/core/TEntity.hpp>
#include <dds/pub/Publisher.hpp>
#include <dds/pub/qos/DataWriterQos.hpp>
#include <dds/topic/TopicDescription.hpp>
namespace dds
{
namespace pub
{
template <typename DELEGATE>
class TAnyDataWriter;
}
}
/**
* @brief
* Typeless base class for the typed DataWriter.
*
* DataWriters are created type specific (fi DataWriter<Foo::Bar> writer). However, there
* are many places in the API (and possibly application) where the type can not be known
* while still some DataWriter has to be passed around, stored or even typeless functionality
* called.<br>
* Main examples in the API that need typeless DataWriter are: Publisher, PublisherListener
* and DomainParticipantListener.
*
*/
template <typename DELEGATE>
class dds::pub::TAnyDataWriter : public dds::core::TEntity<DELEGATE>
{
public:
OMG_DDS_REF_TYPE_PROTECTED_DC(TAnyDataWriter, dds::core::TEntity, DELEGATE)
OMG_DDS_IMPLICIT_REF_BASE(TAnyDataWriter)
OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TAnyDataWriter)
//==========================================================================
//== Entity Navigation
/**
* Get the Publisher that owns this DataWriter.
*
* @return the Publisher
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
*/
const dds::pub::Publisher& publisher() const;
/**
* Get the TopicDescription associated with this DataWriter.
*
* @return the TopicDescription
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
*/
const dds::topic::TopicDescription& topic_description() const;
//==========================================================================
//== QoS Management
/**
* Gets the DataWriterQos setting for this instance.
*
* @return the qos
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::pub::qos::DataWriterQos
qos() const;
/**
* This operation replaces the existing set of QosPolicy settings for a DataWriter.
*
* The parameter qos contains the object with the QosPolicy settings which is
* checked for self-consistency and mutability.
*
* When the application tries to change a
* QosPolicy setting for an enabled DataWriter, which can only be set before the
* DataWriter is enabled, the operation will fail and a
* ImmutablePolicyError is thrown. In other words, the application must
* provide the presently set QosPolicy settings in case of the immutable QosPolicy
* settings. Only the mutable QosPolicy settings can be changed.
*
* When the qos contains conflicting QosPolicy settings (not self-consistent),
* the operation will fail and an InconsistentPolicyError is thrown.
*
* @param qos the qos
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::ImmutablePolicyError
* The parameter qos contains an immutable QosPolicy setting with a
* different value than set during enabling of the DataWriter.
* @throws dds::core::InconsistentPolicyError
* The parameter qos contains conflicting QosPolicy settings,
*/
void qos(const dds::pub::qos::DataWriterQos& qos);
/** @copydoc dds::pub::TAnyDataWriter::qos(const dds::pub::qos::DataWriterQos& qos) */
TAnyDataWriter& operator << (const dds::pub::qos::DataWriterQos& qos);
/** @copydoc dds::pub::TAnyDataWriter::qos() */
const TAnyDataWriter& operator >> (dds::pub::qos::DataWriterQos& qos) const;
//==========================================================================
//== ACKs
/**
* This operation blocks the calling thread until either all data written
* by the DataWriter is acknowledged by the local infrastructure, or until
* the duration specified by the timeout parameter elapses,
* whichever happens first.
*
* Data is acknowledged by the local infrastructure when it does not need to be stored
* in its DataWriters local history. When a locally-connected subscription (including
* the networking service) has no more resources to store incoming samples it will start
* to reject these samples, resulting in their source DataWriters to store them
* temporarily in their own local history to be retransmitted at a later moment in time.<br>
* In such scenarios, the wait_for_acknowledgments operation will block until the
* DataWriter has retransmitted its entire history, which is therefore effectively
* empty, or until the timeout expires, whichever happens first. In the latter
* case, this operation will throw a TimeoutError.
*
* <i>
* Be aware that in case the operation returns normally, the data has only been
* acknowledged by the local infrastructure: it does not mean all remote subscriptions
* have already received the data. However, delivering the data to remote nodes is then
* the sole responsibility of the networking service: even when the publishing
* application would terminate, all data that has not yet been received may be
* considered on-route and will therefore eventually arrive (unless the networking
* service itself will crash). In contrast, if a DataWriter would still have data in its
* local history buffer when it terminates, this data is considered lost.
* </i>
*
* This operation is intended to be used only if one or more of the contained
* DataWriters has its ReliabilityQosPolicyKind set to RELIABLE.
* Otherwise the operation will return immediately, since best-effort DataWriters will
* never store rejected samples in their local history:
* they will just drop them and continue business as usual.
*
* @param timeout the time out duration
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::TimeoutError
* Not all data is acknowledged before timeout elapsed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
void wait_for_acknowledgments(const dds::core::Duration& timeout);
//==========================================================================
//== Status Management
/**
* This operation obtains the LivelinessLostStatus object of the DataWriter.
*
* The LivelinessLostStatus contains the information whether the liveliness (that the
* DataWriter has committed through its Liveliness QosPolicy) was respected.
* This means that the status represents whether the DataWriter failed to actively
* signal its liveliness within the offered liveliness period. If the liveliness is lost, the
* DataReader objects will consider the DataWriter as no longer “alive”.
*
* The LivelinessLostStatus can also be monitored using a
* DataWriterListener or by using the associated StatusCondition.
*
* @return the LivelinessLostStatus
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
const dds::core::status::LivelinessLostStatus liveliness_lost_status();
/**
* This operation obtains the OfferedDeadlineMissedStatus object of the DataWriter.
*
* The OfferedDeadlineMissedStatus contains the information whether the deadline (that the
* DataWriter has committed through its Deadline QosPolicy) was respected for
* each instance.
*
* The OfferedDeadlineMissedStatus can also be monitored using a
* DataWriterListener or by using the associated StatusCondition.
*
* @return the OfferedDeadlineMissedStatus
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
const dds::core::status::OfferedDeadlineMissedStatus offered_deadline_missed_status();
/**
* This operation obtains the OfferedIncompatibleQosStatus object of the DataWriter.
*
* The OfferedIncompatibleQosStatus contains the information whether a QosPolicy setting
* was incompatible with the requested QosPolicy setting.
*
* This means that the status represents whether a DataReader object has been
* discovered by the DataWriter with the same Topic and a requested
* DataReaderQos that was incompatible with the one offered by the DataWriter.
*
* The OfferedIncompatibleQosStatus can also be monitored using a
* DataWriterListener or by using the associated StatusCondition.
*
* @return the OfferedIncompatibleQosStatus
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
const dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_status();
/**
* This operation obtains the PublicationMatchedStatus object of the DataWriter.
*
* The PublicationMatchedStatus contains the information whether a new match has been
* discovered for the current publication, or whether an existing match has ceased to
* exist.
*
* This means that the status represents that either a DataReader object has been
* discovered by the DataWriter with the same Topic and a compatible Qos, or that a
* previously discovered DataReader has ceased to be matched to the current
* DataWriter. A DataReader may cease to match when it gets deleted, when it
* changes its Qos to a value that is incompatible with the current DataWriter or
* when either the DataWriter or the DataReader has chosen to put its matching
* counterpart on its ignore-list using the dds::sub::ignore or
* dds::pub::ignore operations.
*
* The operation may fail if the infrastructure does not hold the information necessary
* to fill in the PublicationMatchedStatus. This is the case when OpenSplice is
* configured not to maintain discovery information in the Networking Service. (See
* the description for the NetworkingService/Discovery/enabled property in
* the Deployment Manual for more information about this subject.) In this case the
* operation will throw UnsupportedError.
*
* The PublicationMatchedStatus can also be monitored using a
* DataWriterListener or by using the associated StatusCondition.
*
* @return the PublicationMatchedStatus
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::UnsupportedError
* OpenSplice is configured not to maintain the information
* about “associated” subscriptions.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
const dds::core::status::PublicationMatchedStatus publication_matched_status();
//==========================================================================
//== Liveliness Management
/**
* This operation asserts the liveliness for the DataWriter.
*
* This operation will manually assert the liveliness for the DataWriter. This way,
* the Data Distribution Service is informed that the corresponding DataWriter is
* still alive. This operation is used in combination with the Liveliness QosPolicy
* set to Liveliness::ManualByParticipant or Liveliness::ManualByTopic.
*
* Writing data via the write operation of a DataWriter will assert the liveliness on
* the DataWriter itself and its containing DomainParticipant. Therefore,
* assert_liveliness is only needed when not writing regularly.
*
* The liveliness should be asserted by the application, depending on the
* LivelinessQosPolicy. Asserting the liveliness for this DataWriter can also
* be achieved by asserting the liveliness to the DomainParticipant.
*
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::NotEnabledError
* The entity has not yet been enabled.
*/
void assert_liveliness();
};
#endif /* OMG_TDDS_PUB_ANY_DATA_WRITER_HPP_ */

View File

@@ -0,0 +1,129 @@
#ifndef OMG_TDDS_PUB_COHERENT_SET_HPP_
#define OMG_TDDS_PUB_COHERENT_SET_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/Publisher.hpp>
namespace dds
{
namespace pub
{
template <typename DELEGATE>
class TCoherentSet;
}
}
/**
* @brief
* Class for RAII way of beginning/ending coherent publication sets.
*
* A coherent set is a set of modifications that must be
* propagated in such a way that they are interpreted at the
* receivers' side as a consistent set of modifications; that
* is, the receiver will only be able to access the data after
* all the modifications in the set are available at the
* receiver end.
*
* A connectivity change may occur in the middle
* of a set of coherent changes; for example, the set of
* partitions used by the Publisher or one of its Subscribers
* may change, a late-joining DataReader may appear on the
* network, or a communication failure may occur. In the event
* that such a change prevents an entity from receiving the
* entire set of coherent changes, that entity must behave as if
* it had received none of the set.
*
* The support for
* coherent changes enables a publishing application to change
* the value of several data-instances that could belong to the
* same or different topics and have those changes be seen
* atomically by the readers. This is useful in cases where
* the values are inter-related. For example, if there are two
* data instances representing the altitude and velocity
* vector of the same aircraft and both are changed, it may be
* useful to communicate those values in such a way the reader
* can see both together; otherwise, it may, for example,
* erroneously interpret that the aircraft is on a collision course.
*
* @see for more information: @ref DCPS_Modules_Publication "Publication"
* @see dds::pub::Publisher
*/
template <typename DELEGATE>
class dds::pub::TCoherentSet : public dds::core::Value<DELEGATE>
{
public:
/**
* Creating a CoherentSet object, which will begin a coherent set of
* modifications using DataWriter objects attached to this Publisher.
*
* A precondition for making coherent changes is that the PresentationQos of the
* Publisher has its coherent_access attribute set to TRUE. If this is not the case,
* the Publisher will not accept any coherent start requests and throw
* dds::core::PreconditionNotMetError.
*
* @param pub The publisher to supsend publications on.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::AlreadyClosedError
* The Publisher has already been closed.
* @throws dds::core::NotEnabledError
* The Publisher has not yet been enabled.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::NullReferenceError
* The Publisher was not properly created and references to dds::core::null.
* @throws dds::core::PreconditionNotMetError
* The coherent access attribute of the Publisher's PresentationQos is not set to true.
*/
explicit TCoherentSet(const dds::pub::Publisher& pub);
public:
/**
* This operation will explicitly end the publication of an coherent set.
*
* If the Publisher already ended its coherent set (by a call to this very
* operation), then a call to this operation will have no effect.
*
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::AlreadyClosedError
* The Publisher has already been closed.
* @throws dds::core::NotEnabledError
* The Publisher has not yet been enabled.
* @throws dds::core::NullReferenceError
* The Publisher was not properly created and references to dds::core::null.
*/
void end();
public:
/**
* The destruction of the CoherentSet will implicitly end the publication
* of a coheren set if not already ended by a call to end().
*
* When there is a problem with which end() would normally throw an exception,
* then that exception is swallowed. Errors can be found in the logs.
*/
~TCoherentSet();
};
#endif /* OMG_TDDS_PUB_COHERENT_SET_HPP_ */

View File

@@ -0,0 +1,318 @@
#ifndef OMG_TDDS_PUB_PUBLISHER_HPP_
#define OMG_TDDS_PUB_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/core/types.hpp>
#include <dds/core/TEntity.hpp>
#include <dds/pub/qos/DataWriterQos.hpp>
#include <dds/pub/qos/PublisherQos.hpp>
#include <dds/domain/DomainParticipant.hpp>
namespace dds
{
namespace pub
{
template <typename DELEGATE>
class TPublisher;
class PublisherListener;
}
}
/**
* @brief
* The Publisher acts on the behalf of one or several DataWriter objects
* that belong to it.
*
* When it is informed of a change to the data associated
* with one of its DataWriter objects, it decides when it is appropriate
* to actually send the data-update message. In making this decision, it
* considers any extra information that goes with the data (timestamp,
* writer, etc.) as well as the QoS of the Publisher and the DataWriter.
*
* @see for more information: @ref DCPS_Modules_Publisher "Publisher"
*/
template <typename DELEGATE>
class dds::pub::TPublisher : public dds::core::TEntity<DELEGATE>
{
public:
/**
* Local convenience typedef for dds::pub::PublisherListener.
*/
typedef dds::pub::PublisherListener Listener;
public:
OMG_DDS_REF_TYPE_PROTECTED_DC(TPublisher, dds::core::TEntity, DELEGATE)
OMG_DDS_IMPLICIT_REF_BASE(TPublisher)
OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TPublisher)
/**
* Create a new Publisher.
*
* The Publisher will be created with the QoS values specified on the last
* successful call to @link dds::domain::DomainParticipant::default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos)
* dp.default_publisher_qos(qos) @endlink or, if the call was never made, the
* @ref anchor_dds_pub_publisher_qos_defaults "default" values.
*
* @param dp the domain participant
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
TPublisher(const dds::domain::DomainParticipant& dp);
/**
* Create a new Publisher.
*
* The Publisher will be created with the given QosPolicy settings and if
* applicable, attaches the optionally specified PublisherListener to it.
*
* See @ref DCPS_Modules_Infrastructure_Listener "listener" for more information
* about listeners and possible status propagation to other entities.
*
* @param dp the domain participant to create the Publisher with.
* @param qos a collection of QosPolicy settings for the new Publisher. In case
* these settings are not self consistent, no Publisher is created.
* @param listener the publisher listener
* @param mask the mask of events notified to the listener
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::InconsistentPolicyError
* The parameter qos contains conflicting QosPolicy settings.
*/
TPublisher(const dds::domain::DomainParticipant& dp,
const dds::pub::qos::PublisherQos& qos,
dds::pub::PublisherListener* listener = NULL,
const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none());
//==========================================================================
/**
* Gets the PublisherQos setting for this instance.
*
* @return the qos
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
const dds::pub::qos::PublisherQos& qos() const;
/**
* Sets the PublisherQos setting for this instance.
*
* @param qos the qos
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
void qos(const dds::pub::qos::PublisherQos& qos);
/** @copydoc dds::pub::Publisher::qos(const dds::pub::qos::PublisherQos& qos) */
TPublisher& operator <<(const dds::pub::qos::PublisherQos& qos);
/** @copydoc dds::pub::Publisher::qos() */
TPublisher& operator >> (dds::pub::qos::PublisherQos& qos);
/**
* Sets the default DataWriterQos of the Publisher.
*
* This operation sets the default SubscriberQos of the Publisher which
* is used for newly created Subscriber objects, when no QoS is provided.
*
* This operation checks if the DataWriterQos is self consistent. If it is not, the
* operation has no effect and throws dds::core::InconsistentPolicyError.
*
* The values set by this operation are returned by dds::pub::Publisher::default_datawriter_qos().
*
* @param qos the default DataWriterQos
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::UnsupportedError
* One or more of the selected QosPolicy values are
* currently not supported by OpenSplice.
* @throws dds::core::InconsistentPolicyError
* The parameter qos contains conflicting QosPolicy settings,
* e.g. a history depth that is higher than the specified resource limits.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
TPublisher& default_datawriter_qos(const dds::pub::qos::DataWriterQos& qos);
/**
* Gets the default DataWriterQos of the Publisher.
*
* This operation gets an object with the default DataWriter QosPolicy settings of
* the Publisher (that is the DataWriterQos) which is used for newly
* created DataWriter objects, in case no QoS was provided during the creation.
*
* The values retrieved by this operation match the set of values specified on the last
* successful call to
* dds::pub::Publisher::default_datawriter_qos(const dds::pub::qos::DataWriterQos& qos),
* or, if the call was never made, the @ref anchor_dds_pub_datawriter_qos_defaults "default" values.
*
* @return the default DataWriterQos
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::pub::qos::DataWriterQos default_datawriter_qos() const;
//==========================================================================
/**
* Register a listener with the Publisher.
*
* The notifications received by the listener depend on the
* status mask with which it was registered.
*
* Listener un-registration is performed by setting the listener to NULL.
*
* See also @ref DCPS_Modules_Infrastructure_Listener "listener information".
*
* @param plistener the listener
* @param mask the mask defining the events for which the listener
* will be notified.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::UnsupportedError
* A status was selected that cannot be supported because
* the infrastructure does not maintain the required connectivity information.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
void listener(Listener* plistener,
const dds::core::status::StatusMask& mask);
/**
* Get the listener of this Publisher.
*
* See also @ref DCPS_Modules_Infrastructure_Listener "listener information".
*
* @return the listener
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
*/
Listener* listener() const;
//==========================================================================
/**
* This operation blocks the calling thread until either all data written
* by the reliable DataWriter entities is acknowledged by all matched
* reliable DataReader entities, or else the duration specified by the
* timeout parameter elapses, whichever happens first.
*
* Data is acknowledged by the local infrastructure when it does not need to be stored
* in its DataWriters local history. When a locally-connected subscription (including
* the networking service) has no more resources to store incoming samples it will start
* to reject these samples, resulting in their source DataWriters to store them
* temporarily in their own local history to be retransmitted at a later moment in time.<br>
* In such scenarios, the wait_for_acknowledgments operation will block until all
* contained DataWriters have retransmitted their entire history, which is therefore
* effectively empty, or until the max_wait timeout expires, whichever happens first.
* In the latter case it will throw dds::core::TimeoutError.
*
* <i>
* Be aware that in case the operation returns normally, the data has only been
* acknowledged by the local infrastructure: it does not mean all remote subscriptions
* have already received the data. However, delivering the data to remote nodes is then
* the sole responsibility of the networking service: even when the publishing
* application would terminate, all data that has not yet been received may be
* considered on-route and will therefore eventually arrive (unless the networking
* service itself will crash). In contrast, if a DataWriter would still have data in its
* local history buffer when it terminates, this data is considered lost.
* </i>
*
* This operation is intended to be used only if one or more of the contained
* DataWriters has its ReliabilityQosPolicyKind set to RELIABLE.
* Otherwise the operation will return immediately, since best-effort DataWriters will
* never store rejected samples in their local history:
* they will just drop them and continue business as usual.
*
* @param timeout the time out duration
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::TimeoutError
* Not all data is acknowledged before timeout elapsed.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
void wait_for_acknowledgments(const dds::core::Duration& timeout);
//==========================================================================
/**
* Return the DomainParticipant that owns this Publisher.
*
* @return the DomainParticipant
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
*/
const dds::domain::DomainParticipant& participant() const;
};
#endif /* OMG_TDDS_PUB_PUBLISHER_HPP_ */

View File

@@ -0,0 +1,133 @@
#ifndef OMG_TDDS_PUB_SUSPENDED_PUBLICATION_HPP_
#define OMG_TDDS_PUB_SUSPENDED_PUBLICATION_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/Publisher.hpp>
namespace dds
{
namespace pub
{
template <typename DELEGATE>
class TSuspendedPublication;
}
}
/**
* @brief
* Class for RAII way of suspending/resuming publication.
*
* Suspended publication indicates to the Service that the application is about
* to make multiple modifications using DataWriter objects belonging to
* the Publisher.
*
* It is a hint to the Service so it can optimize its performance by,
* e.g., holding the dissemination of the modifications and then batching
* them. It is not required that the Service use this hint in any way.
*
* When a Suspended publication is started, it must be matched by
* a corresponding call to SuspendedPublication::resume() or the destruction
* of the SuspendedPublication object (which is an implicit resume),
* indicating that the set of modifications has
* completed. If the Publisher is deleted before the resume,
* any suspended updates yet to be published will be discarded.
*
* This object suspends the publication of all DataWriter objects contained by
* the given Publisher. The data written, disposed or unregistered by a DataWriter is
* stored in the history buffer of the DataWriter and therefore, depending on its QoS
* settings, the following operations may block (see the operation descriptions for
* more information):
* - dds::pub::DataWriter.write (and its overloaded counterparts).
* - dds::pub::DataWriter.operator<< (and its overloaded counterparts).
* - dds::pub::DataWriter.unregister_instance (and its overloaded counterparts).
* - dds::pub::DataWriter.dispose_instance (and its overloaded counterparts).
*
* @see for more information: @ref DCPS_Modules_Publication "Publication"
* @see dds::pub::Publisher
*/
template <typename DELEGATE>
class dds::pub::TSuspendedPublication : public dds::core::Value<DELEGATE>
{
public:
/**
* Creating a SuspendedPublication object, which will suspend the
* dissemination of the publications by all contained DataWriter objects
* of the given Publisher.
*
* @param pub The publisher to supsend publications on.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::AlreadyClosedError
* The Publisher has already been closed.
* @throws dds::core::NotEnabledError
* The Publisher has not yet been enabled.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::NullReferenceError
* The Publisher was not properly created and references to dds::core::null.
*/
explicit TSuspendedPublication(const dds::pub::Publisher& pub);
public:
/**
* This operation will explicitly resume the publication of all
* DataWriter objects contained by the given Publisher at construction.
*
* All data held in the history
* buffer of the DataWriter's is actively published to the consumers. When the
* operation returns all DataWriter's have resumed the publication of suspended
* updates.
*
* If the Publisher already resumed its publication (by a call to this very
* operation), then a call to this operation will have no effect.
*
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::AlreadyClosedError
* The Publisher has already been closed.
* @throws dds::core::NotEnabledError
* The Publisher has not yet been enabled.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::NullReferenceError
* The Publisher was not properly created and references to dds::core::null.
*/
void resume();
public:
/**
* The destruction of the SuspendedPublication will implicitly resume
* the publication if not already resumed by a call to resume().
*
* All data held in the history
* buffer of the DataWriter's is actively published to the consumers. When the
* operation returns all DataWriter's have resumed the publication of suspended
* updates.
*
* When there is a problem with which resume() would normally throw an exception,
* then that exception is swallowed. Errors can be found in the logs.
*/
~TSuspendedPublication();
};
#endif /* OMG_TDDS_PUB_SUSPENDED_PUBLICATION_HPP_ */

View File

@@ -0,0 +1,32 @@
#ifndef OMG_DDS_PUB_PACKAGE_INCLUDE_HPP_
#define OMG_DDS_PUB_PACKAGE_INCLUDE_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/DataWriter.hpp>
#include <dds/pub/AnyDataWriter.hpp>
#include <dds/pub/find.hpp>
#include <dds/pub/discovery.hpp>
#include <dds/pub/SuspendedPublication.hpp>
#include <dds/pub/CoherentSet.hpp>
#include <dds/pub/detail/ddspub.hpp>
#endif /* OMG_DDS_PUB_PACKAGE_INCLUDE_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_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_ */

View File

@@ -0,0 +1,186 @@
#ifndef OMG_DDS_PUB_DISCOVERY_HPP_
#define OMG_DDS_PUB_DISCOVERY_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/domain/DomainParticipant.hpp>
#include <dds/pub/DataWriter.hpp>
#include <dds/topic/BuiltinTopic.hpp>
#include <dds/pub/detail/discovery.hpp>
namespace dds
{
namespace pub
{
/**
* Ignore publications.
*
* <b><i>This operation is not yet implemented. It is scheduled for a future release.</i></b>
*
* @param dp the DomainParticipant for which the remote
* entity will be ignored
* @param handle the InstanceHandle of the remote entity that
* has to be ignored
*/
void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp,
const dds::core::InstanceHandle& handle);
/**
* Ignore publications.
*
* <b><i>This operation is not yet implemented. It is scheduled for a future release.</i></b>
*
* @param dp the DomainParticipant for which the remote
* entity will be ignored
* @param begin an iterator indicating the beginning of a
* sequence of InstanceHandles of the remote
* Entity that has to be ignored
* @param end an iterator indicating the end of a
* sequence of InstanceHandles of the remote
* Entity that has to be ignored
*/
template <typename FwdIterator>
void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end);
/**
* This operation retrieves the list of subscriptions currently “associated” with the
* DataWriter. That is, subscriptions that have a matching Topic and compatible
* QoS that the application has not indicated should be “ignored” by means of the
* dds::sub::ignore operation on the DomainParticipant class.
*
* The handles returned in the dds::core::InstanceHandleSeq are the ones that
* are used by the DDS implementation to locally identify the corresponding matched
* DataReader entities. You can access more detailed information about a particular
* subscription by passing its subscription_handle to either the
* dds::pub::matched_subscription_data operation or to the read with instance
* operation on the built-in reader for the “DCPSSubscription” topic.
*
* See @ref DCPS_Builtin_Topics "Builtin Topics" for more information.
*
* @param dw the DataWriter
* @return a sequence of handles
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::NotEnabledError
* The DataWriter has not yet been enabled.
* @throws dds::core::UnsupportedError
* OpenSplice is configured not to maintain the
* information about “associated” subscriptions.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
template <typename T>
::dds::core::InstanceHandleSeq
matched_subscriptions(const dds::pub::DataWriter<T>& dw);
/**
* This operation retrieves the list of subscriptions currently “associated” with the
* DataWriter. That is, subscriptions that have a matching Topic and compatible
* QoS that the application has not indicated should be “ignored” by means of the
* dds::sub::ignore operation on the DomainParticipant class.
*
* The handles returned in the dds::core::InstanceHandleSeq are the ones that
* are used by the DDS implementation to locally identify the corresponding matched
* DataReader entities. You can access more detailed information about a particular
* subscription by passing its subscription_handle to either the
* dds::pub::matched_subscription_data operation or to the read with instance
* operation on the built-in reader for the “DCPSSubscription” topic.
*
* See @ref DCPS_Builtin_Topics "Builtin Topics" for more information.
*
* @param dw the DataWriter
* @param begin an iterator indicating the beginning of a sequence of
* instance handles in which to put the matched subscriptions
* @param max_size the maximum number of matched subscriptions to return
* @return the number of matched subscriptions returned
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::NotEnabledError
* The DataWriter has not yet been enabled.
* @throws dds::core::UnsupportedError
* OpenSplice is configured not to maintain the
* information about “associated” subscriptions.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
template <typename T, typename FwdIterator>
uint32_t
matched_subscriptions(const dds::pub::DataWriter<T>& dw,
FwdIterator begin, uint32_t max_size);
/**
* This operation retrieves information on the specified subscription that is currently
* “associated” with the DataWriter. That is, a subscription with a matching Topic
* and compatible QoS that the application has not indicated should be “ignored” by
* means of the dds::sub::ignore operation on the DomainParticipant
* class.
*
* The subscription_handle must correspond to a subscription currently
* associated with the DataWriter, otherwise the operation will fail and throw
* InvalidArgumentError. The operation dds::pub::matched_subscriptions can
* be used to find the subscriptions that are currently matched with the DataWriter.
*
* The operation may fail if the infrastructure does not locally maintain the
* connectivity information. This is the case when OpenSplice is configured not to
* maintain discovery information in the Networking Service. (See the description for
* the NetworkingService/Discovery/enabled property in the Deployment
* Manual for more information about this subject.) In such cases the operation will
* throw UnsupportedError.
*
* See also @ref DCPS_Builtin_Topics and @ref DCPS_Builtin_Topics_SubscriptionData.
*
* @param dw the DataWriter
* @param h the InstanceHandle
* @return the SubscriptionBuiltinTopicData
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The entity was not properly created and references to dds::core::null.
* @throws dds::core::AlreadyClosedError
* The entity has already been closed.
* @throws dds::core::NotEnabledError
* The DataWriter has not yet been enabled.
* @throws dds::core::UnsupportedError
* OpenSplice is configured not to maintain the
* information about “associated” subscriptions.
* @throws dds::core::InvalidArgumentError
* Subscription not associated with the DataWriter.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
template <typename T>
const dds::topic::SubscriptionBuiltinTopicData
matched_subscription_data(const dds::pub::DataWriter<T>& dw,
const ::dds::core::InstanceHandle& h);
}
}
#endif /* OMG_DDS_PUB_DISCOVERY_HPP_ */

View File

@@ -0,0 +1,74 @@
#ifndef OMG_DDS_PUB_FIND_HPP_
#define OMG_DDS_PUB_FIND_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 <string>
#include <dds/pub/detail/find.hpp>
namespace dds
{
namespace pub
{
/**
* This function retrieves previously-created DataWriters
* belonging to the Publisher that is attached to a Topic with a
* matching topic_name. If no such DataWriter exists, the operation
* will return an empty container.
*
* @param pub the Publisher to find an associated DataWriter for
* @param topic_name the topic name
* @param begin a iterator for a sequence in which to put found
* DataWriters
* @param max_size the maximum number of DataWriters to return
* @return the total number of elements found. Notice that
* at most max_size will be copied using the provided iterator
*
*/
template <typename WRITER, typename FwdIterator>
uint32_t
find(const dds::pub::Publisher& pub, const std::string& topic_name,
FwdIterator begin, uint32_t max_size);
/**
* This function retrieves previously-created DataWriters
* belonging to the Publisher that is attached to a Topic with a
* matching topic_name. If no such DataWriter exists, the operation
* will return an empty container.
*
* @param pub the Publisher to find an associated DataWriter for
* @param topic_name the topic name
* @param begin a back insertion iterator for a sequence in which
* to put found DataWriters
* @return the total number of elements found. Notice that
* at most max_size will be copied using the provided iterator.
*
*/
template <typename WRITER, typename BinIterator>
uint32_t
find(const dds::pub::Publisher& pub, const std::string& topic_name,
BinIterator begin);
}
}
#endif /* OMG_DDS_PUB_FIND_HPP_ */

View File

@@ -0,0 +1,35 @@
#ifndef OMG_DDS_QOS_DATA_WRITER_QOS_HPP_
#define OMG_DDS_QOS_DATA_WRITER_QOS_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/qos/detail/DataWriterQos.hpp>
namespace dds
{
namespace pub
{
namespace qos
{
typedef dds::pub::qos::detail:: DataWriterQos DataWriterQos;
}
}
}
#endif /* OMG_DDS_QOS_DATA_WRITER_QOS_HPP_ */

View File

@@ -0,0 +1,35 @@
#ifndef OMG_DDS_QOS_PUBLISER_QOS_HPP_
#define OMG_DDS_QOS_PUBLISER_QOS_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/qos/detail/PublisherQos.hpp>
namespace dds
{
namespace pub
{
namespace qos
{
typedef dds::pub::qos::detail::PublisherQos PublisherQos;
}
}
}
#endif /* OMG_DDS_QOS_PUBLISER_QOS_HPP_ */

View File

@@ -0,0 +1,152 @@
#ifndef OMG_DDS_PUB_QOS_DETAIL_DATAWRITER_QOS_HPP_
#define OMG_DDS_PUB_QOS_DETAIL_DATAWRITER_QOS_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/core/detail/TEntityQosImpl.hpp>
#include <org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp>
#ifdef DOXYGEN_FOR_ISOCPP
/* The above macro is never (and must never) be defined in normal compilation.
*
* The class below is just used to create informative API documentation.
* The predoxygen.py script will copy this over the QoS API header file.
*/
/**
* @brief
* This object provides the basic mechanism for an application to specify Quality of
* Service attributes for a DataWriter.
*
* @par Attributes
* @anchor anchor_dds_pub_datawriter_qos_defaults
* QosPolicy | Desciption | Default Value
* --------------------------------------- | -------------------------------------------------------------------------- | --------------------
* dds::core::policy::UserData | Additional information (@ref DCPS_QoS_UserData "info") | UserData::UserData(empty)
* dds::core::policy::Durability | Data storage settings for late joiners (@ref DCPS_QoS_Durability "info") | Durability::Volatile()
* dds::core::policy::Deadline | Period in which new sample is written (@ref DCPS_QoS_Deadline "info") | Deadline::Deadline(infinite)
* dds::core::policy::LatencyBudget | Used for optimization (@ref DCPS_QoS_LatencyBudget "info") | LatencyBudget::LatencyBudget(zero)
* dds::core::policy::Liveliness | Liveliness assertion mechanism (@ref DCPS_QoS_Liveliness "info") | Liveliness::Automatic()
* dds::core::policy::Reliability | Reliability settings (@ref DCPS_QoS_Reliability "info") | Reliability::Reliable()
* dds::core::policy::DestinationOrder | DataReader data order settings (@ref DCPS_QoS_DestinationOrder "info") | DestinationOrder::ReceptionTimestamp()
* dds::core::policy::History | Data storage settings (@ref DCPS_QoS_History "info") | History::KeepLast(depth 1)
* dds::core::policy::ResourceLimits | Maximum resource settings (@ref DCPS_QoS_ResourceLimits "info") | ResourceLimits::ResourceLimits(all unlimited)
* dds::core::policy::TransportPriority | Priority hint for transport layer (@ref DCPS_QoS_TransportPriority "info") | TransportPriority::TTransportPriority(0)
* dds::core::policy::Lifespan | Maximum duration of validity of data (@ref DCPS_QoS_Lifespan "info") | Lifespan::Lifespan(infinite)
* dds::core::policy::Ownership | Exclusive ownership or not (@ref DCPS_QoS_Ownership "info") | Ownership::Shared()
* dds::core::policy::OwnershipStrength | Ownership strenght (@ref DCPS_QoS_OwnershipStrength "info") | OwnershipStrength::OwnershipStrength(0)
* dds::core::policy::WriterDataLifecycle | Dispose with unregister or not (@ref DCPS_QoS_WriterDataLifecycle "info") | WriterDataLifecycle::AutoDisposeUnregisteredInstances()
* dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1)
* dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION
*
* A QosPolicy can be set when the DataWriter is created or modified with the set
* qos operation.
* Both operations take the DataWriterQos object as a parameter. There may be cases
* where several policies are in conflict. Consistency checking is performed each time
* the policies are modified when they are being created and, in case they are already
* enabled, via the set qos operation.
*
* Some QosPolicy have "immutable" semantics meaning that they can only be
* specified either at DataWriter creation time or prior to calling the enable
* operation on the DataWriter.
*
* @see for more information: @ref DCPS_QoS
*/
class dds::pub::qos::DataWriterQos : public ::dds::core::EntityQos<org::eclipse::cyclonedds::pub::qos::DataWriterQosDelegate>
{
public:
/**
* Create @ref anchor_dds_pub_datawriter_qos_defaults "default" QoS.
*/
DataWriterQos() {}
/**
* Create copied QoS type.
*
* @param qos the QoS to copy policies from.
*/
DataWriterQos(const DataWriterQos& qos);
/**
* Create a DataWriter QoS from a TopicQos.
*
* This operation will copy the QosPolicy settings from the TopicQos to the
* corresponding QosPolicy settings in the DataWriterQos. The related value
* in DataWriterQos will be repliced, while the other policies will get the
* @ref anchor_dds_pub_datawriter_qos_defaults "default" QoS policies.
*
* This is a "convenience" operation. It can be used to merge
* @ref anchor_dds_pub_datawriter_qos_defaults "default" DataWriter
* QosPolicy settings with the corresponding ones on the Topic. The resulting
* DataWriterQos can then be used to create a new DataWriter, or set its
* DataWriterQos.
* @code{.cpp}
* dds::topic::qos::TopicQos topicQos = topic.qos();
* dds::pub::qos::DataWriterQos writerQos(topicQos);
* // Policies of the DataWriterQos that are not present in the TopicQos
* // have the default value.
* @endcode
*
* This operation does not check the resulting DataWriterQos for self
* consistency. This is because the "merged" DataWriterQos may not be the
* final one, as the application can still modify some QosPolicy settings prior to
* applying the DataWriterQos to the DataWriter.
*
* @param qos the QoS to copy policies from.
*/
DataWriterQos(const dds::topic::qos::TopicQos& qos);
/**
* Assign dds::topic::qos::TopicQos policies to the DataWriterQos.
*
* This operation will copy the QosPolicy settings from the TopicQos to the
* corresponding QosPolicy settings in the DataWriterQos (replacing the values,
* if present).
*
* This is a "convenience" operation, useful in combination with the operations
* Publisher::default_datawriter_qos() and dds::topic::Topic::qos().
* This operation can be used to merge the DataWriter
* QosPolicy settings with the corresponding ones on the Topic. The resulting
* DataWriterQos can then be used to create a new DataWriter, or set its
* DataWriterQos.
* @code{.cpp}
* dds::topic::qos::TopicQos topicQos = topic.qos();
* dds::pub::qos::DataWriterQos writerQos = publisher.default_datawriter_qos();
* writerQos = topicQos;
* // Policies of the DataWriterQos that are not present in the TopicQos are untouched.
* @endcode
*
* This operation does not check the resulting DataWriterQos for self
* consistency. This is because the "merged" DataWriterQos may not be the
* final one, as the application can still modify some QosPolicy settings prior to
* applying the DataWriterQos to the DataWriter.
*
* @param qos the QoS to copy policies from.
*/
DataWriterQos& operator= (const dds::topic::qos::TopicQos& other);
};
#else /* DOXYGEN_FOR_ISOCPP */
namespace dds { namespace pub { namespace qos { namespace detail {
typedef dds::core::TEntityQos<org::eclipse::cyclonedds::pub::qos::DataWriterQosDelegate> DataWriterQos;
} } } }
#endif /* DOXYGEN_FOR_ISOCPP */
#endif /* OMG_DDS_PUB_QOS_DETAIL_DATAWRITER_QOS_HPP_ */

View File

@@ -0,0 +1,82 @@
#ifndef OMG_DDS_PUB_QOS_DETAIL_PUBLISER_QOS_HPP_
#define OMG_DDS_PUB_QOS_DETAIL_PUBLISER_QOS_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/core/detail/TEntityQosImpl.hpp>
#include <org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp>
#ifdef DOXYGEN_FOR_ISOCPP
/* The above macro is never (and must never) be defined in normal compilation.
*
* The class below is just used to create informative API documentation.
* The predoxygen.py script will copy this over the QoS API header file.
*/
/**
* @brief
* This object provides the basic mechanism for an application to specify Quality of
* Service attributes for a Publisher.
*
* @par Attributes
* @anchor anchor_dds_pub_publisher_qos_defaults
* QosPolicy | Desciption | Default Value
* --------------------------------------- | --------------------------------------------------------------------- | --------------------
* dds::core::policy::Presentation | Data-instance change dependencies (@ref DCPS_QoS_Presentation "info") | Presentation::InstanceAccessScope(coherent=false, ordered=false)
* dds::core::policy::Partition | Active partitions (@ref DCPS_QoS_Partition "info") | Partition::Partition(empty)
* dds::core::policy::GroupData | Additional information (@ref DCPS_QoS_GroupData "info") | GroupData::GroupData(empty)
* dds::core::policy::EntityFactory | Create enabled (@ref DCPS_QoS_EntityFactory "info") | EntityFactory::AutoEnable()
*
* A QosPolicy can be set when the Publisher is created or modified with the set qos
* operation.
* Both operations take the PublisherQos object as a parameter. There may be cases where
* several policies are in conflict. Consistency checking is performed each time the
* policies are modified when they are being created and, in case they are already
* enabled, via the set qos operation.
*
* Some QosPolicy have "immutable" semantics meaning that they can only be
* specified either at Publisher creation time or prior to calling the enable operation
* on the Publisher.
*
* @see for more information: @ref DCPS_QoS
*/
class dds::pub::qos::PublisherQos : public ::dds::core::EntityQos<org::eclipse::cyclonedds::pub::qos::PublisherQosDelegate>
{
public:
/**
* Create @ref anchor_dds_pub_publisher_qos_defaults "default" QoS.
*/
PublisherQos() {}
/**
* Create copied QoS type.
*
* @param qos the QoS to copy policies from.
*/
PublisherQos(const PublisherQos& qos);
};
#else /* DOXYGEN_FOR_ISOCPP */
namespace dds { namespace pub { namespace qos { namespace detail {
typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::pub::qos::PublisherQosDelegate> PublisherQos;
} } } }
#endif /* DOXYGEN_FOR_ISOCPP */
#endif /* OMG_DDS_PUB_QOS_DETAIL_PUBLISER_QOS_HPP_ */