CoreDX DDS Modern C++ API
Public Member Functions | List of all members
dds::core::Entity Class Reference

This class is the abstract base class for all the DCPS objects that support QoS policies, a listener and a status condition. More...

Inheritance diagram for dds::core::Entity:
Inheritance graph
[legend]
Collaboration diagram for dds::core::Entity:
Collaboration graph
[legend]

Public Member Functions

void enable ()
 This operation enables the Entity. More...
 
const dds::core::status::StatusMask status_changes ()
 This operation retrieves the list of communication statuses in the Entity that are triggered.That is, the list of statuses whose value has changed since the last time the application read the status. More...
 
const dds::core::InstanceHandle instance_handle () const
 This operation returns the InstanceHandle_t that represents the Entity.
 
void close ()
 This method closes the entity and releases all resources associated with DDS, such as threads, sockets, buffers, etc. More...
 
void retain ()
 Indicates that references to this object may go out of scope but that the application expects to look it up again later. More...
 
- Public Member Functions inherited from dds::core::Reference< DELEGATE >
 Reference (dds::core::null_type &)
 Creates a "null" reference.
 
 Reference (const Reference &ref)
 Creates a reference from another. More...
 
template<typename D >
 Reference (const Reference< D > &ref)
 Enables safe assignment from other reference types. More...
 
 Reference (DELEGATE_T *p)
 The following two constructors create a dds Reference from a vendor specific delegate. More...
 
 ~Reference ()
 Destroys a reference.
 
template<typename R >
bool operator== (const R &ref) const
 Compares two reference objects and returns true if they are equal. More...
 
template<typename R >
bool operator!= (const R &ref) const
 Compares two reference objects and returns true if they are not-equal. More...
 
Referenceoperator= (const null_type)
 Special assignment operators that takes care of assigning null to this reference. More...
 
bool is_nil () const
 Returns true if this reference object is nil, meaning pointing to null.
 
bool operator== (const null_type) const
 Special operator== used to check if this reference object equals the null reference. More...
 
bool operator!= (const null_type nil) const
 Special operator!= used to check if this reference object does not equals the null reference. More...
 
const DELEGATE_REF_T & delegate () const
 Returns a reference to the underlying delegate. More...
 
DELEGATE_REF_T & delegate ()
 Returns a reference to the underlying delegate. More...
 
DELEGATE * operator-> ()
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 
const DELEGATE * operator-> () const
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 

Detailed Description

This class is the abstract base class for all the DCPS objects that support QoS policies, a listener and a status condition.

In the ISO C++ PSM each DDS entity behaves like a polymorphic reference in what it automatically manages its resource and it can be safely assigned up and down the DDS Entity type hierarchy.

Member Function Documentation

◆ close()

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

This method closes the entity and releases all resources associated with DDS, such as threads, sockets, buffers, etc.

Any attempt to invoke methods on a closed entity will raise an exception.

Note
In the current implementation, DDS entities are not destroyed until the last reference goes out of scope. The close() operation simply cancels all prior 'retain()' operations.

◆ enable()

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

This operation enables the Entity.

Entity objects can be created either enabled or disabled. This is controlled by the value of the ENTITY_FACTORY Qos policy (Section 7.1.3.20, ENTITY_FACTORY) on the corresponding factory for the Entity. The default setting of ENTITY_FACTORY is such that, by default, it is not necessary to explicitly call enable on newly created entities (see Section 7.1.3.20, ENTITY_FACTORY). The enable operation is idempotent. Calling enable on an already enabled Entity does nor raise exceptions and has no effect.

Entities created from a factory that is disabled, are created disabled regardless of the setting of the ENTITY_FACTORY Qos policy. Calling enable on an Entity whose factory is not enabled will fail and return PRECONDITION_NOT_MET. If the ENTITY_FACTORY 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, have a trigger_value==FALSE (see Section 7.1.4.4, “Conditions and Wait-sets, on page 131).

◆ retain()

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

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.

◆ status_changes()

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

This operation retrieves the list of communication statuses in the Entity that are triggered.That is, the list of statuses whose value has changed since the last time the application read the status.

The precise definition of the triggered state of communication statuses is given in Section 7.1.4.2, Changes in Status, on page 126. 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. 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
the status changes

© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.