Base Framework
Public Member Functions | List of all members
CheckedPointer< TYPE > Class Template Reference

Checked automation pointer. More...

#include <base/mem/CheckedPointer.h>

Public Member Functions

 CheckedPointer () noexcept
 
 CheckedPointer (TYPE *_value) noexcept
 
 CheckedPointer (const CheckedPointer &copy) noexcept
 
template<class POLY >
 CheckedPointer (const CheckedPointer< POLY > &copy) noexcept
 
CheckedPointeroperator= (const CheckedPointer &compare) noexcept
 
template<class POLY >
CheckedPointeroperator= (const CheckedPointer< POLY > &compare) noexcept
 
void invalidate () noexcept
 
bool isValid () const noexcept
 
bool operator== (const CheckedPointer &compare) const noexcept
 
bool operator!= (const CheckedPointer &compare) const noexcept
 
template<class POLY >
bool isType () const noexcept
 
template<class POLY >
CheckedPointer< POLY > cast ()
 
TYPE & operator* ()
 
const TYPE & operator* () const
 
TYPE * operator-> ()
 
const TYPE * operator-> () const
 
 operator bool () const noexcept
 

Detailed Description

template<class TYPE>
class CheckedPointer< TYPE >

Checked automation pointer.

Automation pointer which checks the pointer value before use.

Version
1.0

Constructor & Destructor Documentation

◆ CheckedPointer() [1/4]

template<class TYPE >
CheckedPointer< TYPE >::CheckedPointer ( )
inlinenoexcept

Initializes the automation pointer as nullptr.

◆ CheckedPointer() [2/4]

template<class TYPE >
CheckedPointer< TYPE >::CheckedPointer ( TYPE *  _value)
inlinenoexcept

Initializes the automation pointer.

Parameters
valueThe object pointer to be automated.

◆ CheckedPointer() [3/4]

template<class TYPE >
CheckedPointer< TYPE >::CheckedPointer ( const CheckedPointer< TYPE > &  copy)
inlinenoexcept

Initialization of automation pointer from other automation pointer.

◆ CheckedPointer() [4/4]

template<class TYPE >
template<class POLY >
CheckedPointer< TYPE >::CheckedPointer ( const CheckedPointer< POLY > &  copy)
inlinenoexcept

Initialization of automation pointer from other automation pointer using compile time polymorphism.

Member Function Documentation

◆ cast()

template<class TYPE >
template<class POLY >
CheckedPointer<POLY> CheckedPointer< TYPE >::cast ( )
inline

Dynamic cast to the specified type. Raises CastException if the reference is invalid or the reference cannot be cast to the specified type.

◆ invalidate()

template<class TYPE >
void CheckedPointer< TYPE >::invalidate ( )
inlinenoexcept

Invalidates the pointer.

◆ isType()

template<class TYPE >
template<class POLY >
bool CheckedPointer< TYPE >::isType ( ) const
inlinenoexcept

Returns true if the object may be cast to the specified type.

◆ isValid()

template<class TYPE >
bool CheckedPointer< TYPE >::isValid ( ) const
inlinenoexcept

Returns true if the automation pointer is valid (i.e. it is pointing to an object).

◆ operator bool()

template<class TYPE >
CheckedPointer< TYPE >::operator bool ( ) const
inlinenoexcept

Returns true if the pointer is valid (i.e. not nullptr).

◆ operator!=()

template<class TYPE >
bool CheckedPointer< TYPE >::operator!= ( const CheckedPointer< TYPE > &  compare) const
inlinenoexcept

Returns true if the pointers are non-equal.

◆ operator*() [1/2]

template<class TYPE >
TYPE& CheckedPointer< TYPE >::operator* ( )
inline

Returns mutable object.

◆ operator*() [2/2]

template<class TYPE >
const TYPE& CheckedPointer< TYPE >::operator* ( ) const
inline

Returns constant object.

◆ operator->() [1/2]

template<class TYPE >
TYPE* CheckedPointer< TYPE >::operator-> ( )
inline

Returns object for modifying access.

◆ operator->() [2/2]

template<class TYPE >
const TYPE* CheckedPointer< TYPE >::operator-> ( ) const
inline

Returns object for non-modifying access.

◆ operator=() [1/2]

template<class TYPE >
CheckedPointer& CheckedPointer< TYPE >::operator= ( const CheckedPointer< TYPE > &  compare)
inlinenoexcept

Assignment of automation pointer to this automation pointer.

◆ operator=() [2/2]

template<class TYPE >
template<class POLY >
CheckedPointer& CheckedPointer< TYPE >::operator= ( const CheckedPointer< POLY > &  compare)
inlinenoexcept

Assignment of automation pointer to this automation pointer using compile time polymorphism.

◆ operator==()

template<class TYPE >
bool CheckedPointer< TYPE >::operator== ( const CheckedPointer< TYPE > &  compare) const
inlinenoexcept

Returns true if the pointers are equal.