OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
dds::topic::AnyTopic Class Reference

Typeless base class for the typed Topic. More...

#include "AnyTopic.hpp"

Inheritance diagram for dds::topic::AnyTopic:
Inheritance graph

Public Member Functions

void close ()
 
void dispose_all_data ()
 
const dds::domain::DomainParticipantdomain_participant () const
 
void enable ()
 
::dds::core::status::InconsistentTopicStatus inconsistent_topic_status () const
 
const dds::core::InstanceHandle instance_handle () const
 
bool is_nil () const
 
const std::string & name () const
 
template<typename R >
bool operator!= (const R &ref) const
 
bool operator!= (const null_type nil) const
 
DELEGATE * operator-> ()
 
const DELEGATE * operator-> () const
 
AnyTopicoperator<< (const dds::topic::qos::TopicQos &qos)
 
template<typename R >
bool operator== (const R &ref) const
 
bool operator== (const null_type) const
 
const AnyTopicoperator>> (dds::topic::qos::TopicQos &qos) const
 
dds::topic::qos::TopicQos qos () const
 
void qos (const dds::topic::qos::TopicQos &qos)
 
void retain ()
 
const dds::core::status::StatusMask status_changes ()
 
const std::string & type_name () const
 

Detailed Description

Typeless base class for the typed Topic.

Topics are created type specific (fi Topic<Foo::Bar> topic). However, there are a few places in the API (and possibly application) where the type can not be known while still some Topic has to be passed around, stored or even typeless functionality called.
The main examples in the API that needs typeless Topic is: DomainParticipantListener.

See also
dds::topic::Topic

Definition at line 53 of file AnyTopic.hpp.

Member Function Documentation

◆ close()

void dds::core::Entity::close ( )
inherited

This function closes the entity and releases related resources.

Resource management for some reference types might involve relatively heavyweight operating- system resources — such as e.g., threads, mutexes, and network sockets — in addition to memory. These objects therefore provide a method close() that shall halt network communication (in the case of entities) and dispose of any appropriate operating-system resources.

Users of this PSM are recommended to call close on objects of all reference types once they are finished using them. In addition, implementations may automatically close objects that they deem to be no longer in use, subject to the following restrictions:

  • Any object to which the application has a direct reference is still in use.
  • Any object that has been explicitly retained is still in use
  • The creator of any object that is still in use is itself still in use.
Returns
void

Definition at line 68 of file EntityImpl.hpp.

◆ dispose_all_data()

void dds::topic::AnyTopic::dispose_all_data ( )

This operation allows the application to dispose of all of the instances for a particular topic without the network overhead of using a separate dispose call for each instance.

Note
This is a proprietary OpenSplice extension.

Its effect is equivalent to invoking a separate dispose operation for each individual instance on the DataWriter that owns it. (See dds::pub::DataWriter::dispose_instance)

The dispose_all_data is an asynchronous C&M operation that is not part of a coherent update; it operates on the DataReaders history cache and not on the incomplete transactions. The dispose_all_data is effectuated as soon as a transaction becomes complete and is inserted into the DataReaders history cache; at that point messages will be inserted according to the destination_order qos policy. For BY_SOURCE_TIMESTAMP all messages older than the dispose_all_data will be disposed and all newer will be alive; for BY_RECEPTION_TIMESTAMP all messages will be alive if the transaction is completed after receiving the dispose_all_data command.

This operation only sets the instance state of the instances concerned to NOT_ALIVE_DISPOSED. It does not unregister the instances, and so does not automatically clean up the memory that is claimed by the instances in both the DataReaders and DataWriters.

Blocking
The blocking (or nonblocking) behaviour of this call is undefined.

Concurrency
If there are subsequent calls to this function before the action has been completed (completion of the disposes on all nodes, not simply return from the function), then the behaviour is undefined.

Other notes
The effect of this call on disposed_generation_count, generation_rank and absolute_generation_rank is undefined.

Call
This is a proprietary operation and can be called by using the operator->.

