52 using std::unique_ptr;
61 log_and_clear_unexpected_errorstate ()
64 ALERT (common,
"*** Unexpected error: %s\n Triggering emergency exit.", errorstate);
94 return setup_.get(key).as<
string>();
104 #define _MAYBE_THROW_ \ 105 maybeThrow<error::Fatal> ("internal failure while initialising the "\ 106 "Lumiera application framework"); 113 TRACE (common,
"initialising application core...");
121 lumiera_config_interface_init ();
130 TRACE (common,
"Lumiera core started successfully.");
138 TRACE (common,
"maybe startup %s...?",
cStr(subsys));
139 REQUIRE (subsystems_);
140 subsystems_->maybeRun (subsys);
145 typedef AppState::ExitCode ExitCode;
165 emergency_ |= subsystems_->wait();
166 subsystems_.reset(0);
169 NOTICE (common,
"Shutting down Lumiera...");
173 ALERT (common,
"Triggering emergency exit...");
175 return CLEAN_EMERGENCY_EXIT;
190 ERROR (common,
"Aborting Lumiera after unhandled error: %s",
cStr(problem.
what()));
192 log_and_clear_unexpected_errorstate();
198 subsystems_->triggerEmergency(
true);
199 subsystems_->shutdownAll();
214 log_and_clear_unexpected_errorstate();
219 return FAILED_EMERGENCY_EXIT;
224 return CLEAN_EXIT_AFTER_ERROR;
241 TRACE (common,
"shutting down basic application layer...");
242 lumiera_config_interface_destroy ();
243 lumiera_interfaceregistry_destroy ();
247 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.