ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::app::App Class Reference

Description:

This is a central class of library module ALib App.

For information about general use and features of this class consult the ALib App User Manual.

Definition at line 16 of file app.hpp.

#include <app.hpp>

Collaboration diagram for alib::app::App:
[legend]

Inner Type Index:

struct  ConfigFileDescriptor
struct  StateMachine

Public Type Index:

enum class  Exceptions { ControlledEarlyExit }

Public Method Index:

virtual void exceptionDisplay (Exception &exception, AString &target)
virtual Enum exceptionToExitCode (Exception &exception)
virtual void exitWithHelpOutput (Enum exitCode, const String &helpTopic=NULL_STRING, Box formatParam1=EMPTY_STRING, Box formatParam2=EMPTY_STRING)
virtual void getConfigFilePaths (StdVectorMA< ConfigFileDescriptor > &files)
virtual void getConfigFilePathsFromCLIParam (StdVectorMA< ConfigFileDescriptor > &files)
virtual void getConfigFilePathsFromResources (StdVectorMA< ConfigFileDescriptor > &files)
virtual void getConfigFilePathsMakeAbsolutePaths (StdVectorMA< ConfigFileDescriptor > &files)
String GetInfo ()
String GetName ()
virtual lox::textlogger::TextLoggerGetRLogger ()
virtual lox::LoxGetRLox ()
String GetVersion ()
virtual int Main (int argc, const char **argv, const wchar_t **argvw=nullptr)
virtual void onBsCLIDefine ()
virtual void onBsCLIReadOptions ()
virtual void onBsConfigureCLI ()
virtual void onBsFinalizeBootstrap ()
virtual void onBsImportConfig ()
virtual void onBsPreloadVariables ()
virtual void onBsPrepareConfig ()
virtual void onBsPrepareResources ()
virtual void onBsReadDryRunOption ()
virtual void onBsSetCamps ()
virtual void onBsSetNameVersionAndInfo ()
virtual void onBsSetupALox ()
virtual void onRun ()
virtual void onRunEnd ()
virtual void onRunStart ()
virtual void onSdAnnounceShutdown ()
virtual void onSdCleanALox ()
virtual void onSdExportConfig ()
virtual void onSdFinalizeShutdown ()
virtual void onSdOutput ()
virtual void printConfigFileInfo (Paragraphs &target)
virtual bool processCLICmd (Command *cmd)

Protected Type Index:

enum class  Commands { Help = 1 , Version = 2 , Info = 3 }
 Built-in commands used with class App. More...
enum class  ExitCodes {
  OK = 0 , ErrNoCmdGiven = 1 , ErrUnknownCommand = 2 , ErrParsingOption = 3 ,
  ErrParsingCommand = 4 , ErrMissingCmdParam = 5 , ErrMissingOptParam = 6 , ErrBadParamValue = 7 ,
  ErrConfigFileNotFound = 10 , ErrConfigFileNotWritable = 11 , ErrUnknown = 127
}
enum class  Flags {
  NONE = 0 , CreateReleaseLox =(1<<0) , UseReleaseLoggerForDebugLogging =(1<<1) , ALoxVerbosityExportAllAndWriteBackRelLogger =(1<<2) ,
  ALoxVerbosityExportAllAndWriteBackDbgLogger =(1<<3)
}
 Configuration flags used with class App. More...
enum class  Options {
  Help = 1 , Version = 2 , DryRun = 3 , Config = 4 ,
  Verbose = 5
}
 Built-in options used with class App. More...
enum class  Parameters { Topic = 1 }
 Built-in parameters of commands and options used with class App. More...
enum class  States {
  NOT_STARTED = 0 , SetCamps =1100 , PrepareResources =1200 , SetNameVersionAndInfo =1300 ,
  PrepareConfig =2100 , PreloadVariables =2200 , CLIDefine =2300 , CLIReadOptions =2400 ,
  ImportConfig =2500 , ConfigureCLI =2600 , FinalizeBootstrap =3100 , ReadDryRunOption =3200 ,
  SetupALox =3300 , RunStart =5000 , Run =5100 , RunEnd =5200 ,
  AnnounceShutdown =9100 , CleanALox =9200 , ExportConfig =9300 , Output =9400 ,
  FinalizeShutdown =9500
}

