Cyclone ISO C++ API Reference Guide
|
A DomainParticipant represents the local membership of the application in a Domain. More...
#include "DomainParticipant.hpp"
Inherits dds::core::Entity.
Public Types | |
typedef dds::domain::DomainParticipantListener | Listener |
Static Public Member Functions | |
static dds::domain::qos::DomainParticipantQos | default_participant_qos () |
static void | default_participant_qos (const ::dds::domain::qos::DomainParticipantQos &qos) |
A DomainParticipant represents the local membership of the application in a Domain.
The DomainParticipant represents the participation of the application on a communication plane that isolates applications running on the same set of physical computers from each other. A domain establishes a virtual network linking all applications that share the same domainId and isolating them from applications running on different domains. In this way, several independent distributed applications can coexist in the same physical network without interfering, or even being aware of each other.
Definition at line 65 of file DomainParticipant.hpp.
Local representation of the dds::domain::DomainParticipantListener
Definition at line 71 of file DomainParticipant.hpp.
dds::domain::DomainParticipant::DomainParticipant | ( | uint32_t | id | ) |
Creates a new DomainParticipant object. The DomainParticipant signifies that the calling application intends to join the Domain identified by the domain_id argument.
The DomainParticipant will be created with the QoS values specified on the last successful call to DomainParticipant::default_publisher_qos(qos) or, if the call was never made, the default values.
id | the id of the domain joined by the new DomainParticipant |
dds::core::Error | An internal error has occurred. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
dds::domain::DomainParticipant::DomainParticipant | ( | uint32_t | id, |
const dds::domain::qos::DomainParticipantQos & | qos, | ||
dds::domain::DomainParticipantListener * | listener = NULL , |
||
const dds::core::status::StatusMask & | event_mask = dds::core::status::StatusMask::none() , |
||
const std::string & | config = std::string() |
||
) |
Creates a new DomainParticipant object. The DomainParticipant signifies that the calling application intends to join the Domain identified by the domain_id argument.
The DomainParticipant will be created with the DomainParticipantQos passed as an argument.
It is possible to provide a specific configuration. Please be aware that the given domain_id always takes precedence over the configuration. Also, if a domain with the same ID was created previously (either through the config argument, environment var or default), that configuration is used.
| id | config | in config | previous | result | +-—+-----—+--------—+-------—+----------------------------—+ | n | no | n.a. | no | n, environment/default config | | n | no | n.a. | yes | n, previous config | | n | yes | no | no | n, default config (with n id) | | n | yes | yes/any | no | n, given config | | n | yes | no | yes | n, previous config | | n | yes | yes/any | yes | n, previous config |
id | the id of the domain joined by the new DomainParticipant |
qos | the QoS settings for the new DomainParticipant |
listener | the listener |
event_mask | the mask defining the events for which the listener will be notified. |
config | when not empty, the value is used as either the name of the file containing the configuration or, when it starts with '<', taken to be the XML representation of the configuration. When not empty, the id argument of this constructor has to have a specific value and can not be org::eclipse::cyclonedds::domain::default_id(). |
dds::core::Error | An internal error has occurred. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
void dds::domain::DomainParticipant::assert_liveliness | ( | ) |
This operation will manually assert the liveliness for the DomainParticipant.
This way, the Data Distribution Service is informed that the DomainParticipant is still alive. This operation only needs to be used when the DomainParticipant contains DataWriters with the dds:core::policy::LivelinessQosPolicy::ManualByParticipant(), and it will only affect the liveliness of those DataWriters.
Writing data via the write operation of a DataWriter will assert the liveliness on the DataWriter itself and its DomainParticipant. Therefore, assert_liveliness is only needed when not writing regularly. The liveliness should be asserted by the application, depending on the LivelinessQosPolicy.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
|
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:
bool dds::domain::DomainParticipant::contains_entity | ( | const ::dds::core::InstanceHandle & | handle | ) |
This operation checks whether or not the given handle represents an Entity that was created by using this DomainParticipant.
The containment applies recursively. That is, it applies both to entities (TopicDescription, Publisher, or Subscriber) created directly using the DomainParticipant as well as entities created using a contained Publisher, or Subscriber as the factory, and so forth.
handle | the instance handle for which the containement relationship has to be checked |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::Time dds::domain::DomainParticipant::current_time | ( | ) | const |
This operation returns the current value of the time that the service uses to time-stamp data writes and to set the reception timestamp for the data updates it receives.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
|
static |
Gets the default DomainParticipantQos.
This operation gets an object with the default global DomainParticipant QosPolicy settings which is used for newly created DomainParticipant 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::domain::DomainParticipant::default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos), or, if the call was never made, the default values.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
|
static |
Sets the default DomainParticipantQos.
This QoS will be used by all following DomainParticipant creations when no QoS was given during those creations or the QoS is given that was returned by dds::domain::DomainParticipant::default_participant_qos().
qos | the default DomainParticipantQos |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
dds::pub::qos::PublisherQos dds::domain::DomainParticipant::default_publisher_qos | ( | ) | const |
Gets the default PublisherQos of the DomainParticipant.
This operation gets an object with the default Publisher QosPolicy settings of the DomainParticipant (that is the PublisherQos) which is used for newly created Publisher 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::domain::DomainParticipant::default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos), or, if the call was never made, the default values.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
DomainParticipant& dds::domain::DomainParticipant::default_publisher_qos | ( | const ::dds::pub::qos::PublisherQos & | qos | ) |
Sets the default PublisherQos of the DomainParticipant.
This operation sets the default PublisherQos of the DomainParticipant which is used for newly created Publisher objects, when no QoS is provided.
The PublisherQos is always self consistent, because its policies do not depend on each other. This means that this operation never throws dds::core::InconsistentPolicyError.
The values set by this operation are returned by dds::domain::DomainParticipant::default_publisher_qos().
qos | the default PublisherQos |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::UnsupportedError | One or more of the selected QosPolicy values are currently not supported by OpenSplice. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
dds::sub::qos::SubscriberQos dds::domain::DomainParticipant::default_subscriber_qos | ( | ) | const |
Gets the default SubscriberQos of the DomainParticipant.
This operation gets an object with the default Subscriber QosPolicy settings of the DomainParticipant (that is the SubscriberQos) which is used for newly created Subscriber 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::domain::DomainParticipant::default_subscriber_qos(const :dds::sub::qos::SubscriberQos& qos), or, if the call was never made, the default values.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
DomainParticipant& dds::domain::DomainParticipant::default_subscriber_qos | ( | const ::dds::sub::qos::SubscriberQos & | qos | ) |
Sets the default SubscriberQos of the DomainParticipant.
This operation sets the default SubscriberQos of the DomainParticipant which is used for newly created Subscriber objects, when no QoS is provided.
The SubscriberQos is always self consistent, because its policies do not depend on each other. This means that this operation never throws dds::core::InconsistentPolicyError.
The values set by this operation are returned by dds::domain::DomainParticipant::default_subscriber_qos().
qos | the default SubscriberQos |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::UnsupportedError | One or more of the selected QosPolicy values are currently not supported by OpenSplice. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
dds::topic::qos::TopicQos dds::domain::DomainParticipant::default_topic_qos | ( | ) | const |
Gets the default TopicQos of the DomainParticipant.
This operation gets an object with the default Topic QosPolicy settings of the DomainParticipant (that is the TopicQos) which is used for newly created Topic 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::domain::DomainParticipant::default_topic_qos(const dds::topic::qos::TopicQos& qos), or, if the call was never made, the default values.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
DomainParticipant& dds::domain::DomainParticipant::default_topic_qos | ( | const dds::topic::qos::TopicQos & | qos | ) |
Sets the default TopicQos of the DomainParticipant.
This operation sets the default SubscriberQos of the DomainParticipant which is used for newly created Subscriber objects, when no QoS is provided.
This operation checks if the TopicQos 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::domain::DomainParticipant::default_topic_qos().
qos | the default TopicQos |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::UnsupportedError | One or more of the selected QosPolicy values are currently not supported by OpenSplice. |
dds::core::InconsistentPolicyError | The parameter qos contains conflicting QosPolicy settings, e.g. a history depth that is higher than the specified resource limits. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
uint32_t dds::domain::DomainParticipant::domain_id | ( | ) | const |
This operation retrieves the domain_id used to create the DomainParticipant. The domain_id identifies the DDS domain to which the DomainParticipant belongs.
Each DDS domain represents a separate data communication plane isolated from other domains.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
|
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::core::PreconditionNotMetError | Entities' factory is not enabled. |
|
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()).
|
inherited |
Check if the referenced object is nil.
In other words, check if the reference is pointing to a null object.
Listener* dds::domain::DomainParticipant::listener | ( | ) | const |
Get the listener of this DomainParticipant.
See also listener information.
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
void dds::domain::DomainParticipant::listener | ( | Listener * | listener, |
const ::dds::core::status::StatusMask & | event_mask | ||
) |
Register a listener with the DomainParticipant.
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 listener information.
listener | the listener |
event_mask | the mask defining the events for which the listener will be notified. |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::UnsupportedError | A status was selected that cannot be supported because the infrastructure does not maintain the required connectivity information. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
|
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:
|
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.
ref | the other Reference object |
|
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:
|
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:
DomainParticipant& dds::domain::DomainParticipant::operator<< | ( | const dds::domain::qos::DomainParticipantQos & | qos | ) |
Sets the DomainParticipantQos setting for this instance.
qos | the qos |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
|
inherited |
Special operator== used to check if this reference object equals the dds::core::null reference.
The null-check can be done like this:
|
inherited |
Compares two Reference objects and returns true if they are equal.
Equality is based on the referential equality of the object being pointed.
ref | the other Reference object |
const DomainParticipant& dds::domain::DomainParticipant::operator>> | ( | dds::domain::qos::DomainParticipantQos & | qos | ) | const |
Gets the DomainParticipantQos setting for this instance.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
const dds::domain::qos::DomainParticipantQos& dds::domain::DomainParticipant::qos | ( | ) | const |
Gets the DomainParticipantQos setting for this instance.
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
void dds::domain::DomainParticipant::qos | ( | const dds::domain::qos::DomainParticipantQos & | qos | ) |
Sets the DomainParticipantQos setting for this instance.
qos | the qos |
dds::core::Error | An internal error has occurred. |
dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
dds::core::AlreadyClosedError | The entity has already been closed. |
dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
|
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.
|
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.