Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::ShutdownRegistry Struct Reference

Class ShutdownRegistry is a utility for managing callbacks at program completion. More...

#include <source/toolbox/base/ShutdownRegistry.h>

List of all members.

Static Public Member Functions

static void registerShutdownRoutine (void(*callback)(), unsigned char priority)
static void callRegisteredShutdowns ()

Static Public Attributes

static const unsigned char priorityArenaManager = 10
static const unsigned char priorityReferenceCounter = 20
static const unsigned char priorityList = 30
static const unsigned char priorityVariableDatabase = 40
static const unsigned char priorityInputManager = 50
static const unsigned char priorityRestartManager = 60
static const unsigned char priorityStatistician = 60
static const unsigned char priorityBoundaryLookupTable = 60
static const unsigned char priorityHierarchyDataOpsManager = 60
static const unsigned char priorityTimerManger = 70


Detailed Description

Class ShutdownRegistry is a utility for managing callbacks at program completion.

Classes that wish to have a static function called at program shutdown must register a class via registerShutdownRoutine(). The registered shutdown handler is then called at shutdown when the callRegisteredShutdowns() is invoked. Note that the application program must explicitly call callRegisteredShutdowns().

This class is useful in releasing allocated class-specific static memory on program completion to simplify the search for memory leaks.


Member Function Documentation

void SAMRAI::tbox::ShutdownRegistry::registerShutdownRoutine void(*)()  callback,
unsigned char  priority
[static]
 

Register a shutdown routine with the ShutdownRegistry. The shutdown handler must take no arguments and returns no value.

The priority is used to specify the order for shutdowns, higher numbers are shutdown first, lower last (254 first, 0 last).

The priority is required since handlers can depend on one another. Basic handlers like Lists should be last, higher level handlers (which may free Lists) should be shutdown first.

Users are reserved priorities 254 to 127. Unless there is a known dependency on a SAMRAI shutdown handler, users should use these priorities.

There is a potential for an infinite loop if routines register themselves with the registry as part of the shutdown.

Parameters:
callback The function to call on shutdown
priority The priority (254 called first, 0 last)

void SAMRAI::tbox::ShutdownRegistry::callRegisteredShutdowns  )  [static]
 

Invoke the registered shutdown handlers. Note that this routine must be explicitly called at the end of the application. This routine may only be called once, since the registered information is discarded at the end of this call.


Member Data Documentation

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityArenaManager = 10 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityReferenceCounter = 20 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityList = 30 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityVariableDatabase = 40 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityInputManager = 50 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityRestartManager = 60 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityStatistician = 60 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityBoundaryLookupTable = 60 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityHierarchyDataOpsManager = 60 [static]
 

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityTimerManger = 70 [static]
 


The documentation for this struct was generated from the following files:
Generated on Fri Dec 2 11:33:18 2005 for SAMRAI by  doxygen 1.4.2