Protected Field Index:

String appInfo =nullptr
String appName =nullptr
String appVersion =nullptr
ParagraphscErr =nullptr
 Same as cOut, but used for stream std::err.
CommandLine cli
 The command-line parser.
bool cliStop =false
 Flag to stop the CLI processing loop.
ParagraphscOut =nullptr
bool dryrun =false
Flags flags =Flags::NONE
 Various boolean flags used to configure the application.
StateMachine machine
 The state-machine singleton.
lox::textlogger::TextLoggerreleaseLogger =nullptr
NString releaseLoggerName ="RLOGGER"
lox::LoxreleaseLox =nullptr
NString releaseLoxName ="RLOX"
StopWatch stopWatch

Protected Method Index:

 App ()
virtual ~App ()
 Virtual destructor.

◆ AppCamp

friend class AppCamp
friend

Definition at line 18 of file app.hpp.

Enumeration Details:

◆ Commands

enum class alib::app::App::Commands
strongprotected

Built-in commands used with class App.

Enumerator
Help 

Show help text.

Version 

Show version information.

Info 

Show info and configuration details.

Definition at line 21 of file app.hpp.

◆ Exceptions

enum class alib::app::App::Exceptions
strong

Generic Exceptions handled by class App. This enumeration contains only one single entry.

Enumerator
ControlledEarlyExit 

This exception is used to support the exception/error/exit code paradigm introduced by class App.

See also
A detailed description on the usage of this exception is given in chapter 3.5 Controlled Early Exit (Exceptions::ControlledEarlyExit) of the Programmer's Manual of the module ALib App.

Definition at line 77 of file app.hpp.

◆ ExitCodes

enum class alib::app::App::ExitCodes
strongprotected

Built-in exit-codes of the ALib application. The codes are mostly generated in the method exceptionToExitCode, where exceptions thrown by the CLI implementation are translated to these codes.
In the case that an application desires to use different exit codes, the latter method has to be overridden.

This enumeration gets the according ALib Enum Records assigned as well as the resources describing the exit error.

Enumerator
OK 

Success.

ErrNoCmdGiven 

No command given.

ErrUnknownCommand 

Unknown command.

ErrParsingOption 

Error when parsing an option.

ErrParsingCommand 

Error when parsing a command.

ErrMissingCmdParam 

Missing parameter of a command.

ErrMissingOptParam 

Missing parameter of an option.

ErrBadParamValue 

Bad parameter value.

ErrConfigFileNotFound 

The default configuration file(s), or that (those) specified by option '–config', could not be found or read.

ErrConfigFileNotWritable 

The configuration file(s) could not be written.

ErrUnknown 

An unknown exception occurred. This should never happen.

Definition at line 52 of file app.hpp.

◆ Flags

enum class alib::app::App::Flags
strongprotected

Configuration flags used with class App.

Enumerator
NONE 

No flags set.

CreateReleaseLox 

If set, method virtual void onBsSetupALox()  will create a release Lox instance available via field virtual lox::Lox * GetRLox() , as well as an attached logger available via field virtual lox::textlogger::TextLogger * GetRLogger() .

UseReleaseLoggerForDebugLogging 

If set, method virtual void onBsSetupALox()  will create and attach the release logger to the debug Lox Lox.

ALoxVerbosityExportAllAndWriteBackRelLogger 

If set, method virtual void onSdExportConfig()  adds 'ExportAll' and 'writeback' to the verbosity variable of the lox::textlogger::TextLogger * releaseLogger in the case that this variable had not been read from the INI file with virtual void onBsImportConfig() .

ALoxVerbosityExportAllAndWriteBackDbgLogger 

If set, method virtual void onSdExportConfig()  adds 'ExportAll' and 'writeback' to the verbosity variable of the debug-logger in the case that this variable had not been read from the INI file with virtual void onBsImportConfig() .

Definition at line 93 of file app.hpp.

◆ Options

enum class alib::app::App::Options
strongprotected

Built-in options used with class App.

Enumerator
Help 

Alternative to command 'help' as many people are used to pass the help command as an option.

Version 

Alternative to command 'version' as many people are used to pass the version command as an option.

DryRun 

Sets the flag dryrun.

Config 

Change the configured config file path(s).

Verbose 

Reserved option for increasing verbosity.

