SObjectizer  5.8
Loading...
Searching...
No Matches
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 &&) noexcept=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.
 

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.

Definition at line 1341 of file coop.hpp.

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

Definition at line 1356 of file coop.hpp.

◆ 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

Definition at line 1379 of file coop.hpp.

◆ operator bool()

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

Definition at line 1374 of file coop.hpp.

◆ operator!()

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

Definition at line 1376 of file coop.hpp.

◆ operator*()

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

Definition at line 1385 of file coop.hpp.

◆ operator->()

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

Definition at line 1382 of file coop.hpp.

◆ 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 && )
defaultnoexcept

◆ release()

coop_shptr_t so_5::coop_unique_holder_t::release ( )
inlineprivatenoexcept

Definition at line 1349 of file coop.hpp.

Friends And Related Symbol Documentation

◆ impl::coop_private_iface_t

friend class impl::coop_private_iface_t
friend

Definition at line 1343 of file coop.hpp.

◆ swap

void swap ( coop_unique_holder_t & a,
coop_unique_holder_t & b )
friend

Definition at line 1368 of file coop.hpp.

Member Data Documentation

◆ m_coop

coop_shptr_t so_5::coop_unique_holder_t::m_coop
private

A pointer to coop object.

Definition at line 1346 of file coop.hpp.


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