#include <owner.hpp>
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 are declared private.
With debug builds the constructor expects caller source information parameters file, line and func. It is convenient to use macro ALIB_CALLER_PRUNED to provide those.
TOwnable | The type to own. The type needs to have methods Acquire and Release available. |
Public Methods | |
Owner (TOwnable &ownable, const NCString &dbgFile, int dbgLine, const NCString &dbgFunc) | |
~Owner () | |
Protected Fields | |
TOwnable & | theOwnable |
Private Methods | |
void * | operator new (size_t) |
void * | operator new (size_t, void *) |
void * | operator new[] (size_t) |
void * | operator new[] (size_t, void *) |
void | operator= (const Owner &) |
|
inline |
The constructor. Invokes Acquire() on the owner.
ownable | The ownable to acquire. |
dbgFile | Caller information. Available only with debug builds. |
dbgLine | Caller information. Available only with debug builds. |
dbgFunc | Caller information. Available only with debug builds. |
|
inline |
|
private |
Private new to disallow heap allocation.
|
private |
Private new to disallow heap allocation.
|
private |
Private new to disallow heap allocation.
|
private |
Private new to disallow heap allocation.
|
private |
Private assignment operator.