Definition at line 28 of file app.hpp.

◆ Parameters

enum class alib::app::App::Parameters
strongprotected

Built-in parameters of commands and options used with class App.

Enumerator
Topic 

Used with command help to optionally denote a help topic.

Definition at line 39 of file app.hpp.

◆ States

enum class alib::app::App::States
strongprotected

The predefined states of the simple linear state-machine implemented by outer class App. For each state, a corresponding virtual function exists. The pairs of states and the corresponding virtual functions are collected in the field StateMachine::Program.
Custom applications (derived from class App) define their own enum type in case they want to insert additional pairs of state/methods into the program. This is possible because the collection of states in the field StateMachine::Program is implemented as type Enum, which may hold enumeration elements of an arbitrary type.

Note that the numbering of the enum elements is not of importance. The numbers found here were chosen to be quickly identifiable while debugging. The simple scheme is:

  • 1x: Bootstrap phase resources. (See also alib::BootstrapPhases).
  • 2x: Bootstrap phase configuration/variables.
  • 3x: Bootstrap phase finalization.
  • 1xx: running phase.
  • 9xx: shutdown phase. (See also alib::ShutdownPhases).

Also, the numbers are not defining the order of execution, which is solely defined by the order in the vector StateMachine::Program.

The custom enumeration type used for potential custom states may but does not need to align. It even may have the same integral values as given here. This flexibility is gained by the little magic of class Enum introduced by module ALib Boxing.

Enumerator
NOT_STARTED 

Initial state before starting the App.

The starting state not associated with a method.

SetCamps 

Invokes the virtual method onBsSetCamps.

PrepareResources 

Invokes the virtual method onBsPrepareResources.

SetNameVersionAndInfo 

Invokes the virtual method onBsSetNameVersionAndInfo.

PrepareConfig 

Invokes the virtual method onBsPrepareConfig.

PreloadVariables 

Invokes the virtual method onBsPreloadVariables.

CLIDefine 

Invokes the virtual method onBsCLIDefine.

CLIReadOptions 

Invokes the virtual method onBsCLIReadOptions.

ImportConfig 

Invokes the virtual method onBsImportConfig.

ConfigureCLI 

Invokes the virtual method onBsConfigureCLI.

FinalizeBootstrap 

Invokes the virtual method onBsFinalizeBootstrap.

ReadDryRunOption 

Invokes the virtual method onBsReadDryRunOption.

SetupALox 

Invokes the virtual method onBsSetupALox.

RunStart 

Invokes the virtual method onRunStart.

Run 

Invokes the virtual method onRun.

RunEnd 

Invokes the virtual method onRunEnd.

AnnounceShutdown 

Invokes the virtual method onSdAnnounceShutdown.

CleanALox 

Invokes the virtual method onSdCleanALox.

ExportConfig 

Invokes the virtual method onSdExportConfig.

Output 

Invokes the virtual method onSdOutput.

FinalizeShutdown 

Invokes the virtual method onSdFinalizeShutdown.

Definition at line 144 of file app.hpp.

Field Details:

◆ appInfo

String alib::app::App::appInfo =nullptr
protected

Some short information and probably copyright message of the application. If not set from the descendant, it is tried to be loaded from resource "AppInfo" by the default implementation of onBsSetNameVersionAndInfo.

Definition at line 388 of file app.hpp.

◆ appName

String alib::app::App::appName =nullptr
protected

The name of the application. If not set from the descendant, it is tried to be loaded from resource "AppName" by the default implementation of onBsSetNameVersionAndInfo.

Definition at line 378 of file app.hpp.

◆ appVersion

String alib::app::App::appVersion =nullptr
protected

A version string of the application. If not set from the descendant, it is tried to be loaded from resource "AppVersion" by the default implementation of onBsSetNameVersionAndInfo.

Definition at line 383 of file app.hpp.

◆ cErr

Paragraphs* alib::app::App::cErr =nullptr
protected

Same as cOut, but used for stream std::err.

Definition at line 398 of file app.hpp.

◆ cli

CommandLine alib::app::App::cli
protected

The command-line parser.

Definition at line 425 of file app.hpp.

◆ cliStop

bool alib::app::App::cliStop =false
protected

Flag to stop the CLI processing loop.

