API Guides > ConceptRT 3.x
SmartPointer< pointerType > Class Template Reference

Helper class to use pointer. More...

Detailed Description

template<class pointerType>
class ConceptRT::SmartPointer< pointerType >

Helper class to use pointer.

Template Parameters
pointerTypeType of pointer.

Automatically initialized to NULL. Can be used more or less like a standard pointer. Secured against access violation.

Public Member Methods

 SmartPointer ()
 Default constructor. More...
 
 SmartPointer (pointerType *pointer)
 Default constructor. More...
 
 SmartPointer (const SmartPointer< pointerType > &right)
 Copy constructor. More...
 
SmartPointeroperator= (pointerType *right)
 Assignment operator. More...
 
pointerType & operator* ()
 pointerType& casting operator. More...
 
const pointerType & operator* () const
 pointerType& casting operator. More...
 
pointerType * operator-> ()
 pointerType& casting operator. More...
 
const pointerType * operator-> () const
 pointerType& casting operator. More...
 
bool IsNull () const
 Query if the pointer is null. More...
 
bool operator== (const pointerType *right) const
 Equal operator towards pointers More...
 
bool operator!= (const pointerType *right) const
 Not equal operator towards pointers More...
 
bool operator== (const SmartPointer< pointerType > &right) const
 Equal operator towards SmartPointer of the same type. More...
 
bool operator!= (const SmartPointer< pointerType > &right) const
 Not equal operator towards SmartPointer of the same type. More...
 
void SetNull ()
 Set the SmartPointer to null. More...
 
void Delete ()
 Free the memory and set the pointer to null. More...
 
pointerType * GetPointer ()
 Get the pointer value. More...
 

Constructor & Destructor Documentation

SmartPointer ( )
inline

Default constructor.

SmartPointer ( pointerType *  pointer)
inline

Default constructor.

Parameters
pointerThe pointer.
SmartPointer ( const SmartPointer< pointerType > &  right)
inline

Copy constructor.

Parameters
rightThe right.

Methods Documentation

void Delete ( )
inline

Free the memory and set the pointer to null.

Warning
Non-Deterministic: Deletion of the object. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.
pointerType* GetPointer ( )
inline

Get the pointer value.

Returns
The pointer.
bool IsNull ( ) const
inline

Query if the pointer is null.

Returns
True if the pointer is null.
bool operator!= ( const pointerType *  right) const
inline

Not equal operator towards pointers

Parameters
rightThe right nullable.
Returns
True if it is not equal.
bool operator!= ( const SmartPointer< pointerType > &  right) const
inline

Not equal operator towards SmartPointer of the same type.

Parameters
rightThe right nullable.
Returns
True if it is not equal.
pointerType& operator* ( )
inline

pointerType& casting operator.

Returns
The pointed object as reference.
RT Exceptions:
RT_ERROR_TRY_TO_ACCESS_UNEXISTANT_CONTENT
const pointerType& operator* ( ) const
inline

pointerType& casting operator.

Returns
The pointed object as reference.
RT Exceptions:
RT_ERROR_TRY_TO_ACCESS_UNEXISTANT_CONTENT
pointerType* operator-> ( )
inline

pointerType& casting operator.

Returns
The pointer value if != NULL.
RT Exceptions:
RT_ERROR_TRY_TO_ACCESS_UNEXISTANT_CONTENT
const pointerType* operator-> ( ) const
inline

pointerType& casting operator.

Returns
The pointer value if != NULL.
RT Exceptions:
RT_ERROR_TRY_TO_ACCESS_UNEXISTANT_CONTENT
SmartPointer& operator= ( pointerType *  right)
inline

Assignment operator.

Parameters
rightThe right.
Returns
A shallow copy of this object.
bool operator== ( const pointerType *  right) const
inline

Equal operator towards pointers

Parameters
rightThe right nullable.
Returns
True if it is equal.
bool operator== ( const SmartPointer< pointerType > &  right) const
inline

Equal operator towards SmartPointer of the same type.

Parameters
rightThe right nullable.
Returns
True if it is equal.
void SetNull ( )
inline

Set the SmartPointer to null.