dds::topic::Topic<Foo::Bar> topic(participant, "TopicName");
topic->dispose_all_data();
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ domain_participant()

const dds::domain::DomainParticipant & dds::topic::TopicDescription::domain_participant ( ) const
inherited

This operation returns the DomainParticipant associated with the TopicDescription.

Note that there is exactly one DomainParticipant associated with each TopicDescription.

Returns
the DomainParticipant

Definition at line 62 of file TopicDescriptionImpl.hpp.

◆ enable()

void dds::core::Entity::enable ( )
inherited

Enable entity.

This operation enables the Entity. Entity objects can be created either enabled or disabled. This is controlled by the value of the dds::core::policy::EntityFactory QoS policy on the corresponding factory for the Entity.

Enabled entities are immediately activated at creation time meaning all their immutable QoS settings can no longer be changed. Disabled Entities are not yet activated, so it is still possible to change there immutable QoS settings. However, once activated the immutable QoS settings can no longer be changed.

Creating disabled entities can make sense when the creator of the Entity does not yet know which QoS settings to apply, thus allowing another piece of code to set the QoS later on.

The default setting of dds::core::policy::EntityFactory is such that, by default, it is not necessary to explicitly call enable on newly- created entities.

The enable operation is idempotent. Calling enable on an already- enabled Entity does not raise exceptions and has no effect.

If an Entity has not yet been enabled, the only operations that can be invoked on it are: the ones to set, get or copy the QosPolicy settings, the ones that set (or get) the listener, the ones that get the StatusCondition, the get_status_changes operation (although the status of a disabled entity never changes), and the ‘factory’ operations that create, delete or lookup other Entities. Other operations will throw the exception dds::core::NotEnabledError.

Entities created from a factory that is disabled are created disabled regardless of the setting of the dds::core::policy::EntityFactory Qos policy. Calling enable on an Entity whose factory is not enabled will fail and throw an dds::core::PreconditionNotMetError exception.

If the dds::core::policy::EntityFactory QoS policy has autoenable_created_entities set to TRUE, the enable operation on the factory will automatically enable all entities created from the factory.

The Listeners associated with an entity are not called until the entity is enabled. Conditions associated with an entity that is not enabled are inactive; that is, they have a trigger_value==false (dds::core::cond::Condition and dds::core::cond::WaitSet).

eg.

...
dds::sub::DataReader<Foo::Bar> dr(dp, topic, drqos);
dr.enable();

In addition to the general description, the enable operation on a dds::sub::Subscriber has special meaning in specific usecases. This applies only to Subscribers with PresentationQoS coherent-access set to true with access-scope set to group.

In this case the subscriber is always created in a disabled state, regardless of the auto-enable created entities setting on the corresponding participant. While the subscriber remains disabled, DataReaders can be created that will participate in coherent transactions of the subscriber.

See dds::sub::CoherentAccess for more information.

All DataReaders will also be created in a disabled state. Coherency with group access-scope requires data to be delivered as a transaction, atomically, to all eligible readers. Therefore data should not be delivered to any single DataReader immediately after it's created, as usual, but only after the application has finished creating all DataReaders for a given Subscriber. At this point, the application should enable the Subscriber which in turn enables all its DataReaders.

Note that for a dds::pub::DataWriter which has a corresponding dds::pub::Publisher with a PresentationQoS with coherent-access set to true and access-scope set to topic or group that the HistoryQoS of the dds::pub::DataWriter should be set to keep-all otherwise the enable operation will fail.

See dds::pup::DataWriter for more information.

Returns
void
Exceptions
dds::core::PreconditionNotMetErrorEntities' factory is not enabled.

Definition at line 44 of file EntityImpl.hpp.

◆ inconsistent_topic_status()

dds::core::status::InconsistentTopicStatus dds::topic::AnyTopic::inconsistent_topic_status ( ) const

This operation obtains the InconsistentTopicStatus object of the Topic.

The InconsistentTopicStatus can also be monitored using a TopicListener or by using the associated StatusCondition.