When set to true, no further commands from the command line are processed. Typical usage is the built-in or custom help command: once help text has been generated and printed, further command processing is not desired.

Definition at line 432 of file app.hpp.

◆ cOut

Paragraphs* alib::app::App::cOut =nullptr
protected

Used to assemble and collect the output for standard output character stream std::cout during the run of this application.
The collected output is scheduled to be written by the method onSdOutput. This method, may also be "manually" invoked at any time to flush the current buffers to the output streams.

Definition at line 395 of file app.hpp.

◆ dryrun

bool alib::app::App::dryrun =false
protected

Set with built-in option "--dryrun", which is read with States::ReadDryRunOption. Defaults to false.

Definition at line 436 of file app.hpp.

◆ flags

Flags alib::app::App::flags =Flags::NONE
protected

Various boolean flags used to configure the application.

Definition at line 421 of file app.hpp.

◆ machine

StateMachine alib::app::App::machine
protected

The state-machine singleton.

Definition at line 369 of file app.hpp.

◆ releaseLogger

lox::textlogger::TextLogger* alib::app::App::releaseLogger =nullptr
protected

The release logger used by the application.

See also
Method onBsSetupALox.

Definition at line 418 of file app.hpp.

◆ releaseLoggerName

NString alib::app::App::releaseLoggerName ="RLOGGER"
protected

This will be the name of the release logger attached to the release Lox. The name defaults to "RLOGGER" and may be changed prior to the call to the method onBsSetupALox.

Definition at line 410 of file app.hpp.

◆ releaseLox

lox::Lox* alib::app::App::releaseLox =nullptr
protected

The release Lox used by the application.

See also
Method onBsSetupALox.

Definition at line 414 of file app.hpp.

◆ releaseLoxName

NString alib::app::App::releaseLoxName ="RLOX"
protected

This will be the name of the release Lox. The name defaults to "RLOX" and may be changed prior to the call to the method onBsSetupALox.

Definition at line 405 of file app.hpp.

◆ stopWatch

StopWatch alib::app::App::stopWatch
protected

A stop-watch usable for measuring performance of different steps of an application. Time is taken in the constructor.

Definition at line 373 of file app.hpp.

Constructor(s) / Destructor Details:

◆ App()

alib::app::App::App ( )
protected

Constructor. Initializes this app. Mainly by filling the vector StateMachine::Program with all states found in the enumeration States along with the corresponding virtual methods.

Definition at line 6 of file app.cpp.

◆ ~App()

alib::app::App::~App ( )
protectedvirtual

Virtual destructor.

Definition at line 43 of file app.cpp.

Here is the call graph for this function:

Method Details:

◆ exceptionDisplay()

void alib::app::App::exceptionDisplay ( alib::Exception & exception,
AString & target )
virtual

Writes exception information to std::cerr
.

Parameters
exceptionThe exception that was thrown.
targetThe target string to write into. An option is to pass cErr->Buffer here. Of course a custom buffer might be passed, i.e. if the text is to be logged with ALox.

Definition at line 158 of file app.cpp.

Here is the call graph for this function:

◆ exceptionToExitCode()

alib::Enum alib::app::App::exceptionToExitCode ( alib::Exception & exception)
virtual

Translates exceptions to exit-codes of the application. Implementations should call this method first and, if necessary, perform their own conversions then. If they do so, they should check whether this default version returned ErrUnknown, perform their own translation in that case, and probably debug-assert on failure.

Parameters
exceptionThe exception that was thrown.
Returns
The exit-code resulting from the given exception. Unknown exceptions are translated to BuiltInExitCodes::ErrUnknown.

Definition at line 131 of file app.cpp.

Here is the call graph for this function:

◆ exitWithHelpOutput()

void alib::app::App::exitWithHelpOutput ( Enum exitCode,
const String & helpTopic = NULL_STRING,
Box formatParam1 = EMPTY_STRING,
Box formatParam2 = EMPTY_STRING )
virtual

Used when errors are detected. May be overwritten, for example, to suppress help output and/or otherwise change the standard behavior. This default implementation

Definition at line 636 of file app.cpp.

Here is the call graph for this function:

◆ getConfigFilePaths()

void alib::app::App::getConfigFilePaths ( StdVectorMA< ConfigFileDescriptor > & files)
virtual

