DDS-PSM-C++  1.0
ISO C++ API for OpenSplice DDS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Protected Attributes | List of all members
dds::core::Reference< DELEGATE > Class Template Reference

#include <Reference.hpp>

Inheritance diagram for dds::core::Reference< DELEGATE >:
Inheritance graph
[legend]

Public Member Functions

 Reference (dds::core::null_type &)
 
 Reference (const Reference &ref)
 
template<typename D >
 Reference (const Reference< D > &ref)
 
 Reference (DELEGATE_T *p)
 
 ~Reference ()
 
const DELEGATE_REF_T & delegate () const
 
DELEGATE_REF_T & delegate ()
 
bool is_nil () const
 
 operator const DELEGATE_REF_T & () const
 
 operator DELEGATE_REF_T () const
 
 operator DELEGATE_REF_T & ()
 
template<typename R >
bool operator!= (const R &ref) const
 
bool operator!= (const null_type nil) const
 
DELEGATE * operator-> ()
 
const DELEGATE * operator-> () const
 
template<typename D >
Referenceoperator= (const Reference< D > &that)
 
template<typename R >
Referenceoperator= (const R &rhs)
 
Referenceoperator= (const null_type)
 
template<typename R >
bool operator== (const R &ref) const
 
bool operator== (const null_type) const
 

Protected Attributes

DELEGATE_REF_T impl_
 

Detailed Description

template<typename DELEGATE>
class dds::core::Reference< DELEGATE >

The Reference class defines the abstract behavior for those type defined as "reference-type" in the DDS-PSM-CXX specification.

Definition at line 35 of file Reference.hpp.

Constructor & Destructor Documentation

template<typename DELEGATE>
dds::core::Reference< DELEGATE >::Reference ( dds::core::null_type )
explicit

Creates a "null" reference.

template<typename DELEGATE>
dds::core::Reference< DELEGATE >::Reference ( const Reference< DELEGATE > &  ref)
explicit

Creates a reference from another.

Parameters
refthe other reference
template<typename DELEGATE>
template<typename D >
dds::core::Reference< DELEGATE >::Reference ( const Reference< D > &  ref)
explicit

Enables safe assignment from other reference types.

Parameters
refthe other reference
template<typename DELEGATE>
dds::core::Reference< DELEGATE >::Reference ( DELEGATE_T *  p)
explicit
template<typename DELEGATE>
dds::core::Reference< DELEGATE >::~Reference ( )

Destroys a reference.

Member Function Documentation

template<typename DELEGATE>
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.

Returns
a reference to delegate.
template<typename DELEGATE>
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.

Returns
a reference to delegate.
template<typename DELEGATE>
bool dds::core::Reference< DELEGATE >::is_nil ( ) const

Returns true if this reference object is nil, meaning pointing to null.

template<typename DELEGATE>
dds::core::Reference< DELEGATE >::operator const DELEGATE_REF_T & ( ) const
template<typename DELEGATE>
dds::core::Reference< DELEGATE >::operator DELEGATE_REF_T ( ) const
template<typename DELEGATE>
dds::core::Reference< DELEGATE >::operator DELEGATE_REF_T & ( )
template<typename DELEGATE>
template<typename R >
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.

Parameters
refthe other reference object
template<typename DELEGATE>
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.

Returns
true if this reference is null.
template<typename DELEGATE>
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();

Returns
a reference to delegate.
template<typename DELEGATE>
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 invocked on the Reference and on all its subclasses as follows:

my_dds_entity.standard_method(); my_dds_entity->vendor_specific_extension();

Returns
a reference to delegate.
template<typename DELEGATE>
template<typename D >
Reference& dds::core::Reference< DELEGATE >::operator= ( const Reference< D > &  that)
template<typename DELEGATE>
template<typename R >
Reference& dds::core::Reference< DELEGATE >::operator= ( const R &  rhs)
template<typename DELEGATE>
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;

template<typename DELEGATE>
template<typename R >
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.

Parameters
refthe other reference object
template<typename DELEGATE>
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.

Returns
true if this reference is null.

Member Data Documentation

template<typename DELEGATE>
DELEGATE_REF_T dds::core::Reference< DELEGATE >::impl_
protected

Definition at line 209 of file Reference.hpp.


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