BESGlobalInit Class Reference

Provides for the orderly initialization and termination of global objects. More...

#include <BESGlobalInit.h>

Inheritance diagram for BESGlobalInit:

Inheritance graph
[legend]
Collaboration diagram for BESGlobalInit:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BESGlobalInit (BESInitFun, BESTermFun, BESInitializer *nextInit, int lvl)
 Construct an initializer object that will handle the initialization and termination of a global object.
virtual ~BESGlobalInit (void)
virtual bool initialize (int argc, char **argv)
 Method used to traverse a level of initialization functions.
virtual bool terminate (void)
 Method used to traverse a level of termination functions.
virtual void dump (ostream &strm) const
 dumps information about this object

Detailed Description

Provides for the orderly initialization and termination of global objects.

BESGlobalInit is an implementation of the abstration BESInitializer that provides the orderly initialization and termination of global objects. C++ does not provide such a mechanism, as global objects are created in random order. This gives the user more control over that ordering.

For a complete understanding of this global initialization mechanism please see the BESGlobalIQ documentation.

See also:
BESGlobalIQ

Definition at line 52 of file BESGlobalInit.h.


Constructor & Destructor Documentation

BESGlobalInit::BESGlobalInit ( BESInitFun  initFun,
BESTermFun  termFun,
BESInitializer nextInit,
int  lvl 
)

Construct an initializer object that will handle the initialization and termination of a global object.

To use this object please refer to the BESGlobalIQ documentation. It will provide the information necessary to order the initialization of your global objects including step-by-step instructions.

Parameters:
initFun Function used to initialize your global object
termFun Function used to terminate, destroy, or clean up your global object
nextInit The Next BESInitializer object that holds on to the initialization and termination functions for another global object
lvl initialization level. There are different levels of initialization, which provides the ordering. Objects at the same level are initialized in random order.
See also:
BESGlobalIQ

Definition at line 53 of file BESGlobalInit.cc.

References BESGlobalInitList.

BESGlobalInit::~BESGlobalInit ( void   )  [virtual]

Definition at line 64 of file BESGlobalInit.cc.


Member Function Documentation

bool BESGlobalInit::initialize ( int  argc,
char **  argv 
) [virtual]

Method used to traverse a level of initialization functions.

There can be multiple levels of initialization. Level 0 will be the first global initialization functions run, level 1 will be the next set of initialization functions run. This method will run the level of objects for the level specified in the constructor.

Again, see the BESGlobalIQ documentation for a full description of how to use the global initialization mechanism.

Parameters:
argc number of arguments passed in the argv argument list. This is the same as the command line argc.
argv the arguments passed to the initialization function. This is the same as the command line arguments argv.
Returns:
Returns true if successful or false if not successful and the application should terminate. If there is a problem but the application can continue to run then return true.
See also:
BESGlobalIQ

Implements BESInitializer.

Definition at line 87 of file BESGlobalInit.cc.

bool BESGlobalInit::terminate ( void   )  [virtual]

Method used to traverse a level of termination functions.

There can be multiple levels of initialization. Level 0 will be the first global termination functions run, level 1 will be the next set of termination functions run. This method will run the level of objects for the level specified in the constructor.

Again, see the BESGlobalIQ documentation for a full description of how to use the global initialization mechanism.

Returns:
Returns true if successful or false if not successful and the application should terminate. If there is a problem but the application can continue to run then return true.
See also:
BESGlobalIQ

Implements BESInitializer.

Definition at line 114 of file BESGlobalInit.cc.

References BESInitializer::terminate().

Here is the call graph for this function:

void BESGlobalInit::dump ( ostream &  strm  )  const [virtual]

dumps information about this object

Displays the pointer value of this instance

Parameters:
strm C++ i/o stream to dump the information to

Implements BESInitializer.

Definition at line 131 of file BESGlobalInit.cc.

References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Tue Mar 4 23:20:01 2008 for OPeNDAP Back End Server (BES) by  doxygen 1.5.1