This default implementation first calls getConfigFilePathsFromCLIParam and, if this is unsuccessful, the method getConfigFilePathsFromResources. Then, method getConfigFilePathsMakeAbsolutePaths is called.
CLI arguments may affect which configuration files are considered. Descendants can override getConfigFilePathsFromCLIParam to implement their own CLI-based selection strategy before resource-defined defaults are completed.

Parameters
filesA pointer to an object of type StdVectorMA<ConfigFileDescriptor> that is to be filled by this method.

Definition at line 308 of file app.cpp.

Here is the call graph for this function:

◆ getConfigFilePathsFromCLIParam()

void alib::app::App::getConfigFilePathsFromCLIParam ( StdVectorMA< ConfigFileDescriptor > & files)
virtual

Adds configuration file paths influenced by a dedicated CLI parameter. The default implementation interprets option "--config" and updates or appends corresponding ConfigFileDescriptor entries in files. Descendants may override this to parse different CLI options or search paths.

Parameters
filesOutput vector to append file descriptors to.

Definition at line 286 of file app.cpp.

Here is the call graph for this function:

◆ getConfigFilePathsFromResources()

void alib::app::App::getConfigFilePathsFromResources ( StdVectorMA< ConfigFileDescriptor > & files)
virtual

If the given vector files is empty, this method tries resources named "CFGF_NAME_1", "CFGF_NAME_2", "CFGF_NAME_3" and so forth until a first name is not found. For all names found, an entry in vector files is created.

Then, for each entry in the vector (regardless if they were preexisting or created with this method), comment information is loaded from resources. The resource name is composed from "CFGF_CMT_" and the number of the entry. If found, the resource is assigned to the field String Comment.

Then for each entry resources named "CFGF_EXP_" and the amount of the entry are searched. If found, the field String Exports is set. If more resources (with higher numbers) are existing, such additional exports are appended to the list of the last config file entry.

Parameters
filesThe vector of file paths that is to be filled or modified by this method.

Definition at line 209 of file app.cpp.

Here is the call graph for this function:

◆ getConfigFilePathsMakeAbsolutePaths()

void alib::app::App::getConfigFilePathsMakeAbsolutePaths ( StdVectorMA< ConfigFileDescriptor > & files)
virtual

Checks all filenames in the given vector and converts them to an absolute path.

Parameters
filesThe vector of file paths that is to be modified by this method.

Definition at line 269 of file app.cpp.

Here is the call graph for this function:

◆ GetInfo()

String alib::app::App::GetInfo ( )
inline

Returns the version of this application. This default implementation returns the field appVersion.

Returns
A usually multi-line string containing information about this application.

Definition at line 490 of file app.hpp.

◆ GetName()

String alib::app::App::GetName ( )
inline

Returns the name of this application. This default implementation returns the field appName. This is not necessarily equal to the process module name which can be received with ProcessInfo::Current().ExecFileName.

Returns
This application's name.

Definition at line 480 of file app.hpp.

◆ GetRLogger()

virtual lox::textlogger::TextLogger * alib::app::App::GetRLogger ( )
inlinevirtual

Has to return the Logger instance used with release-logging.

Returns
This implementation returns field releaseLogger.

Definition at line 473 of file app.hpp.

◆ GetRLox()

virtual lox::Lox * alib::app::App::GetRLox ( )
inlinevirtual

Has to return the Lox instance used with release-logging.

Returns
This implementation returns field releaseLox.

Definition at line 469 of file app.hpp.

◆ GetVersion()

String alib::app::App::GetVersion ( )
inline

Returns the version of this application. This default implementation returns the field appVersion.

Returns
A string containing version information of this application.

Definition at line 485 of file app.hpp.

◆ Main()

int alib::app::App::Main ( int argc,
const char ** argv,
const wchar_t ** argvw = nullptr )
virtual

Stores cli-parameters and executes this app.

Parameters
argcThe number of command-line arguments.
argvList of command-line arguments, given as single byte character strings.
argvwThe CLI arguments on platforms that use wide command-line strings. Defaults to nullptr. If given, parameter argv has to be nulled.
Returns
The exit code to be returned by C/C++ main().

Definition at line 45 of file app.cpp.

Here is the call graph for this function:

◆ onBsCLIDefine()

