BasicFramework Class Reference
[Framework for Applications]

#include <BasicFramework.hpp>

Inheritance diagram for BasicFramework:

Inheritance graph
[legend]
Collaboration diagram for BasicFramework:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is a (very) basic framework for programs in the GPS toolkit.

It is meant to be used by programs that start up, do some processing, and quit.

The end user should define subclasses of this class, implementing those methods described as being meant to be overridden; initialize(), additionalSetup(), spinUp(), process(), and shutDown().

In use, the user will construct an object of the class derived from this, then call the run() method.

Definition at line 91 of file BasicFramework.hpp.

Public Member Functions

 BasicFramework (const std::string &applName, const std::string &applDesc) throw ()
 Constructor for BasicFramework.
virtual ~BasicFramework ()
 Destructor.
virtual bool initialize (int argc, char *argv[], bool pretty=true) throw ()
 Process command line arguments.
bool run () throw ()
 Run the program.

Protected Member Functions

virtual void completeProcessing ()
 Called by the run() method; calls additionalSetup(), spinUp(), and process(), in that order.
virtual void additionalSetup ()
 Additional set-up to be performed before starting processing.
virtual void spinUp ()
 Code to be executed AFTER initialize() and additionalSetup().
virtual void process ()
 Processing to be performed.
virtual void shutDown ()
 Clean-up processing to be done before the program ends.

Protected Attributes

int debugLevel
 Debug level for this run of the program.
int verboseLevel
 Verbose level for this run of the program.
std::string argv0
 Name of the program.
std::string appDesc
 Description of program's function.
CommandOptionNoArg debugOption
 Enable debugging output and syslog message cloning to stdout.
CommandOptionNoArg verboseOption
CommandOptionNoArg helpOption


Constructor & Destructor Documentation

BasicFramework const std::string &  applName,
const std::string &  applDesc
throw ()
 

Constructor for BasicFramework.

Parameters:
applName name of the program (argv[0]).
applDesc text description of program's function (used by CommandOption help).

Definition at line 55 of file BasicFramework.cpp.

virtual ~BasicFramework  )  [inline, virtual]
 

Destructor.

Definition at line 108 of file BasicFramework.hpp.


Member Function Documentation

virtual void additionalSetup  )  [inline, protected, virtual]
 

Additional set-up to be performed before starting processing.

This generally involves things that are necessary for either the spinUp processing or main processing. This method should be implemeneted by the end-user.

Definition at line 165 of file BasicFramework.hpp.

Referenced by LoopedFramework::completeProcessing(), and BasicFramework::completeProcessing().

void completeProcessing  )  [protected, virtual]
 

Called by the run() method; calls additionalSetup(), spinUp(), and process(), in that order.

Generally should not be overridden.

Reimplemented in LoopedFramework.

Definition at line 130 of file BasicFramework.cpp.

References BasicFramework::additionalSetup(), BasicFramework::process(), and BasicFramework::spinUp().

Referenced by BasicFramework::run().

bool initialize int  argc,
char *  argv[],
bool  pretty = true
throw () [virtual]
 

Process command line arguments.

When this method is overridden, make sure to call the parent class's initialize().

Parameters:
argc same as main() argc.
argv same as main() argv.
pretty Whether the 'pretty print' option will be used when printing descriptions. It is 'TRUE' by default.
Returns:
true if normal processing should proceed (i.e. no command line errors or help requests).

Reimplemented in InOutFramework.

Definition at line 69 of file BasicFramework.cpp.

References CommandOptionParser::displayUsage(), CommandOptionParser::dumpErrors(), CommandOptionParser::hasErrors(), CommandOptionParser::parseOptions(), and verboseLevel.

Referenced by main().

virtual void process  )  [inline, protected, virtual]
 

Processing to be performed.

This method should be implemeneted by the end-user.

Reimplemented in MinSfTest, and Test.

Definition at line 179 of file BasicFramework.hpp.

Referenced by LoopedFramework::completeProcessing(), and BasicFramework::completeProcessing().

bool run  )  throw ()
 

Run the program.

Processes only once (refer to subclasses for looped processing).

Returns:
false if an exception occurred

Definition at line 103 of file BasicFramework.cpp.

References BasicFramework::completeProcessing(), and BasicFramework::shutDown().

Referenced by main().

virtual void shutDown  )  [inline, protected, virtual]
 

Clean-up processing to be done before the program ends.

This method is executed outside of a try block and should be implemeneted by the end-user.

Definition at line 187 of file BasicFramework.hpp.

Referenced by BasicFramework::run().

virtual void spinUp  )  [inline, protected, virtual]
 

Code to be executed AFTER initialize() and additionalSetup().

This method should be implemeneted by the end-user.

Definition at line 172 of file BasicFramework.hpp.

Referenced by LoopedFramework::completeProcessing(), and BasicFramework::completeProcessing().


Member Data Documentation

std::string appDesc [protected]
 

Description of program's function.

Definition at line 141 of file BasicFramework.hpp.

std::string argv0 [protected]
 

Name of the program.

Definition at line 140 of file BasicFramework.hpp.

int debugLevel [protected]
 

Debug level for this run of the program.

Definition at line 138 of file BasicFramework.hpp.

CommandOptionNoArg debugOption [protected]
 

Enable debugging output and syslog message cloning to stdout.

Definition at line 145 of file BasicFramework.hpp.

CommandOptionNoArg helpOption [protected]
 

Definition at line 147 of file BasicFramework.hpp.

int verboseLevel [protected]
 

Verbose level for this run of the program.

Definition at line 139 of file BasicFramework.hpp.

CommandOptionNoArg verboseOption [protected]
 

Definition at line 146 of file BasicFramework.hpp.


The documentation for this class was generated from the following files:
Generated on Thu Jul 29 03:32:01 2010 for GPS ToolKit Software Library by  doxygen 1.3.9.1