moduleGuard Class Reference

Guards for all code instrumentation issues associated with a source code module. More...

#include <moduleGuard.h>


Public Types

enum  TGuardOptions {
  NO_INDENT = 1,
  SHOW_TITLE = 2,
  SYNC_BOUNDS = 4
}

Public Member Functions

 moduleGuard (TModule _guardedModule, const managedObject &X, TOption _options=0) throw ()
 moduleGuard (TModule _guardedModule, const managedObject &X, const char *logEntry, TOption _options=0) throw ()
 ~moduleGuard () throw ()
void Shutdown (msgType msg=NO_MSG, const char *logEntry=NULL) throw ()
void InitBounds (double _lower=-InfFloat, double _upper=InfFloat) const throw ()
void SetBounds (double _lower, double _upper) const throw (ERRejected)
void SetLowerBound (double _lower) const throw (ERRejected)
void SetUpperBound (double _upper) const throw (ERRejected)
double LowerBound () const throw ()
double UpperBound () const throw ()
void InitProgressCounter (double _maxProgress, double _step=1.0) throw ()
void SetProgressMax (double _maxProgress) throw ()
void SetProgressCounter (double currentProgress) throw ()
void SetProgressNext (double step) throw ()
void ProgressStep () throw ()
void ProgressStep (double step) throw ()
void Trace (double step=0) throw ()
void Trace (managedObject &X, double step=0) throw ()


Detailed Description

Guards for all code instrumentation issues associated with a source code module.

This initializes the code instrumentation for a specified source code module, memorizes certain preconditions, and automatically starts and stops the associated timer.

Guard objects are instanciated as local variables in the context of a mathematical method. By that, the destructor code is executed, even if the guard's context is left by an exception. This is used to reduce the overhead of code instrumentation. In the basic use case, the mathematical method only includes a constructor call and the listOfModules[] an entry to describe the mathematical method.


Member Enumeration Documentation

enum TGuardOptions
 

Combinable constructor options.

Enumerator:
NO_INDENT  Do not increase the indentation level at guard construction / destruction.
SHOW_TITLE  Log the title of the guarded source code module.
SYNC_BOUNDS  Synchronize optimization bounds with the parent guard object.


Constructor & Destructor Documentation

moduleGuard TModule  _guardedModule,
const managedObject X,
TOption  _options = 0
throw ()
 

Start a source code module guard.

Parameters:
_guardedModule The supervised source code module
X An oject to referenced in the logging output
_options A bit combination of TGuardOptions enum values
If SHOW_TITLE is specified, the module name from listOfModules is logged.

moduleGuard TModule  _guardedModule,
const managedObject X,
const char *  logEntry,
TOption  _options = 0
throw ()
 

Start a source code module guard.

Parameters:
_guardedModule The supervised source code module
X An oject to referenced in the logging output
logEntry An initial log message
_options Either 0 or NO_INDENT

~moduleGuard  )  throw ()
 

Destroy a source code module guard.

This executes Shutdown() if this method has not been called before explicitly.


Member Function Documentation

void Shutdown msgType  msg = NO_MSG,
const char *  logEntry = NULL
throw ()
 

Stop a source code module guard, in occasion, with a log message.

Parameters:
msg The applied logging category
logEntry A final log message of NULL
This stops the associated timer and reports about the running times if it is not a nested application of this timer. It then cleans up the logging indentation level and posts a message, if specified.