void alib::app::App::onBsCLIDefine ( )
virtual

Define CLI commands, options, parameters, and exit-codes. This default implementation initializes field cli with APP and registers the built-in declarations defined by the enum types Commands, Options, Parameters and ExitCodes.

Definition at line 355 of file app.cpp.

Here is the call graph for this function:

◆ onBsCLIReadOptions()

void alib::app::App::onBsCLIReadOptions ( )
virtual

Implements CLIReadOptions: calls virtual void ReadOptions()  on member cli. This is done quite early in the boot sequence to allow option '–config' to change the configuration files used.

Definition at line 363 of file app.cpp.

Here is the call graph for this function:

◆ onBsConfigureCLI()

void alib::app::App::onBsConfigureCLI ( )
virtual

Finalizes CLI after configuration import. The default implementation forwards ignored option arguments to the CLIVariablesPlugin and installs the default shortcut categories ALIB and ALOX.

Definition at line 365 of file app.cpp.

Here is the call graph for this function:

◆ onBsFinalizeBootstrap()

void alib::app::App::onBsFinalizeBootstrap ( )
virtual

Called on transition to state FinalizeBootstrap.
This default implementation just calls the function alib::Bootstrap passing BootstrapPhases::Final as the parameter.

Definition at line 401 of file app.cpp.

Here is the call graph for this function:

◆ onBsImportConfig()

void alib::app::App::onBsImportConfig ( )
virtual

Called on transition to state ImportConfig.
This default implementation creates the vector of file descriptors using getConfigFilePaths and then uses type IniFileFeeder to import the variables from the INI-files.

Definition at line 377 of file app.cpp.

Here is the call graph for this function:

◆ onBsPreloadVariables()

void alib::app::App::onBsPreloadVariables ( )
virtual

Called on transition to state PreloadVariables.
Preloading variables allows later fetching and exporting those variables into a configuration file (if freshly created), even if they have not been read/used in the first run of an application.
This default implementation calls void PreloadVariables()  on the variables found with the enumeration Variables.

Definition at line 353 of file app.cpp.

Here is the call graph for this function:

◆ onBsPrepareConfig()

void alib::app::App::onBsPrepareConfig ( )
virtual

Called on transition to state PrepareConfig.
This default implementation just calls the function alib::Bootstrap passing BootstrapPhases::PrepareConfig as the parameter.

Definition at line 351 of file app.cpp.

Here is the call graph for this function:

◆ onBsPrepareResources()

void alib::app::App::onBsPrepareResources ( )
virtual

Called on transition to state PrepareResources.
This default implementation

Definition at line 320 of file app.cpp.

Here is the call graph for this function:

◆ onBsReadDryRunOption()

void alib::app::App::onBsReadDryRunOption ( )
virtual

Implements ReadDryRunOption. Reads the option "--dryrun[=yes|no]" from the CLI and sets the flag dryrun accordingly. The optional argument is parsed as a lang::Bool and hence may be specified with various words, defined with the according resources.

Definition at line 403 of file app.cpp.

Here is the call graph for this function:

◆ onBsSetCamps()

void alib::app::App::onBsSetCamps ( )
virtual

Called on transition to state SetCamps.
This default implementation just calls the alib::BootstrapAddDefaultCamps.

Definition at line 318 of file app.cpp.

Here is the call graph for this function:

◆ onBsSetNameVersionAndInfo()

void alib::app::App::onBsSetNameVersionAndInfo ( )
virtual

Called on transition to state SetNameVersionAndInfo.
This default implementation tries resources "AppName", "AppVersion", and "AppInfo" to set fields appName, appVersion, and appInfo. The latter is supported with three placeholders: the name, the version, and the current year and is created using the method Paragraphs & AddMarked(const BoxedObjects& ...) .

A string that is set before this method is called, is not replaced.

Definition at line 335 of file app.cpp.

Here is the call graph for this function:

◆ onBsSetupALox()

void alib::app::App::onBsSetupALox ( )
virtual

Called on transition to state SetupALox.
If this method returns an error, bootstrapping is aborted. This default implementation interprets the flags CreateReleaseLox and UseReleaseLoggerForDebugLogging, and furthermore uses the fields releaseLoxName and releaseLoggerName into account and potentially creates releaseLox and releaseLogger.

