SObjectizer  5.5
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
so_5::intrusive_ptr_t< T > Class Template Reference

Template class for smart reference wrapper on the atomic_refcounted_t. More...

#include <atomic_refcounted.hpp>

Public Member Functions

 intrusive_ptr_t () SO_5_NOEXCEPT
 Default constructor. More...
 
 intrusive_ptr_t (T *obj) SO_5_NOEXCEPT
 Constructor for a raw pointer. More...
 
 intrusive_ptr_t (const intrusive_ptr_t &o) SO_5_NOEXCEPT
 Copy constructor. More...
 
 intrusive_ptr_t (intrusive_ptr_t &&o) SO_5_NOEXCEPT
 Move constructor. More...
 
template<class Y >
 intrusive_ptr_t (const intrusive_ptr_t< Y > &o) SO_5_NOEXCEPT
 Constructor from another smart reference. More...
 
template<class Y >
 intrusive_ptr_t (std::unique_ptr< Y > o) SO_5_NOEXCEPT
 Constructor from unique_ptr instance. More...
 
 ~intrusive_ptr_t () SO_5_NOEXCEPT
 Destructor. More...
 
intrusive_ptr_toperator= (const intrusive_ptr_t &o) SO_5_NOEXCEPT
 Copy operator. More...
 
intrusive_ptr_toperator= (intrusive_ptr_t &&o) SO_5_NOEXCEPT
 Move operator. More...
 
void swap (intrusive_ptr_t &o) SO_5_NOEXCEPT
 Swap values. More...
 
void reset () SO_5_NOEXCEPT
 Drop controlled object. More...
 
template<class Y >
intrusive_ptr_t< Y > make_reference () const SO_5_NOEXCEPT
 Make reference with casing to different type. More...
 
 operator bool () const SO_5_NOEXCEPT
 Is this a null reference? More...
 
Access to object.
T * get () const SO_5_NOEXCEPT
 
T * operator-> () const SO_5_NOEXCEPT
 
T & operator* () const SO_5_NOEXCEPT
 
Comparision
bool operator== (const intrusive_ptr_t &o) const
 
bool operator< (const intrusive_ptr_t &o) const
 

Private Member Functions

void take_object () SO_5_NOEXCEPT
 Increment reference count to object if it's not null. More...
 
void dismiss_object () SO_5_NOEXCEPT
 Decrement reference count to object and delete it if needed. More...
 

Static Private Member Functions

static void ensure_right_T ()
 

Private Attributes

T * m_obj
 Object controlled by a smart reference. More...
 

Detailed Description

template<class T>
class so_5::intrusive_ptr_t< T >

Template class for smart reference wrapper on the atomic_refcounted_t.

Since
v.5.2.0
Template Parameters
Tclass which must be derived from the atomic_refcounted_t.
Examples:
so_5/chameneos_prealloc_msgs/main.cpp, so_5/collector_many_performers/main.cpp, so_5/make_pipeline/main.cpp, so_5/prio_work_stealing/main.cpp, so_5/private_dispatcher_for_children/main.cpp, and so_5/simple_message_deadline/main.cpp.

Constructor & Destructor Documentation

◆ intrusive_ptr_t() [1/6]

template<class T>
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( )
inline

Default constructor.

Constructs a null reference.

◆ intrusive_ptr_t() [2/6]

template<class T>
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( T *  obj)
inline

Constructor for a raw pointer.

◆ intrusive_ptr_t() [3/6]

template<class T>
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( const intrusive_ptr_t< T > &  o)
inline

Copy constructor.

◆ intrusive_ptr_t() [4/6]

template<class T>
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( intrusive_ptr_t< T > &&  o)
inline

Move constructor.

◆ intrusive_ptr_t() [5/6]

template<class T>
template<class Y >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( const intrusive_ptr_t< Y > &  o)
inline

Constructor from another smart reference.

Since
v.5.2.2

◆ intrusive_ptr_t() [6/6]

template<class T>
template<class Y >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( std::unique_ptr< Y >  o)
inline

Constructor from unique_ptr instance.

Since
v.5.5.23

◆ ~intrusive_ptr_t()

template<class T>
so_5::intrusive_ptr_t< T >::~intrusive_ptr_t ( )
inline

Destructor.

Member Function Documentation

◆ dismiss_object()

template<class T>
void so_5::intrusive_ptr_t< T >::dismiss_object ( )
inlineprivate

Decrement reference count to object and delete it if needed.

◆ ensure_right_T()

template<class T>
static void so_5::intrusive_ptr_t< T >::ensure_right_T ( )
inlinestaticprivate

◆ get()

template<class T>
T* so_5::intrusive_ptr_t< T >::get ( ) const
inline

◆ make_reference()

template<class T>
template<class Y >
intrusive_ptr_t< Y > so_5::intrusive_ptr_t< T >::make_reference ( ) const
inline

Make reference with casing to different type.

Since
v.5.2.2

◆ operator bool()

template<class T>
so_5::intrusive_ptr_t< T >::operator bool ( ) const
inline

Is this a null reference?

i.e. whether get() != 0.

Return values
trueif *this manages an object.
falseotherwise.

◆ operator*()

template<class T>
T& so_5::intrusive_ptr_t< T >::operator* ( ) const
inline

◆ operator->()

template<class T>
T* so_5::intrusive_ptr_t< T >::operator-> ( ) const
inline

◆ operator<()

template<class T>
bool so_5::intrusive_ptr_t< T >::operator< ( const intrusive_ptr_t< T > &  o) const
inline

◆ operator=() [1/2]

template<class T>
intrusive_ptr_t& so_5::intrusive_ptr_t< T >::operator= ( const intrusive_ptr_t< T > &  o)
inline

Copy operator.

◆ operator=() [2/2]

template<class T>
intrusive_ptr_t& so_5::intrusive_ptr_t< T >::operator= ( intrusive_ptr_t< T > &&  o)
inline

Move operator.

◆ operator==()

template<class T>
bool so_5::intrusive_ptr_t< T >::operator== ( const intrusive_ptr_t< T > &  o) const
inline

◆ reset()

template<class T>
void so_5::intrusive_ptr_t< T >::reset ( )
inline

Drop controlled object.

Since
v.5.2.2

◆ swap()

template<class T>
void so_5::intrusive_ptr_t< T >::swap ( intrusive_ptr_t< T > &  o)
inline

Swap values.

◆ take_object()

template<class T>
void so_5::intrusive_ptr_t< T >::take_object ( )
inlineprivate

Increment reference count to object if it's not null.

Member Data Documentation

◆ m_obj

template<class T>
T* so_5::intrusive_ptr_t< T >::m_obj
private

Object controlled by a smart reference.


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