ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
Owner< TOwnable > Class Template Reference

Description:

template<typename TOwnable>
class alib::lang::Owner< TOwnable >

Ensures that an object of template type TOwnable is acquired and properly released when unwinding the stack. This class is meant to be allocated only on the stack and not on the heap. Therefore, the new operators as well as copy and move constructors and assignment operators are declared private.

With debug-builds, the constructor expects caller source information parameters of type CallerInfo. Use macro ALIB_CALLER_PRUNED to prune those with release-builds.

See also
Template Parameters
TOwnableThe type to own. Requirements are to have methods Acquire and Release available.

Definition at line 48 of file owner.hpp.

#include <owner.hpp>

Collaboration diagram for Owner< TOwnable >:
[legend]

Public Method Index:

 Owner (TOwnable &ownable, const CallerInfo &ci)
 
 ~Owner ()
 Destructor. Releases the owner by invoking Release().
 

Protected Field Index:

CallerInfo dbgCI
 Caller information. Available only with debug-builds.
 
TOwnable & owned
 The resource to acquire and release.
 

Field Details:

◆ dbgCI

template<typename TOwnable >
CallerInfo dbgCI
protected

Caller information. Available only with debug-builds.

Definition at line 55 of file owner.hpp.

◆ owned

template<typename TOwnable >
TOwnable& owned
protected

The resource to acquire and release.

Definition at line 53 of file owner.hpp.

Constructor(s) / Destructor Details:

◆ Owner()

template<typename TOwnable >
Owner ( TOwnable & ownable,
const CallerInfo & ci )
inline

Constructor. Invokes Acquire() on the owner.

Parameters
ownableThe ownable to acquire.
ciCaller information.

Definition at line 76 of file owner.hpp.

◆ ~Owner()

template<typename TOwnable >
~Owner ( )
inline

Destructor. Releases the owner by invoking Release().

Definition at line 85 of file owner.hpp.


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