Invocation: setup preliminary engine-context
* decision how to provide a default service for tests while also allow for configuration of more specific services * as starting point for the prototype: use the `TrackingHeapBlockProvider` (simply because this is the only implementation available and tested)
This commit is contained in:
parent
4a83f97c9e
commit
bb9d0107cd
5 changed files with 126 additions and 54 deletions
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
|
||||
#include "steam/engine/engine-ctx-facilities.hpp"
|
||||
#include "steam/engine/tracking-heap-block-provider.hpp"
|
||||
|
||||
//#include <string>
|
||||
//#include <memory>
|
||||
|
|
@ -42,14 +43,12 @@ namespace engine{
|
|||
// using lumiera::Subsys;
|
||||
// using std::function;
|
||||
// using std::bind;
|
||||
using std::make_unique;
|
||||
// using std::ref;
|
||||
|
||||
|
||||
namespace { // hidden local details of the service implementation....
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Temp Placeholder
|
||||
BufferProvider* kabooom{nullptr};
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Temp Placeholder
|
||||
} // (End) hidden service impl details
|
||||
|
||||
|
||||
|
|
@ -63,8 +62,16 @@ namespace engine{
|
|||
|
||||
/** */
|
||||
EngineCtx::EngineCtx()
|
||||
: mem{*kabooom}
|
||||
, cache{*kabooom}
|
||||
: services_{make_unique<Facilities>()}
|
||||
, mem {services_->getMemProvider()}
|
||||
, cache{services_->getCacheProvider()}
|
||||
{ }
|
||||
|
||||
|
||||
/** */
|
||||
EngineCtx::Facilities::Facilities()
|
||||
: memProvider_{make_unique<TrackingHeapBlockProvider>()} ////////////////////////////////////////TICKET #1367 : only suitable for first prototype
|
||||
, cacheProvider_{}
|
||||
{ }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,21 +39,42 @@
|
|||
|
||||
|
||||
#include "steam/engine/engine-ctx.hpp"
|
||||
#include "steam/engine/buffer-provider.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
|
||||
//#include <utility>
|
||||
//#include <memory>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace steam {
|
||||
namespace engine {
|
||||
|
||||
// using lib::Literal;
|
||||
// using std::unique_ptr;
|
||||
using std::unique_ptr;
|
||||
// using std::forward;
|
||||
|
||||
class EngineCtx::Facilities
|
||||
: util::NonCopyable
|
||||
{
|
||||
unique_ptr<BufferProvider> memProvider_;
|
||||
unique_ptr<BufferProvider> cacheProvider_;
|
||||
|
||||
public:
|
||||
Facilities();
|
||||
|
||||
BufferProvider&
|
||||
getMemProvider()
|
||||
{
|
||||
REQUIRE (memProvider_);
|
||||
return *memProvider_;
|
||||
}
|
||||
|
||||
BufferProvider&
|
||||
getCacheProvider()
|
||||
{
|
||||
return cacheProvider_? *cacheProvider_
|
||||
: *memProvider_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#include "lib/nocopy.hpp"
|
||||
|
||||
//#include <utility>
|
||||
//#include <memory>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace steam {
|
||||
|
|
@ -59,13 +59,14 @@ namespace engine {
|
|||
class EngineCtx
|
||||
: util::NonCopyable
|
||||
{
|
||||
class Facilities;
|
||||
std::unique_ptr<Facilities> services_;
|
||||
|
||||
public:
|
||||
BufferProvider& mem;
|
||||
BufferProvider& cache;
|
||||
// BufferProvider& output; /////////////////////////OOO presumably no longer necessary
|
||||
|
||||
class Facilities;
|
||||
|
||||
static lib::Depend<EngineCtx> access;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ namespace engine {
|
|||
|
||||
using std::forward;
|
||||
using lib::Several;
|
||||
using lib::Depend;
|
||||
|
||||
|
||||
namespace {// Introspection helpers....
|
||||
|
|
@ -230,13 +231,7 @@ namespace engine {
|
|||
|
||||
uint resultSlot{0};
|
||||
|
||||
struct ServiceCtx
|
||||
{
|
||||
ProviderRef mem;
|
||||
ProviderRef cache;
|
||||
ProviderRef output;
|
||||
};
|
||||
ServiceCtx ctx; //////////////////////////////////////////OOO need to wire that top-down through all builders!
|
||||
Depend<EngineCtx> ctx;
|
||||
|
||||
FUN fun_;
|
||||
|
||||
|
|
@ -294,7 +289,7 @@ namespace engine {
|
|||
maybeFillDefaultProviders (size_t maxSlots)
|
||||
{
|
||||
for (uint i=providers.size(); i < maxSlots; ++i)
|
||||
providers.emplace_back (ctx.mem);
|
||||
providers.emplace_back (ctx().mem);
|
||||
}
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : (End)Prototyping: how to assemble a Turnout
|
||||
|
|
|
|||
|
|
@ -7800,9 +7800,7 @@
|
|||
</node>
|
||||
<node CREATED="1509323537479" ID="ID_1638614197" MODIFIED="1576282358126" TEXT="und trotzedm einen Anker finden">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
nämlich wenn der Pfad mit einem explizit gegebenen Präfix anfängt,
|
||||
|
|
@ -7815,9 +7813,7 @@
|
|||
</node>
|
||||
<node CREATED="1509323760466" ID="ID_446881733" MODIFIED="1576282358125" TEXT="oder eben doch komplett im Widerspruch zum UI stehen">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
beispielsweise
|
||||
|
|
@ -7847,9 +7843,7 @@
|
|||
</node>
|
||||
<node CREATED="1515209459887" ID="ID_1673897385" MODIFIED="1515209521230">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
letzten Endes war es nahezu gleich schwer zu implementieren,
|
||||
|
|
@ -7888,9 +7882,7 @@
|
|||
<node CREATED="1514329041046" ID="ID_880415056" MODIFIED="1514329055544" TEXT="das Fenster mit Fokus"/>
|
||||
<node CREATED="1514329066515" ID="ID_1719764918" MODIFIED="1514329080026">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
wo der <i>Spot</i> ist
|
||||
|
|
@ -7962,9 +7954,7 @@
|
|||
</node>
|
||||
<node CREATED="1508540153564" ID="ID_165161640" MODIFIED="1576282358123" TEXT="UI stabil während der Auswertung">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
die Topologie, aber auch der Fokus-Zustand
|
||||
|
|
@ -8402,9 +8392,7 @@
|
|||
</node>
|
||||
<node CREATED="1510342763622" ID="ID_1851343313" MODIFIED="1510357653178">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
das <i>Fortschreiten der Berechnung</i> dargestellt werden kann
|
||||
|
|
@ -8865,9 +8853,7 @@
|
|||
<node CREATED="1511482254927" ID="ID_1687625403" MODIFIED="1511482263673" TEXT="zwar funktionieren die Positiv-Fälle"/>
|
||||
<node CREATED="1511482264405" ID="ID_1003171577" MODIFIED="1511482304307">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
aber eine falsche Template-Instantiierung
|
||||
|
|
@ -10471,9 +10457,7 @@
|
|||
<node CREATED="1512276512313" ID="ID_725756500" MODIFIED="1512276517860" TEXT="sollte theoretisch möglich sein"/>
|
||||
<node CREATED="1512276524111" ID="ID_453994757" MODIFIED="1512276583587" TEXT="nicht sonderlich sinnvoll">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...weil man den konkreten Typ der Core kennen muß
|
||||
|
|
@ -12891,9 +12875,7 @@
|
|||
</node>
|
||||
<node CREATED="1517011727918" ID="ID_1678474222" MODIFIED="1518487921067" TEXT="und man daher typischerweise diese in der Spec weglassen möchte">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...weil die Perspektive eigentlich als <i>etwas Orthogonales</i> empfunden wird,
|
||||
|
|
@ -16968,9 +16950,7 @@
|
|||
</node>
|
||||
<node CREATED="1504193112577" ID="ID_1851236797" MODIFIED="1518487921076">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Problem: Zusammenarbeit
|
||||
|
|
@ -88597,8 +88577,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
nein! jetzt direkt im Aufruf gelöst
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -88623,8 +88602,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
ja: ist problematisch — und genau deshalb ziehe ich jetzt vor, den Output-Buffer direkt über den Aufruf bereitzustellen; dieser Aspekt spielt damit für das Thema Dependency-Injection keine Rolle mehr
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1721866589257" ID="ID_1094487880" MODIFIED="1721866862199" TEXT="dieser muß allerdings einen konkreten Bezug herstellen">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
|
|
@ -89146,8 +89124,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
...es ist zwar gut, daß es das LocalTag gibt, aber für diesen Fall ist das eine unsinnige Trickserei; es ist viel besser, an der einzigen Stelle, wo das benötigt wird (nämlich auf top-Level) explizit eine Flag zu setzen und dann den Buffer zu entnehmen
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -89221,11 +89198,82 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1728655382477" ID="ID_980783783" MODIFIED="1728658107738" TEXT="Implementierung: engine-ctx-facilities.hpp|cpp">
|
||||
<linktarget COLOR="#496d98" DESTINATION="ID_980783783" ENDARROW="Default" ENDINCLINATION="-1507;-94;" ID="Arrow_ID_11368875" SOURCE="ID_1763878258" STARTARROW="None" STARTINCLINATION="392;28;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1728693835349" ID="ID_230574401" MODIFIED="1728693848579" TEXT="notwendige Indirektionen">
|
||||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1728693865111" ID="ID_146540757" MODIFIED="1728693889489" TEXT="Zugang zum Service Front-End">
|
||||
<node CREATED="1728693890889" ID="ID_1377860301" MODIFIED="1728694011138" TEXT="Einschränkung Lebenszyklus">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Die Indirektion ist nur notwendig, wenn es einen für den Benutzer sichtbaren Lebenszyklus-Zustand gibt; andernfalls gilt es lediglich als Service-Konfiguration und der Client kann sich direkte Referenzen für die verwendeten Services ziehen
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1728694014136" ID="ID_1610313761" MODIFIED="1728694227860" TEXT="hier für die Render-Engine nicht relevant">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Denn nicht die Render-Engine hat einen Lebenszyklus, sondern das Core-System; die Abhängikeiten kaskadieren ausgehend von der Subsystem-Facade. Das bedeutet, sofern man überhaupt Zugang zu einer Core-Engine hat, ist diese bereits fertig konfiguriert und bleibt auch so; ein Austauschen oder Neustarten der Engine wird nicht vorgesehen. Mithin spielt diese Indirektion keine Rolle, denn die Verwendungen im low-level-Model können sich direkte Service-Referenzen ziehen; die Flexibilität wird lediglich für Applikations-Konfiguration und für das Testen benötigt
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1728694237226" ID="ID_1074546502" MODIFIED="1728695315658" TEXT="Verwendung von Buffer-Provider-Services">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
und zwar liegt die Indirektion hier in der VTable und ist damit bei jeder Verwendung wirksam
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1728658365910" ID="ID_831264983" MODIFIED="1728658406545" TEXT="brauche Lösung um die Referenz-Member direkt auf eine Service-Instanz zu binden">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node CREATED="1728693727040" ID="ID_1984464363" MODIFIED="1728693740863" TEXT="das muß im ctor der Front-End-Klasse passieren"/>
|
||||
<node CREATED="1728693742535" ID="ID_1839813547" MODIFIED="1728693761315" TEXT="damit kommt nur PImpl in Frage (oder eine kaskadierende Dependency-Injection)"/>
|
||||
<node CREATED="1728695861090" ID="ID_543427341" MODIFIED="1728695895231" TEXT="ist hier eigentlich gar nicht primär ein PImpl, sondern vor allem ein Ownership/Lifecycle-Manager"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1728658390507" ID="ID_1131398613" MODIFIED="1728658406545" TEXT="Implementierung vom default-ctor muß eine Dummy-Impl hochziehen">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node CREATED="1728695352771" ID="ID_1753340421" MODIFIED="1728695367613" TEXT="das könnte man über eine weitere Indirektion im Konstruktor steuern"/>
|
||||
<node CREATED="1728695368457" ID="ID_1634664636" MODIFIED="1728695377795" TEXT="aber ebenso auch durch aktive Konstruktor-Logik">
|
||||
<node CREATED="1728695774275" ID="ID_912276519" MODIFIED="1728695807050" TEXT="per DependInject<EngineCtx>::ServiceInstance<>"/>
|
||||
<node CREATED="1728695808230" ID="ID_1070819733" MODIFIED="1728695840662" TEXT="der ctor von ServiceInstance nimmt Argumente und reicht sie durch"/>
|
||||
</node>
|
||||
<node CREATED="1728695380639" ID="ID_316258039" MODIFIED="1728695427345" TEXT="letzteres ist vorzuziehen">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
da es offensichtlicher ist, und zwischen Konstruktor und den von diesem erzeugten Services keine architektonische Trennung besteht
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1728698362232" ID="ID_168809063" MODIFIED="1728698391507" TEXT="brauche BufferProvider-Implementierungen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1728698375295" ID="ID_651594718" MODIFIED="1728698388203" TEXT="für den ersten Prototyp: TrackingHeapBlockProvider verwenden">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1728698395052" ID="ID_644301781" MODIFIED="1728698427892" TEXT="weil der schon implementiert und getestet ist">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#f8f1cb" COLOR="#a50125" CREATED="1728698406902" ID="ID_1133528178" MODIFIED="1728698424977" TEXT="verschwendet Speicher — keine Lösung auf Dauer">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1728698877565" ID="ID_211834061" MODIFIED="1728698892557" TEXT="Cache-Provider fällt automatisch auf den MemoryProvider zurück">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue