diff --git a/src/include/lifecycle.h b/src/include/lifecycle.h index ba21f3791..b5b223f0b 100644 --- a/src/include/lifecycle.h +++ b/src/include/lifecycle.h @@ -74,9 +74,6 @@ namespace lumiera { LifecycleHook (Symbol eventLabel, Hook callbackFun); - /** for chained calls (add multiple callbacks) */ - LifecycleHook& add (Hook callbackFun); - /** alternative, static interface for registering a callback */ static void add (Symbol eventLabel, Hook callbackFun); diff --git a/src/lib/lifecycleregistry.hpp b/src/lib/lifecycleregistry.hpp index 774fc726b..88f8b9f63 100644 --- a/src/lib/lifecycleregistry.hpp +++ b/src/lib/lifecycleregistry.hpp @@ -35,8 +35,8 @@ */ -#ifndef LUMIERA_LIFECYCLE_H -#define LUMIERA_LIFECYCLE_H +#ifndef LUMIERA_LIFECYCLEREGISTRY_H +#define LUMIERA_LIFECYCLEREGISTRY_H #include #include diff --git a/src/lumiera/appstate.cpp b/src/lumiera/appstate.cpp index 73e8285fa..4df6b743e 100644 --- a/src/lumiera/appstate.cpp +++ b/src/lumiera/appstate.cpp @@ -21,6 +21,7 @@ * *****************************************************/ +#include "include/lifecycle.h" #include "lumiera/appstate.hpp" #include "lib/lifecycleregistry.hpp" @@ -88,10 +89,10 @@ namespace lumiera { LifecycleHook::LifecycleHook (Symbol eventLabel, Callback callbackFun) { - this->add (eventLabel,callbackFun); + add (eventLabel,callbackFun); } - LifecycleHook& + void LifecycleHook::add (Symbol eventLabel, Callback callbackFun) { bool isNew = AppState::instance().lifecycleHooks_->enroll (eventLabel,callbackFun); @@ -100,7 +101,13 @@ namespace lumiera { callbackFun(); // when this code executes, // then per definition we are already post "basic init" // (which happens in the AppState ctor); thus fire it immediately - return *this; + } + + + void + trigger (Symbol eventLabel) + { + AppState::lifecycle (eventLabel); } diff --git a/tests/40components.tests b/tests/40components.tests index 6aeaa38e5..1736f92e9 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -172,9 +172,9 @@ out: caught lumiera::Error: LUMIERA_ERROR_EXTERNAL:failure in external service ( out: caught std::runtime_error: test-5 out: caught std::exception. (unspecific) out: intermediate handler caught: LUMIERA_ERROR_EXTERNAL:failure in external service (test-7).....will rethrow as error::State -out: caught lumiera::Error: LUMIERA_ERROR_STATE:unforseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service (test-7). +out: caught lumiera::Error: LUMIERA_ERROR_STATE:unforeseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service (test-7). out: intermediate handler caught: LUMIERA_ERROR_EXTERNAL:failure in external service (test-8).....will rethrow as error::State -out: 2nd intermediate handler caught: LUMIERA_ERROR_STATE:unforseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service (test-8).....will rethrow as error::Config +out: 2nd intermediate handler caught: LUMIERA_ERROR_STATE:unforeseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service (test-8).....will rethrow as error::Config out: caught lumiera::Error: LUMIERA_ERROR_CONFIG:misconfiguration -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service (test-8). END diff --git a/tests/common/mainsuite.cpp b/tests/common/mainsuite.cpp index 58024d645..562dc264c 100644 --- a/tests/common/mainsuite.cpp +++ b/tests/common/mainsuite.cpp @@ -24,6 +24,7 @@ #include "common/test/suite.hpp" #include "common/test/testoption.hpp" #include "lumiera/appstate.hpp" +#include "include/lifecycle.h" using lumiera::AppState; using lumiera::ON_GLOBAL_INIT;