Definition at line 416 of file app.cpp.

Here is the call graph for this function:

◆ onRun()

void alib::app::App::onRun ( )
virtual

This is the main execution method of the application. This default implementation processes CLI commands until cliStop is set or all commands are consumed and dispatches each recognized command to processCLICmd.

Definition at line 594 of file app.cpp.

Here is the call graph for this function:

◆ onRunEnd()

void alib::app::App::onRunEnd ( )
virtual

This method is following the main execution method onRun. Overwriting this method is useful to collect code which has to be executed at the end of all (or most) execution paths of the custom implementation of onRun.

Definition at line 624 of file app.cpp.

Here is the call graph for this function:

◆ onRunStart()

void alib::app::App::onRunStart ( )
virtual

This method is preceding the main execution method onRun. When this is called, all bootstrapping is done. Final preparations might be performed here to unclutter onRun.

This default implementation

  • Tries resource "AppStart". If found its content is printed to the console using method AddMarked together with the results of the methods GetName and GetVersion. Hence the resourced application info has to have two placeholders for these values.
  • Tests flag dryrun. If set, tries resource DryRunStart and prints it to the console. Again the result of the method GetName is passed as a placeholder parameter.
  • Tests if the built-in Option "Help" was given. If so, calls GetHelp and stops processing.
  • Tests if the built-in Option "Version" was given. If so, prints the result of GetVersion and stops processing.

Definition at line 561 of file app.cpp.

Here is the call graph for this function:

◆ onSdAnnounceShutdown()

void alib::app::App::onSdAnnounceShutdown ( )
virtual

Called on transition to state AnnounceShutdown.
This default implementation just calls the function alib::Shutdown passing ShutdownPhases::Announce as the parameter.

Definition at line 439 of file app.cpp.

Here is the call graph for this function:

◆ onSdCleanALox()

void alib::app::App::onSdCleanALox ( )
virtual

Called on transition to state CleanALox.
This default implementation checks the flags ALoxVerbosityExportAllAndWriteBackRelLogger, and ALoxVerbosityExportAllAndWriteBackDbgLogger and calls SetVerbosityExport if set.
Then, if set, the release logger and Lox are deleted.

Definition at line 442 of file app.cpp.

Here is the call graph for this function:

◆ onSdExportConfig()

void alib::app::App::onSdExportConfig ( )
virtual

Called on transition to state ExportConfig.
This default implementation creates the vector of file descriptors using getConfigFilePaths and then uses type IniFileFeeder to export variables that are either not existing yet, or which have a writeback flag set, into the INI-files.
This is done for all variables (and variable trees) determined by the field String Exports.

Definition at line 461 of file app.cpp.

Here is the call graph for this function:

◆ onSdFinalizeShutdown()

void alib::app::App::onSdFinalizeShutdown ( )
virtual

Called on transition to state FinalizeShutdown.
This default implementation calls the function alib::Shutdown passing ShutdownPhases::Destruct as the parameter.
Prior to that, some memory cleaning and debug exercises are done.

Definition at line 530 of file app.cpp.

Here is the call graph for this function:

◆ onSdOutput()

void alib::app::App::onSdOutput ( )
virtual

Flushes what is collected in the fields cOut and cErr to their respective streams and clears the buffers. With that, this method - while named with the prefix onSd and scheduled at the end of the StateMachine::Program - may be directly called by descendants whenever they wish to flush the current collected output stream, for example, after important milestones, before long-running operations, or prior to program termination when early partial output is desired.

Definition at line 510 of file app.cpp.

Here is the call graph for this function:

◆ printConfigFileInfo()

void alib::app::App::printConfigFileInfo ( Paragraphs & target)
virtual

Writes configuration file information into the given target.

Parameters
targetThe target to write into. The common option is to pass cOut here.

Definition at line 188 of file app.cpp.

Here is the call graph for this function:

◆ processCLICmd()

bool alib::app::App::processCLICmd ( Command * cmd)
virtual

Processes a single parsed CLI command. The default implementation handles the built-in Commands.

Parameters
cmdThe command to execute.
Returns
true if the command was handled successfully; false to indicate that the command was not recognized or could not be executed. Implementations may set cliStop to terminate further processing.

Definition at line 645 of file app.cpp.

Here is the call graph for this function:

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