SObjectizer  5.7
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
so_5::coop_unique_holder_t Class Reference

A special type that plays role of unique_ptr for coop. More...

#include <coop.hpp>

Public Member Functions

 coop_unique_holder_t ()=default
 
 coop_unique_holder_t (coop_shptr_t coop)
 
 coop_unique_holder_t (const coop_unique_holder_t &)=delete
 
 coop_unique_holder_t (coop_unique_holder_t &&)=default
 
coop_unique_holder_toperator= (const coop_unique_holder_t &)=delete
 
coop_unique_holder_toperator= (coop_unique_holder_t &&)=default
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
coop_tget () const noexcept
 
coop_toperator-> () const noexcept
 
coop_toperator* () const noexcept
 

Private Member Functions

coop_shptr_t release () noexcept
 

Private Attributes

coop_shptr_t m_coop
 A pointer to coop object. More...
 

Friends

class impl::coop_private_iface_t
 
void swap (coop_unique_holder_t &a, coop_unique_holder_t &b) noexcept
 

Detailed Description

A special type that plays role of unique_ptr for coop.

In previous versions of SObjectizer std::unique_ptr was used for holding coop before the coop will be passed to register_coop. But in v.5.6 shared_ptr should be used for holding a pointer to a coop object (otherwise a call to coop_t::shared_from_this() can throw std::bad_weak_ptr in some cases).

Class coop_unique_holder_t is an replacement for coop_unique_ptr_t from previous versions of SObjectizer, but it holds shared_ptr inside.

Since
v.5.6.0
Examples:
so_5/dispatcher_hello/main.cpp, and so_5/hardwork_imit/main.cpp.

Constructor & Destructor Documentation

◆ coop_unique_holder_t() [1/4]

so_5::coop_unique_holder_t::coop_unique_holder_t ( )
default

◆ coop_unique_holder_t() [2/4]

so_5::coop_unique_holder_t::coop_unique_holder_t ( coop_shptr_t  coop)
inline

◆ coop_unique_holder_t() [3/4]

so_5::coop_unique_holder_t::coop_unique_holder_t ( const coop_unique_holder_t )
delete

◆ coop_unique_holder_t() [4/4]

so_5::coop_unique_holder_t::coop_unique_holder_t ( coop_unique_holder_t &&  )
default

Member Function Documentation

◆ get()

coop_t* so_5::coop_unique_holder_t::get ( ) const
inlinenoexcept

◆ operator bool()

so_5::coop_unique_holder_t::operator bool ( ) const
inlinenoexcept

◆ operator!()

bool so_5::coop_unique_holder_t::operator! ( ) const
inlinenoexcept

◆ operator*()

coop_t& so_5::coop_unique_holder_t::operator* ( ) const
inlinenoexcept

◆ operator->()

coop_t* so_5::coop_unique_holder_t::operator-> ( ) const
inlinenoexcept

◆ operator=() [1/2]

coop_unique_holder_t& so_5::coop_unique_holder_t::operator= ( const coop_unique_holder_t )
delete

◆ operator=() [2/2]

coop_unique_holder_t& so_5::coop_unique_holder_t::operator= ( coop_unique_holder_t &&  )
default

◆ release()

coop_shptr_t so_5::coop_unique_holder_t::release ( )
inlineprivatenoexcept

Friends And Related Function Documentation

◆ impl::coop_private_iface_t

friend class impl::coop_private_iface_t
friend

◆ swap

void swap ( coop_unique_holder_t a,
coop_unique_holder_t b 
)
friend

Member Data Documentation

◆ m_coop

coop_shptr_t so_5::coop_unique_holder_t::m_coop
private

A pointer to coop object.


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