From 4669260cd1d04916a89ada66b134f229ec08bc1f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 2 Apr 2018 02:20:54 +0200 Subject: [PATCH] Fix setup of the ConfigManager implementation ...still using the FAKE implementation, not a real rules engine. However, with the new Dependency-Injection framework we need to define the actual class from the service-provider, not from some service-client. This is more orthogonal, but we're forced to install a Lifecycle-Hook now, in order to get this configuration into the system prior to any use --- src/common/query/defs-manager-impl.hpp | 8 +- src/common/query/defs-manager.hpp | 2 +- src/lib/error-exception.cpp | 2 +- src/proc/config-resolver.cpp | 23 +++++ .../session/query/fake-configrules.hpp | 9 +- wiki/thinkPad.ichthyo.mm | 98 +++++++++++-------- 6 files changed, 90 insertions(+), 52 deletions(-) diff --git a/src/common/query/defs-manager-impl.hpp b/src/common/query/defs-manager-impl.hpp index a392f5b65..6e95796ef 100644 --- a/src/common/query/defs-manager-impl.hpp +++ b/src/common/query/defs-manager-impl.hpp @@ -46,8 +46,6 @@ #include "common/query/defs-manager.hpp" #include "common/query/defs-registry.hpp" #include "common/config-rules.hpp" -#include "proc/mobject/session/query/fake-configrules.hpp" -#include "lib/depend-inject.hpp" #include "lib/format-string.hpp" #include "lib/error.hpp" @@ -65,15 +63,11 @@ namespace query { /** initialise the most basic internal defaults. */ - DefsManager::DefsManager () throw() + DefsManager::DefsManager () noexcept : defsRegistry_(new DefsRegistry) { INFO (session, "Configure technical defaults of the session."); - // PLANNED: use an embedded Prolog-System or similar rules engine. - // For the time being, we use preconfigured fake answers for some common Config-Queries - lib::DependInject::useSingleton(); - } diff --git a/src/common/query/defs-manager.hpp b/src/common/query/defs-manager.hpp index cc9e55930..00bc7fd4a 100644 --- a/src/common/query/defs-manager.hpp +++ b/src/common/query/defs-manager.hpp @@ -142,7 +142,7 @@ namespace query { public: - DefsManager () throw(); + DefsManager () noexcept; ~DefsManager (); /** common access point: retrieve the default object fulfilling diff --git a/src/lib/error-exception.cpp b/src/lib/error-exception.cpp index 919af2322..a1e4c64ce 100644 --- a/src/lib/error-exception.cpp +++ b/src/lib/error-exception.cpp @@ -55,7 +55,7 @@ namespace lumiera { * @todo develop a framework to set more specific yet friendly messages */ inline const string - default_usermsg (Error* exception_obj) noexcept + default_usermsg (Error*) noexcept { return "Sorry, Lumiera encountered an internal error."; } diff --git a/src/proc/config-resolver.cpp b/src/proc/config-resolver.cpp index 12e341d9f..410c4b80f 100644 --- a/src/proc/config-resolver.cpp +++ b/src/proc/config-resolver.cpp @@ -30,11 +30,34 @@ #include "lib/error.hpp" +#include "include/lifecycle.h" #include "proc/config-resolver.hpp" +#include "proc/mobject/session/query/fake-configrules.hpp" +#include "lib/depend-inject.hpp" +using lumiera::LifecycleHook; +using lumiera::ON_GLOBAL_INIT; namespace proc { + namespace { + + /** + * Install the actual ConfigResolver implementation. + * The ConfigResolver answers queries about configuration and default configuration + * of various aspects of the session, based on configuration rules. + * @todo PLANNED: use an embedded Prolog-System or similar rules engine. + * For the time being (as of 2008-2018), + * we use preconfigured fake answers for some common Config-Queries + */ + void + configure_ConfigResolver() + { + lib::DependInject::useSingleton(); + } + + LifecycleHook schedule_ (ON_GLOBAL_INIT, &configure_ConfigResolver); + } /** Singleton factory instance, configured with the actual implementation type. diff --git a/src/proc/mobject/session/query/fake-configrules.hpp b/src/proc/mobject/session/query/fake-configrules.hpp index d00f33f86..868146c3e 100644 --- a/src/proc/mobject/session/query/fake-configrules.hpp +++ b/src/proc/mobject/session/query/fake-configrules.hpp @@ -48,6 +48,7 @@ #include "proc/mobject/session.hpp" #include "proc/config-resolver.hpp" +#include "lib/depend-inject.hpp" #include "lib/query-util.hpp" #include "lib/util.hpp" #include "lib/p.hpp" @@ -291,12 +292,12 @@ namespace session { protected: MockConfigRules (); ///< to be used only by the singleton factory friend class lib::DependencyFactory; - - virtual ~MockConfigRules() {} - + friend class lib::DependInject::Local; public: + virtual ~MockConfigRules() {} ///< extends the ConfigResolver interface - // TODO: implementation of any additional functions on the ConfigRules interface goes here + + /* === implementation of additional functions on the ConfigRules interface goes here === */ }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 8c69875a6..5146bebf2 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -4897,7 +4897,7 @@ - + @@ -27355,8 +27355,8 @@ - + @@ -27383,8 +27383,7 @@ daher muß sein dtor vor dem dtor von DependencyFactory laufen

- - +
@@ -27421,8 +27420,7 @@ Destruktoren gesequenced. Sollte passen.

- - +
@@ -28360,8 +28358,7 @@ daß re-entrant-Aufrufe während dem dtor erlaubt sind

- - +
@@ -28398,8 +28395,7 @@ kann und muß man das "durchwinken"

- - + @@ -28451,8 +28447,7 @@ Aber wie gesagt, das ganze Advice-System ist eine Skizze

- -
+
@@ -28512,11 +28507,12 @@ - + + - - + + @@ -28570,8 +28566,7 @@ Nicht einem, der in einem Meyer's Singleton steckt...

- - +
@@ -28581,24 +28576,54 @@ - + - + - - + + - - + + + + + + + + +

+ ...es ruft sich selbst rekursiv auf, via Depend<AdviceSystem> +

+ +
+
- - - - + + + + + + +

+ ...nämlich eine ganz spezielle, dedzierte Aufräum-Routine schreiben +

+ +
+
+ + + + + + + + + +
@@ -28644,7 +28669,7 @@
- + @@ -28710,8 +28735,7 @@ Und genau dafür gibt es anscheinend keine Garantieren

- - + @@ -28723,8 +28747,7 @@ C++ hällt die Erzeugungs/Zerstörungs-Reihenfolge exakt ein

- -
+
@@ -28736,8 +28759,7 @@ d.h. wenn das local static später erzeugt wird, wird es vor  dem Hauptobjekt zerstört

- -
+
@@ -28758,8 +28780,7 @@ Statische Initialisierung funktioniert präzise, korrekt und zuverlässig

- - +
@@ -28801,8 +28822,7 @@ Hallo ClassLock...

- -
+
@@ -29311,7 +29331,7 @@ - +