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

Description:

This struct is used a single time with the member machine and comprises all fields associated with the state of the application and the execution of the 'program'.

Definition at line 151 of file app.inl.

Inner Type Index:

struct  Command
 A struct denoting the next state and the corresponding method to execute. More...
struct  CommandList

Public Field Index:

States BuiltInState =States::NOT_STARTED
bool EmergencyStop =false
CommandList Program
 The list of commands to execute.
Enum State =States::NOT_STARTED

Public Method Index:

void DbgDumpFurtherExitCodes (AString &target)
Enum GetExitCode ()
void SetExitCode (Enum pExitCode)

Protected Field Index:

std::vector< EnumdbgFurtherExitCodes
Enum exitCode =BuiltInExitCodes::OK
 The exit code. Only the first set is stored and returned later.

Field Details:

◆ BuiltInState

States alib::app::App::StateMachine::BuiltInState =States::NOT_STARTED

The current state in respect to the built-in program commands. Note that this is not of type Enum, but uses the original C++ enum type. Consequently, this is only updated when a built-in command is processed. With that, methods may check for a more general state without getting "confused" by custom insertions which often are not relevant for the decision-making.

Definition at line 289 of file app.inl.

◆ dbgFurtherExitCodes

std::vector<Enum> alib::app::App::StateMachine::dbgFurtherExitCodes
protected

This vector collects exit codes which are not used, as they got set after a first code was given. This field is available in debug-compilations only.

Definition at line 276 of file app.inl.

◆ EmergencyStop

bool alib::app::App::StateMachine::EmergencyStop =false

Emergency stopper. As soon as this gets set, the execution of the application will stop. The only thing that is still performed is the standard ALib shutdown procedure, but not the shutdown procedure defined by this app (or its derived type). I.e., no configuration files are written.

Definition at line 299 of file app.inl.

◆ exitCode

Enum alib::app::App::StateMachine::exitCode =BuiltInExitCodes::OK
protected

The exit code. Only the first set is stored and returned later.

Definition at line 271 of file app.inl.

◆ Program

CommandList alib::app::App::StateMachine::Program

The list of commands to execute.

Definition at line 282 of file app.inl.

◆ State

Enum alib::app::App::StateMachine::State =States::NOT_STARTED

The current state. Either a built-in state enumeration or a custom one.

See also
Field BuiltInState, which is more appropriate to use in most cases.

Definition at line 293 of file app.inl.

Method Details:

◆ DbgDumpFurtherExitCodes()

void alib::app::App::StateMachine::DbgDumpFurtherExitCodes ( AString & target)
inline

Writes exit codes not respected by the method SetExitCode (because an earlier code was already set) to the target string. Then clears the debug-field dbgFurtherExitCodes. This method is called by the default implementations of the methods exceptionDisplay and onSdOutput
. In release-builds, this method is pruned.

Parameters
targetThe target string.

Definition at line 333 of file app.inl.

◆ GetExitCode()

Enum alib::app::App::StateMachine::GetExitCode ( )
inline

Returns this applications' cli-exit code (the result of the method main()).

Returns
The first value given with SetExitCode.

Definition at line 324 of file app.inl.

◆ SetExitCode()

void alib::app::App::StateMachine::SetExitCode ( Enum pExitCode)
inline

Sets this applications' cli-exit code (the result of the method main()). If the given pExitCode's integral value is 0, nothing is done.

Only the value of the first call is used. Later calls will not overwrite the first given value. In debug-builds, the method DbgDumpFurtherExitCodes may be used to display later given codes, what the default implementation of the method virtual void onSdFinalizeShutdown()  does.

Parameters
pExitCodeThe exit code to set.

Definition at line 310 of file app.inl.


The documentation for this struct was generated from the following file: