CoreDX DDS Modern C++ API
|
The Reference
class defines the abstract behavior for those type defined as "reference-type" in the DDS-PSM-CXX specification.
More...
Public Member Functions | |
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... | |
Reference & | operator= (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... | |
The Reference
class defines the abstract behavior for those type defined as "reference-type" in the DDS-PSM-CXX specification.
|
explicit |
Creates a reference from another.
ref | the other reference |
|
explicit |
Enables safe assignment from other reference types.
ref | the other reference |
|
explicit |
The following two constructors create a dds Reference from a vendor specific delegate.
They are public, because the implementation of other delegates may need to be able to create References in that manner.
const DELEGATE_REF_T& dds::core::Reference< DELEGATE >::delegate | ( | ) | const |
Returns a reference to the underlying delegate.
This can be used to invoke non-standard extensions provided by the DDS implementor.
DELEGATE_REF_T& dds::core::Reference< DELEGATE >::delegate | ( | ) |
Returns a reference to the underlying delegate.
This can be used to invoke non-standard extensions provided by the DDS implementor.
bool dds::core::Reference< DELEGATE >::operator!= | ( | const R & | ref | ) | const |
Compares two reference objects and returns true if they are not-equal.
Inequality is based on the referential inequality of the object being pointed.
ref | the other reference object |
bool dds::core::Reference< DELEGATE >::operator!= | ( | const null_type | nil | ) | const |
Special operator!=
used to check if this reference object does not equals the null
reference.
The non-null-check can be done like this: bool is_null = (r != dds::null);
If r is a non-null reference the is_null
variable will have the false value.
DELEGATE* dds::core::Reference< DELEGATE >::operator-> | ( | ) |
The operator->()
is provided to be able to directly invoke methods on the delegate.
The choice 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_method(); my_dds_entity->vendor_specific_extension();
const DELEGATE* dds::core::Reference< DELEGATE >::operator-> | ( | ) | const |
The operator->()
is provided to be able to directly invoke methods on the delegate.
The choice 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_method(); my_dds_entity->vendor_specific_extension();
Reference& dds::core::Reference< DELEGATE >::operator= | ( | const null_type | ) |
Special assignment operators that takes care of assigning null to this reference.
When assigning null, there might be an associated garbage collection activity.
In essence this assignment operators takes care of allowing programmers to write: MyRefType my_ref = //... my_ref = dds::null;
bool dds::core::Reference< DELEGATE >::operator== | ( | const R & | ref | ) | const |
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 |
bool dds::core::Reference< DELEGATE >::operator== | ( | const null_type | ) | const |
Special operator==
used to check if this reference object equals the null
reference.
The null-check can be done like this: bool is_null = (r == dds::null);
If r is a null reference the is_null
variable will have the true value.