RefleX
Build DDS Applications in Modern C++ without IDL
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Public Member Functions | List of all members
reflex::SafeTypeCode< T > Class Template Reference

A type-safe, exception-safe wrapper for DDS TypeCode. More...

#include <reflex_fwd.h>

Public Member Functions

 SafeTypeCode (DDS_TypeCode *tc)
 Construct an SafeTypeCode object that owns the TypeCode. More...
 
 SafeTypeCode (const DDS_TypeCode *tc)
 Construct an SafeTypeCode object that does not own the TypeCode. More...
 
 SafeTypeCode (DDS_TypeCodeFactory *fact, DDS_TypeCode *tc)
 Construct an SafeTypeCode object that owns the TypeCode. More...
 
 SafeTypeCode (DDS_TypeCodeFactory *fact, const DDS_TypeCode *tc)
 Construct an SafeTypeCode object that does not own the TypeCode. More...
 
 SafeTypeCode (const SafeTypeCode &safetc)
 Create a copy of the argument SafeTypeCode. More...
 
SafeTypeCodeoperator= (const SafeTypeCode &rhs)
 Create a copy of the argument SafeTypeCode. More...
 
 SafeTypeCode (SafeTypeCode &&src)
 Moves the ownership of the TypeCode from src to a newly created SafeTypeCode object. The src typecode is set to NULL. More...
 
SafeTypeCodeoperator= (SafeTypeCode &&src)
 Moves the ownership of the TypeCode from src to this object. Deletes the existing TypeCode if owned. The src typecode is set to NULL. More...
 
 ~SafeTypeCode ()
 Deletes the underlying TypeCode if the object was was constructed using a non-const TypeCode. More...
 
DDS_TypeCode * get ()
 Get the underlying TypeCode. More...
 
const DDS_TypeCode * get () const
 Get the underlying TypeCode. More...
 
DDS_TypeCode * release ()
 Release the ownership of the underlying TypeCode. The SafeTypeCode object remains usable. More...
 
void swap (SafeTypeCode &stc) throw ()
 Swap the contents of two SafeTypeCode objects. Never throws. More...
 

Detailed Description

template<class T>
class reflex::SafeTypeCode< T >

A type-safe, exception-safe wrapper for DDS TypeCode.

The SafeTypeCode may or may not own the underlying TypeCode object. It distinguishes between owned vs. not-owned via const-ness of the argument TypeCode. const TypeCode objects are not owned whereas non-const TypeCode objects are owned by the SafeTypeCode instance. Note that TypeCode for all fundamental types are const and therefore SafeTypeCode does not assume ownership of them.

Copying SafeTypeCode object may make a deep copy depending upon whether the argument TypeCode was const or not.

Constructor & Destructor Documentation

template<class T>
reflex::SafeTypeCode< T >::SafeTypeCode ( DDS_TypeCode *  tc)
inlineexplicit

Construct an SafeTypeCode object that owns the TypeCode.

Use default TypeCodeFactory. I.e., DDS_TypeCodeFactory::get_instance()

template<class T>
reflex::SafeTypeCode< T >::SafeTypeCode ( const DDS_TypeCode *  tc)
inlineexplicit

Construct an SafeTypeCode object that does not own the TypeCode.

Use default TypeCodeFactory. I.e., DDS_TypeCodeFactory::get_instance()

template<class T>
reflex::SafeTypeCode< T >::SafeTypeCode ( DDS_TypeCodeFactory *  fact,
DDS_TypeCode *  tc 
)
inline

Construct an SafeTypeCode object that owns the TypeCode.

template<class T>
reflex::SafeTypeCode< T >::SafeTypeCode ( DDS_TypeCodeFactory *  fact,
const DDS_TypeCode *  tc 
)
inline

Construct an SafeTypeCode object that does not own the TypeCode.

template<class T>
reflex::SafeTypeCode< T >::SafeTypeCode ( const SafeTypeCode< T > &  safetc)
inline

Create a copy of the argument SafeTypeCode.

The copy is shallow if the argument SafeTypeCode was constructed using a const TypeCode. Makes a deep copy otherwise.

template<class T>
reflex::SafeTypeCode< T >::SafeTypeCode ( SafeTypeCode< T > &&  src)
inline

Moves the ownership of the TypeCode from src to a newly created SafeTypeCode object. The src typecode is set to NULL.

template<class T>
reflex::SafeTypeCode< T >::~SafeTypeCode ( )
inline

Deletes the underlying TypeCode if the object was was constructed using a non-const TypeCode.

Member Function Documentation

template<class T>
DDS_TypeCode* reflex::SafeTypeCode< T >::get ( )
inline

Get the underlying TypeCode.

template<class T>
const DDS_TypeCode* reflex::SafeTypeCode< T >::get ( ) const
inline

Get the underlying TypeCode.

template<class T>
SafeTypeCode& reflex::SafeTypeCode< T >::operator= ( const SafeTypeCode< T > &  rhs)
inline

Create a copy of the argument SafeTypeCode.

The copy is shallow if the argument SafeTypeCode was constructed using a const TypeCode. Makes a deep copy otherwise.

template<class T>
SafeTypeCode& reflex::SafeTypeCode< T >::operator= ( SafeTypeCode< T > &&  src)
inline

Moves the ownership of the TypeCode from src to this object. Deletes the existing TypeCode if owned. The src typecode is set to NULL.

template<class T>
DDS_TypeCode* reflex::SafeTypeCode< T >::release ( )
inline

Release the ownership of the underlying TypeCode. The SafeTypeCode object remains usable.

template<class T>
void reflex::SafeTypeCode< T >::swap ( SafeTypeCode< T > &  stc)
throw (
)
inline

Swap the contents of two SafeTypeCode objects. Never throws.


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