Ocean
|
This class holds a function which will be invoked once the object is disposed. More...
Public Member Functions | |
ScopedFunctionT ()=default | |
Creates an object without function. More... | |
ScopedFunctionT (T &&function) noexcept | |
Creates a new object with a given function. More... | |
ScopedFunctionT (ScopedFunctionT< T > &&scopedFunction) noexcept | |
Move constructor. More... | |
~ScopedFunctionT () | |
Destructs this object and invoked the function if this object holds function. More... | |
void | release () |
Explicitly released this object. More... | |
void | revoke () |
Revokes the function call. More... | |
ScopedFunctionT & | operator= (ScopedFunctionT< T > &&scopedFunction) noexcept |
Move operator. More... | |
Protected Member Functions | |
ScopedFunctionT (const ScopedFunctionT &)=delete | |
Disabled copy constructor. More... | |
ScopedFunctionT< T > & | operator= (const ScopedFunctionT &)=delete |
Disabled assign operator. More... | |
Protected Attributes | |
T | function_ = T() |
The function to be invoked. More... | |
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.