knowL: Knowledge Libraries
Loading...
Searching...
No Matches
knowCore::SharedRef< _T_, _TDeleteCheck_ > Class Template Reference

#include <SharedRef.h>

Inheritance diagram for knowCore::SharedRef< _T_, _TDeleteCheck_ >:

Public Types

typedef _T_ ElementType
 

Public Member Functions

 SharedRef (_T_ *_t, bool _own)
 
 SharedRef (const SharedRef< _T_, _TDeleteCheck_ > &_rhs)
 
SharedRefoperator= (const SharedRef< _T_, _TDeleteCheck_ > &_rhs)
 
template<typename _TCast_ >
SharedRef< _TCast_, _TDeleteCheck_ > d_cast () const
 
template<typename _TCast_ , std::enable_if_t< std::is_base_of_v< _TCast_, _T_ >, bool > = true>
SharedRef< _TCast_, _TDeleteCheck_ > s_cast () const
 
bool operator== (const SharedRef< _T_ > &_rhs) const
 
bool operator== (const _T_ *_rhs) const
 
 operator bool () const
 
bool isValid () const
 
_T_ * operator-> ()
 
const _T_ * operator-> () const
 
_T_ * grab ()
 
_T_ * data ()
 
const _T_ * data () const
 

Detailed Description

template<typename _T_, typename _TDeleteCheck_ = details::SharedRefDefaultCheck>
class knowCore::SharedRef< _T_, _TDeleteCheck_ >

The SharedRef acts as an (optional) smart pointer, in the sense, that it can contains objects that are owned by it or not.

Constructor & Destructor Documentation

◆ SharedRef()

template<typename _T_ , typename _TDeleteCheck_ = details::SharedRefDefaultCheck>
knowCore::SharedRef< _T_, _TDeleteCheck_ >::SharedRef ( _T_ * _t,
bool _own )
inline

Create a new SharedRef from object T, specify if the pointer is owned and manadged by this SharedRef or not.

Member Function Documentation

◆ d_cast()

template<typename _T_ , typename _TDeleteCheck_ = details::SharedRefDefaultCheck>
template<typename _TCast_ >
SharedRef< _TCast_, _TDeleteCheck_ > knowCore::SharedRef< _T_, _TDeleteCheck_ >::d_cast ( ) const
inline

Perform a dynamic cast from _T_ to

Parameters
_TCast_.

◆ grab()

template<typename _T_ , typename _TDeleteCheck_ = details::SharedRefDefaultCheck>
_T_ * knowCore::SharedRef< _T_, _TDeleteCheck_ >::grab ( )
inline

The SharedRef is not anymore responsible for deleting the object, but still points to it!

◆ s_cast()

template<typename _T_ , typename _TDeleteCheck_ = details::SharedRefDefaultCheck>
template<typename _TCast_ , std::enable_if_t< std::is_base_of_v< _TCast_, _T_ >, bool > = true>
SharedRef< _TCast_, _TDeleteCheck_ > knowCore::SharedRef< _T_, _TDeleteCheck_ >::s_cast ( ) const
inline

Perform a static cast from _T_ to

Parameters
_TCast_.

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