mace::ScopedStackExecution Class Reference
[Scoped]

#include <ScopedStackExecution.h>

Collaboration diagram for mace::ScopedStackExecution:

Collaboration graph
[legend]

List of all members.


Detailed Description

Supports deferring actions and identifying event boundaries.

A ScopedStackExecution object is placed after the agent lock is acquired, in each service transition and entry point. A static variable is used to track the call stack depth, incremented in each constructor, and decremented in each destructor.

In the constructor, a log message is printed if the stack level is 0, because a new event is beginning. In the destructor, a log message is printed if the stack level is 0, because the event is ending. Also, any deferred actions are executed at this point.

Finally, the scope level is exposed through a static method, so it may be inspected elsewhere.

Definition at line 104 of file ScopedStackExecution.h.


Public Member Functions

 ScopedStackExecution ()
 Place this object after lock acquiring to mark the beginning of a transition or service entry point.

Static Public Member Functions

static void addDefer (BaseMaceService *service)
 A service calls addDefer to indicate that when the call stack returns to 0, the service should have processDefered() called on it.
static void runDefer ()
 called when stack returns to 0 to execute deferred actions. Recurses in case deferred actions defer more actions.
static int getStackDepth ()
 returns the current stack depth. When called from a service executing an event, will return "here + 1", so 1 means top-level.

The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:42 2008 for Mace Library by  doxygen 1.5.5