Returns
the SampleRejectedStatus
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

Definition at line 81 of file AnyTopicImpl.hpp.

◆ instance_handle()

const dds::core::InstanceHandle dds::core::Entity::instance_handle ( ) const
inherited

This operation returns the InstanceHandle_t that represents the Entity.

The relevant state of some Entity objects are distributed using built-in topics. Each built-in topic sample represents the state of a specific Entity and has a unique instance_handle. This operation returns the instance_handle of the built-in topic sample that represents the specified Entity.
Some Entities (dds::pub::Publisher and dds::sub::Subscriber) do not have a corresponding built-in topic sample, but they still have an instance_handle that uniquely identifies the Entity. The instance_handles obtained this way can also be used to check whether a specific Entity is located in a specific DomainParticipant (dds::domain::DomainParticipant::contains_entity()).

Returns
dds::core::InstanceHandle Result value is the instance_handle of the built-in topic sample that represents the state of this Entity.

Definition at line 60 of file EntityImpl.hpp.

◆ is_nil()

template<typename DELEGATE >
bool dds::core::Reference< DELEGATE >::is_nil ( ) const
inherited

Check if the referenced object is nil.

In other words, check if the reference is pointing to a null object.

Returns
true if the referenced object is null.

Definition at line 143 of file ReferenceImpl.hpp.

◆ name()

const std::string & dds::topic::TopicDescription::name ( ) const
inherited

This operation returns the name used to create the TopicDescription.

Returns
the TopicDescription name

Definition at line 46 of file TopicDescriptionImpl.hpp.

◆ operator!=() [1/2]

template<typename DELEGATE >
template<typename R >
bool dds::core::Reference< DELEGATE >::operator!= ( const R &  ref) const
inherited

Compares two Reference objects and returns true if they are not equal.

Inequality is based on the referential inequality of the object being pointed to.

Parameters
refthe other Reference object
Returns
true when not equal

Definition at line 100 of file ReferenceImpl.hpp.

◆ operator!=() [2/2]

template<typename DELEGATE >
bool dds::core::Reference< DELEGATE >::operator!= ( const null_type  nil) const
inherited

Special operator!= used to check if this reference object does not equal the dds::core::null reference.

The non-null-check can be done like this:

if (r != dds::core::null) {
// Use the dds reference object r
}
Returns
true if this reference is not null.

Definition at line 157 of file ReferenceImpl.hpp.

◆ operator->() [1/2]

template<typename DELEGATE >
DELEGATE * dds::core::Reference< DELEGATE >::operator-> ( )
inherited

The operator->() is provided to be able to directly invoke functions on the delegate.

The decision to provide direct access to the delegate was motivated by the need for providing a way that was not invasive with respect to the CXXDDS API and yet would allow for vendor-specific extension. Thus vendor-specific extensions can be invoked on the Reference and on all its subclasses as follows:

my_dds_entity.standard_function();
my_dds_entity->vendor_specific_extension();
Returns
a reference to delegate.

Definition at line 180 of file ReferenceImpl.hpp.

◆ operator->() [2/2]

template<typename DELEGATE >
const DELEGATE * dds::core::Reference< DELEGATE >::operator-> ( ) const
inherited

The operator->() is provided to be able to directly invoke functions on the delegate.

The decision to provide direct access to the delegate was motivated by the need for providing a way that was not invasive with respect to the CXXDDS API and yet would allow for vendor-specific extension. Thus vendor-specific extensions can be invoked on the Reference and on all its subclasses as follows:

my_dds_entity.standard_function();
my_dds_entity->vendor_specific_extension();
Returns
a reference to delegate.

Definition at line 188 of file ReferenceImpl.hpp.

◆ operator<<()

AnyTopic & dds::topic::AnyTopic::operator<< ( const dds::topic::qos::TopicQos qos)

This operation replaces the existing set of QosPolicy settings for a Topic.

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 Topic, which can only be set before the Topic 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.

