Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
gnsstk::BasicFramework Class Reference

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 387 of file BasicFramework.hpp.

#include <BasicFramework.hpp>

Inheritance diagram for gnsstk::BasicFramework:
Inheritance graph
[legend]

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 ()
 

Constructor & Destructor Documentation

◆ BasicFramework() [1/2]

gnsstk::BasicFramework::BasicFramework ( const std::string &  applName,
const std::string &  applDesc 
)
noexcept

Constructor for BasicFramework.

Parameters
[in]applNamename of the program (argv[0]).
[in]applDesctext description of program's function (used by CommandOption help).

Definition at line 56 of file BasicFramework.cpp.

◆ ~BasicFramework()

virtual gnsstk::BasicFramework::~BasicFramework ( )
inlinevirtual

Destructor.

Definition at line 416 of file BasicFramework.hpp.

◆ BasicFramework() [2/2]

gnsstk::BasicFramework::BasicFramework ( )
private

Member Function Documentation

◆ additionalSetup()

virtual void gnsstk::BasicFramework::additionalSetup ( )
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.

◆ completeProcessing()

void gnsstk::BasicFramework::completeProcessing ( )
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.

◆ initialize()

bool gnsstk::BasicFramework::initialize ( int  argc,
char *  argv[],
bool  pretty = true 
)
virtualnoexcept

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

Parameters
[in]argcsame as main() argc.
[in]argvsame as main() argv.
[in]prettyWhether 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 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.

◆ process()

virtual void gnsstk::BasicFramework::process ( )
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.

◆ run()

bool gnsstk::BasicFramework::run ( )
noexcept

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

Returns
false if an exception occurred

Definition at line 126 of file BasicFramework.cpp.

◆ shutDown()

virtual void gnsstk::BasicFramework::shutDown ( )
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.

◆ spinUp()

virtual void gnsstk::BasicFramework::spinUp ( )
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.

Member Data Documentation

◆ appDesc

std::string gnsstk::BasicFramework::appDesc
protected

Description of program's function.

Definition at line 458 of file BasicFramework.hpp.

◆ argv0

std::string gnsstk::BasicFramework::argv0
protected

Name of the program.

Definition at line 457 of file BasicFramework.hpp.

◆ debugLevel

int gnsstk::BasicFramework::debugLevel
protected

Debug level for this run of the program.

Definition at line 455 of file BasicFramework.hpp.

◆ debugOption

CommandOptionNoArg gnsstk::BasicFramework::debugOption
protected

Enable/increase debugging output.

Definition at line 461 of file BasicFramework.hpp.

◆ EXCEPTION_ERROR

const int gnsstk::BasicFramework::EXCEPTION_ERROR = 1
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.

◆ EXIST_ERROR

const int gnsstk::BasicFramework::EXIST_ERROR = 2
static

Exit code used when an input file does not exist or is not accessible.

Definition at line 402 of file BasicFramework.hpp.

◆ exitCode

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.

◆ GENERAL_ERROR

const int gnsstk::BasicFramework::GENERAL_ERROR = 1
static

Non-specific exit code. Not guaranteed to be unique to this condition.

Definition at line 395 of file BasicFramework.hpp.

◆ helpOption

CommandOptionHelpUsage gnsstk::BasicFramework::helpOption
protected

Request command-line option usage.

Definition at line 465 of file BasicFramework.hpp.

◆ OPTION_ERROR

const int gnsstk::BasicFramework::OPTION_ERROR = 2
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.

◆ verboseLevel

int gnsstk::BasicFramework::verboseLevel
protected

Verbose level for this run of the program.

Definition at line 456 of file BasicFramework.hpp.

◆ verboseOption

CommandOptionNoArg gnsstk::BasicFramework::verboseOption
protected

Enable/increase informational output.

Definition at line 463 of file BasicFramework.hpp.


The documentation for this class was generated from the following files:


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:44