#include <coherence/lang/FinalizableBlock.hpp>
Inherited by SynchronizedMemberReadBlock.
FinalizableBlocks are useful for cases where a series of finalization routines need to be run from a nested function calls. For non-nested finalization the use of a FinalizableBlock is unnecessary, and a disposable or local class should be used.
Public Member Functions | |
void | pushFinalizer (Finalizer *pFinalizer) |
Push a custom finalizer onto the FinalizableBlock's finalization stack. | |
Protected Member Functions | |
FinalizableBlock (FinalizableBlock *pDelegate=NULL) | |
Construct a FinalizableBlock object. | |
FinalizableBlock (const FinalizableBlock &that) | |
Copy constructor. | |
~FinalizableBlock () | |
Destroy a FinalizableBlock object. | |
bool | isTerminal () const |
Return true if the FinalizableBlock is not delegating to another FinalizableBlock. | |
void | initialize (FinalizableBlock *pDelegate=NULL) |
Initialize a FinalizableBlock object. | |
Classes | |
class | Finalizer |
Interface for custom automatic cleanup operations. More... |
FinalizableBlock | ( | FinalizableBlock * | pDelegate = NULL |
) | [inline, protected] |
Construct a FinalizableBlock object.
pDelegate | FinalizableBlock to delegate to, or NULL for no delegate |
FinalizableBlock | ( | const FinalizableBlock & | that | ) | [inline, protected] |
Copy constructor.
The new block takes over the ownership of the finalization, the supplied block is invalidated, and is not longer usable.
that | the source block |
~FinalizableBlock | ( | ) | [inline, protected] |
Destroy a FinalizableBlock object.
In the case of delegating blocks the destructor has no effect, otherwise the finalizer stack is popped, until until all finalizers have been deleted.
void pushFinalizer | ( | Finalizer * | pFinalizer | ) | [inline] |
Push a custom finalizer onto the FinalizableBlock's finalization stack.
If the FinalizableBlock was constructed with a delegate, then the finalizer is pushed on the delegates finalizer stack.
The finalizer will then be owned by the FinalizableBlock and will be automatically deleted with the top-most FinalizableBlock is destroyed.
pFinalizer | finalizer to add to the finalization stack |
bool isTerminal | ( | ) | const [inline, protected] |
Return true if the FinalizableBlock is not delegating to another FinalizableBlock.
void initialize | ( | FinalizableBlock * | pDelegate = NULL |
) | [inline, protected] |
Initialize a FinalizableBlock object.
A block may be re-initialized so long as it has not been assigned a delegate, and has no finalization stack.
pDelegate | FinalizableBlock to delegate to, or NULL for no delegate |