Parameters
qosthe qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.
dds::core::ImmutablePolicyErrorThe parameter qos contains an immutable QosPolicy setting with a different value than set during enabling of the DataReader.
dds::core::InconsistentPolicyErrorThe parameter qos contains conflicting QosPolicy settings,

Definition at line 63 of file AnyTopicImpl.hpp.

◆ operator==() [1/2]

template<typename DELEGATE >
template<typename R >
bool dds::core::Reference< DELEGATE >::operator== ( const R &  ref) const
inherited

Compares two Reference objects and returns true if they are equal.

Equality is based on the referential equality of the object being pointed.

Parameters
refthe other Reference object
Returns
true when equal

Definition at line 83 of file ReferenceImpl.hpp.

◆ operator==() [2/2]

template<typename DELEGATE >
bool dds::core::Reference< DELEGATE >::operator== ( const null_type  ) const
inherited

Special operator== used to check if this reference object equals the dds::core::null reference.

The null-check can be done like this:

if (r == dds::core::null) {
// Do not use the dds reference object r in its current state
}
Returns
true if this reference is null.

Definition at line 150 of file ReferenceImpl.hpp.

◆ operator>>()

const AnyTopic & dds::topic::AnyTopic::operator>> ( dds::topic::qos::TopicQos qos) const

Gets the TopicQos setting for this instance.

Returns
the qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

Definition at line 72 of file AnyTopicImpl.hpp.

◆ qos() [1/2]

dds::topic::qos::TopicQos dds::topic::AnyTopic::qos ( ) const

Gets the TopicQos setting for this instance.

Returns
the qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

Definition at line 47 of file AnyTopicImpl.hpp.

◆ qos() [2/2]

void dds::topic::AnyTopic::qos ( const dds::topic::qos::TopicQos qos)

This operation replaces the existing set of QosPolicy settings for a Topic.

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 Topic, which can only be set before the Topic 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.

Parameters
qosthe qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.
dds::core::ImmutablePolicyErrorThe parameter qos contains an immutable QosPolicy setting with a different value than set during enabling of the DataReader.
dds::core::InconsistentPolicyErrorThe parameter qos contains conflicting QosPolicy settings,

Definition at line 55 of file AnyTopicImpl.hpp.

◆ retain()

void dds::core::Entity::retain ( )
inherited

Retain the Entity, even when it goes out of scope.

This function indicates that references to this object may go out of scope but that the application expects to look it up again later. Therefore the Service must consider this object to be still in use and may not close it automatically.

Returns
void

Definition at line 76 of file EntityImpl.hpp.

◆ status_changes()

const dds::core::status::StatusMask dds::core::Entity::status_changes ( )
inherited

This operation returns a mask with the communication statuses in the Entity that are “triggered”.

This operation retrieves the list of communication statuses in the Entity that are triggered. That is the set of communication statuses whose value have changed since the last time the application called this operation. This operation shows whether a change has occurred even when the status seems unchanged because the status changed back to the original status.

When the Entity is first created or if the Entity is not enabled, all communication statuses are in the “un-triggered” state so the mask returned by the operation is empty.

The result value is a bit mask in which each bit shows which value has changed. The relevant bits represent one of the following statuses:

When the entity is first created, or if the entity is not enabled, all communication statuses are in the untriggered state so the list returned by the status_changes operation will be empty.

Each status bit is declared as a constant and can be used in an AND operation to check the status bit against the result of type StatusMask. Not all statuses are relevant to all Entity objects. See the respective Listener interfaces for each Entity for more information.

The list of statuses returned by the status_changes operation refers to the statuses that are triggered on the Entity itself, and does not include statuses that apply to contained entities.

Returns
dds::core::status::StatusMask a bit mask in which each bit shows which value has changed.

Definition at line 52 of file EntityImpl.hpp.

◆ type_name()

const std::string & dds::topic::TopicDescription::type_name ( ) const
inherited

This operation returns the registered name of the data type associated with the TopicDescription.

Returns
the type_name

Definition at line 54 of file TopicDescriptionImpl.hpp.


The documentation for this class was generated from the following files: