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 387 of file BasicFramework.hpp.
#include <BasicFramework.hpp>
Public Member Functions | |
BasicFramework (const std::string &applName, const std::string &applDesc) noexcept | |
virtual bool | initialize (int argc, char *argv[], bool pretty=true) noexcept |
bool | run () noexcept |
virtual | ~BasicFramework () |
Destructor. More... | |
Public Attributes | |
int | exitCode |
Static Public Attributes | |
static const int | EXCEPTION_ERROR = 1 |
static const int | EXIST_ERROR = 2 |
static const int | GENERAL_ERROR = 1 |
static const int | OPTION_ERROR = 2 |
Protected Member Functions | |
virtual void | additionalSetup () |
virtual void | completeProcessing () |
virtual void | process () |
virtual void | shutDown () |
virtual void | spinUp () |
Protected Attributes | |
std::string | appDesc |
Description of program's function. More... | |
std::string | argv0 |
Name of the program. More... | |
int | debugLevel |
Debug level for this run of the program. More... | |
CommandOptionNoArg | debugOption |
Enable/increase debugging output. More... | |
CommandOptionHelpUsage | helpOption |
Request command-line option usage. More... | |
int | verboseLevel |
Verbose level for this run of the program. More... | |
CommandOptionNoArg | verboseOption |
Enable/increase informational output. More... | |
Private Member Functions | |
BasicFramework () | |
|
noexcept |
Constructor for BasicFramework.
[in] | applName | name of the program (argv[0]). |
[in] | applDesc | text description of program's function (used by CommandOption help). |
Definition at line 56 of file BasicFramework.cpp.
|
inlinevirtual |
Destructor.
Definition at line 416 of file BasicFramework.hpp.
|
private |
|
inlineprotectedvirtual |
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.
Reimplemented in DebugTrace_T.
Definition at line 482 of file BasicFramework.hpp.
|
protectedvirtual |
Called by the run() method; calls additionalSetup(), spinUp(), and process(), in that order. Generally should not be overridden.
Reimplemented in DebugTrace_T, and gnsstk::LoopedFramework.
Definition at line 155 of file BasicFramework.cpp.
|
virtualnoexcept |
Process command line arguments. When this method is overridden, make sure to call the parent class's initialize().
[in] | argc | same as main() argc. |
[in] | argv | same as main() argv. |
[in] | pretty | Whether the 'pretty print' option will be used when printing descriptions. It is 'TRUE' by default. |
Reimplemented in RinEditNav, NewNavToRinex_T, CommandOption4Example, CommandOption5Example, CommandOption3Example, CommandOption2Example, CommandOption1Example, DebugTrace_T, gnsstk::InOutFramework< IType, OType >, and BasicFrameworkHelp_T.
Definition at line 71 of file BasicFramework.cpp.
|
inlineprotectedvirtual |
Processing to be performed. This method should be implemeneted by the end-user.
Reimplemented in RinEditNav, NewNavToRinex_T, DebugTrace_T, CommandOption4Example, CommandOption5Example, CommandOption3Example, CommandOption2Example, CommandOption1Example, TimCvt, and DFDiff.
Definition at line 498 of file BasicFramework.hpp.
|
noexcept |
Run the program. Processes only once (refer to subclasses for looped processing).
Definition at line 126 of file BasicFramework.cpp.
|
inlineprotectedvirtual |
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.
Reimplemented in DebugTrace_T, CommandOption4Example, CommandOption5Example, CommandOption3Example, CommandOption2Example, CommandOption1Example, and DFDiff.
Definition at line 507 of file BasicFramework.hpp.
|
inlineprotectedvirtual |
Code to be executed AFTER initialize() and additionalSetup(). This method should be implemeneted by the end-user.
Reimplemented in DebugTrace_T, and DFDiff.
Definition at line 490 of file BasicFramework.hpp.
|
protected |
Description of program's function.
Definition at line 458 of file BasicFramework.hpp.
|
protected |
Name of the program.
Definition at line 457 of file BasicFramework.hpp.
|
protected |
Debug level for this run of the program.
Definition at line 455 of file BasicFramework.hpp.
|
protected |
Enable/increase debugging output.
Definition at line 461 of file BasicFramework.hpp.
|
static |
Exit code used when an exception has been caught in run(). Not guaranteed to be unique to this condition.
Definition at line 392 of file BasicFramework.hpp.
|
static |
Exit code used when an input file does not exist or is not accessible.
Definition at line 402 of file BasicFramework.hpp.
int gnsstk::BasicFramework::exitCode |
A place to store the exit code for the application. Defaults to 0 which indicates successful completion. It is recommended that your application: 1) Set this value on terminal error. 2) Return this value from main in all cases.
Definition at line 450 of file BasicFramework.hpp.
|
static |
Non-specific exit code. Not guaranteed to be unique to this condition.
Definition at line 395 of file BasicFramework.hpp.
|
protected |
Request command-line option usage.
Definition at line 465 of file BasicFramework.hpp.
|
static |
Exit code used when an error has occurred in processing command-line options. Not guaranteed to be unique to this condition.
Definition at line 399 of file BasicFramework.hpp.
|
protected |
Verbose level for this run of the program.
Definition at line 456 of file BasicFramework.hpp.
|
protected |
Enable/increase informational output.
Definition at line 463 of file BasicFramework.hpp.