Ocean
|
This class holds a function which will be invoked once the object is disposed. More...
#include <ScopedFunction.h>
Public Member Functions | |
ScopedFunctionT ()=default | |
Creates an object without function. | |
ScopedFunctionT (T &&function) noexcept | |
Creates a new object with a given function. | |
ScopedFunctionT (ScopedFunctionT< T > &&scopedFunction) noexcept | |
Move constructor. | |
~ScopedFunctionT () | |
Destructs this object and invoked the function if this object holds function. | |
void | release () |
Explicitly released this object. | |
void | revoke () |
Revokes the function call. | |
ScopedFunctionT & | operator= (ScopedFunctionT< T > &&scopedFunction) noexcept |
Move operator. | |
Protected Member Functions | |
ScopedFunctionT (const ScopedFunctionT &)=delete | |
Disabled copy constructor. | |
ScopedFunctionT< T > & | operator= (const ScopedFunctionT &)=delete |
Disabled assign operator. | |
Protected Attributes | |
T | function_ = T() |
The function to be invoked. | |
This class holds a function which will be invoked once the object is disposed.
T | The data type of the function |
|
default |
Creates an object without function.
|
explicitnoexcept |
Creates a new object with a given function.
function | The function to be invoked once this object is disposed |
|
noexcept |
Move constructor.
scopedFunction | Object to be moved |
Ocean::ScopedFunctionT< T >::~ScopedFunctionT | ( | ) |
Destructs this object and invoked the function if this object holds function.
|
protecteddelete |
Disabled copy constructor.
|
protecteddelete |
Disabled assign operator.
|
noexcept |
Move operator.
scopedFunction | The object to be moved |
void Ocean::ScopedFunctionT< T >::release | ( | ) |
Explicitly released this object.
In case this object holds a valid function, the function is invoked and then invalidated so that the function will not be invoked again when this object is disposed.
void Ocean::ScopedFunctionT< T >::revoke | ( | ) |
Revokes the function call.
In case this object holds a valid function, the function is invalidated without calling the function.
|
protected |
The function to be invoked.