A mechanism to save and restore context between scopes.
A scope allows parts of the code to change global state (such as the current log) during execution, and restore it afterwards. Objects of this class should be declared as automatic variables so that the destructor is called when execution leaves the lexical scope.
Note that the root scope must be declared with an explicit log, or the first logging statement will fail.
In order to keep track of scopes, there are some rules: If Scope a is created before Scope b, b must be deleted before a. Really deleted, Allocator::free() will not free them.
Creates and enters a new scope that has log l. The new scope is made current.
Creates and enters a new scope that shares all the attributes of its enclosing scope. If there is no current scope, the new scope has no log.
The new scope is made current.
Returns a pointer to the current scope, or a null pointer if no scope has been created.
Returns a pointer to the current scope log, or a null pointer if the current Scope has no Log.
Sets the scope log to l. The previous Log is not affected. In particular, the previous Log is not commited. Should it be? Probably.
If this scope is the current scope, then the previous current scope is made current again.
If not, an exception is thrown. The case could be handled - we used to have code to handle this in Arena.
This web page based on source code belonging to Oryx Mail Systems GmbH. All rights reserved.