C12Adapter Opensource C++ Interface
|
Class that helps set a certain value when a certain scope exits. More...
Public Member Functions | |
MValueEndScopeSetter (Type *var, const Type &endScopeValue) | |
Constructor of the end scope setter that accepts the pointer to the variable which shall be assigned at the end of the scope. More... | |
~MValueEndScopeSetter () | |
Destructor, a place of delayed assignment of the variable given in constructor. | |
void | SetEndScopeValue (const Type &endScopeValue) |
A way of overwriting of the value that has to be assigned at destruction of end scope setter. | |
![]() | |
Type * | operator-> () const |
Field dereference operator. | |
Type & | operator* () const |
Pointer dereference operator. | |
Type * | get () const |
Get the underlying pointer. | |
Type * | release () |
Return the the underlying pointer while nullifying the unique pointer object. | |
Additional Inherited Members | |
![]() | |
typedef Type | element_type |
Type of the unique pointer. | |
![]() | |
MGenericNoncopyablePtr (Type *ptr=NULL) | |
Protected explicit initialization constructor. | |
~MGenericNoncopyablePtr () | |
Protected destructor. More... | |
![]() | |
Type * | m_pointer |
Pointer to object. | |
Class that helps set a certain value when a certain scope exits.
This is basically to delay the assignment of a given variable to the time of destruction of end scope setter. The type of the variable to manipulate shall be assignable, or a compile error will result from the usage attempt. Typical use case:
|
inline |
Constructor of the end scope setter that accepts the pointer to the variable which shall be assigned at the end of the scope.
The constructor will store the address of the variable and the value that shall be assigned at the end, and delay the assignment to the destructor.
var | Pointer to the value that has to be assigned at destructor. |
endScopeValue | The value to which to assign *var at the time of destruction of end scope setter. |