43 using std::unique_ptr;
52 log_and_clear_unexpected_errorstate ()
55 ALERT (common,
"*** Unexpected error: %s\n Triggering emergency exit.", errorstate);
85 return setup_.get(key).as<
string>();
95 #define _MAYBE_THROW_ \ 96 maybeThrow<error::Fatal> ("internal failure while initialising the "\ 97 "Lumiera application framework"); 104 TRACE (common,
"initialising application core...");
112 lumiera_config_interface_init ();
121 TRACE (common,
"Lumiera core started successfully.");
129 TRACE (common,
"maybe startup %s...?",
cStr(subsys));
130 REQUIRE (subsystems_);
131 subsystems_->maybeRun (subsys);
136 typedef AppState::ExitCode ExitCode;
156 emergency_ |= subsystems_->wait();
157 subsystems_.reset(0);
160 NOTICE (common,
"Shutting down Lumiera...");
164 ALERT (common,
"Triggering emergency exit...");
166 return CLEAN_EMERGENCY_EXIT;
181 ERROR (common,
"Aborting Lumiera after unhandled error: %s",
cStr(problem.
what()));
183 log_and_clear_unexpected_errorstate();
189 subsystems_->triggerEmergency(
true);
190 subsystems_->shutdownAll();
205 log_and_clear_unexpected_errorstate();
210 return FAILED_EMERGENCY_EXIT;
215 return CLEAN_EXIT_AFTER_ERROR;
232 TRACE (common,
"shutting down basic application layer...");
233 lumiera_config_interface_destroy ();
234 lumiera_interfaceregistry_destroy ();
238 log_and_clear_unexpected_errorstate();
ExitCode abort() noexcept
initiate an fatal emergency shutdown, caused by an unforeseen error condition
Dependencies and lifecycle of a partially independent Subsystem of the Application.
AppState()
perform initialisation triggered on first access.
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
int lumiera_plugin_register(LumieraPlugin plugin)
Register a plugin and its interfaces.
LumieraPlugin lumiera_plugin_load(const char *plugin)
Tries to load a plugin Creates a new plugin structure and tries to load and initialise the plugin...
~AppState()
anything which should be closed as late as possible and after the normal shutdown sequence can be pla...
const char * ON_GLOBAL_SHUTDOWN
to be triggered at the end of main()
Lumiera plugins define 'interfaces' as shown in interface.h, the plugin system handles the loading of...
#define LUMIERA_LOCATION_OF_BOOTSTRAP_INI
"bootstrapIni" : the basic setup configuration to load
inline string literal This is a marker type to indicate that
virtual CStr what() const noexcept override
std::exception interface : yield a diagnostic message
Frontend for handling the Lumiera application commandline arguments.
Access point to singletons and other kinds of dependencies designated by type.
static void trigger(Symbol eventLabel)
trigger lifecycle callbacks registered under the given label
void maybeStart(lumiera::Subsys &)
building on the state determined by init, decide if the given Subsys needs to be pulled up and...
Lumiera interface macros and structures.
Marker types to indicate a literal string and a Symbol.
Implementation helper for managing execution of a collection of subsystems, which may depend on one a...
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
int lumiera_plugin_discover(LumieraPlugin(*callback_load)(const char *plugin), int(*callback_register)(LumieraPlugin))
discover new plugins traverses the configured plugin paths and calls the callback_load function for a...
lumiera_err lumiera_error(void)
Get and clear current error state.
const char * ON_GLOBAL_INIT
to be triggered in main()
void init(lumiera::Option &options)
evaluate the result of option parsing and maybe additional configuration such as to be able to determ...
void lumiera_interfaceregistry_init(void)
Initialise the interface registry.
Lumiera error handling (C++ interface).
Global registry for interfaces (extension points).
ExitCode maybeWait()
put the main thread of the application into a wait state, as long as some subsystem(s) registered wit...
string fetchSetupValue(lib::Literal key)
access basic application setup values (from setup.ini)
Registering and managing primary application-global services.
Manage execution of the independent Subsystems of the Lumiera application.
External interface to the lumiera configuration system.
Lumiera public interface.
static lib::Depend< AppState > instance
get the (single) AppState instance.
const char * ON_EMERGENCY
activated on shutdown after premature failure of a subsystem
Interface and Base definition for all Lumiera Exceptions.