Invocation: further condense the allocator-selector definition
After applying all the preceding refactorings, it turns out that the `DataBuilder` defined here ''is essentially `lib::SeveralBuilder`'', only with a different arrangement of the type parameters, due to the specific usage context here. It is thus possible to replace all the interim / helper / rebinding templates by simple templated typedefs. The only tangible difference is that for usage in the Builder, a ''selector policy'' is passed as a simple type argument, which in practice wires the concrete allocator information down into each sub-builder created during the ongoing construction of a node structure.
This commit is contained in:
parent
1705c40dc2
commit
352ef31ab0
2 changed files with 89 additions and 44 deletions
|
|
@ -110,21 +110,12 @@ namespace engine {
|
|||
namespace { // policy configuration for allocator
|
||||
|
||||
template<template<typename> class ALO =std::void_t, typename...INIT>
|
||||
struct AlloPolicySelector
|
||||
{
|
||||
using Setup = lib::allo::SetupSeveral<ALO,INIT...>;
|
||||
|
||||
template<class I, class E>
|
||||
using PolicyForAllo = typename Setup::template Policy<I,E>;
|
||||
|
||||
template<class I, class E=I>
|
||||
using BuilderType = lib::SeveralBuilder<I,E, PolicyForAllo>;
|
||||
};
|
||||
using AlloPolicySelector = lib::allo::SetupSeveral<ALO,INIT...>;
|
||||
|
||||
struct UseHeapAlloc
|
||||
{
|
||||
template<class I, class E=I>
|
||||
using BuilderType = lib::SeveralBuilder<I,E>;
|
||||
using Policy = lib::allo::HeapOwn<I,E>;
|
||||
};
|
||||
//
|
||||
}//(End) internal policy configuration
|
||||
|
|
@ -146,15 +137,7 @@ namespace engine {
|
|||
* \endcode
|
||||
*/
|
||||
template<class POL, class I, class E=I>
|
||||
class DataBuilder
|
||||
: public POL::template BuilderType<I,E>
|
||||
{
|
||||
public:
|
||||
template<typename...INIT>
|
||||
DataBuilder (INIT&& ...alloInit)
|
||||
: POL::template BuilderType<I,E>{forward<INIT> (alloInit)...}
|
||||
{ }
|
||||
};
|
||||
using DataBuilder = lib::SeveralBuilder<I,E, POL::template Policy>;
|
||||
|
||||
|
||||
template<class POL>
|
||||
|
|
|
|||
|
|
@ -3205,9 +3205,7 @@
|
|||
</node>
|
||||
<node CREATED="1538317544954" ID="ID_1154202054" MODIFIED="1538317573410">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
keines! Impl verwendet <b>strdup</b>()
|
||||
|
|
@ -3292,9 +3290,7 @@
|
|||
<node CREATED="1538321059074" FOLDED="true" ID="ID_1754741024" MODIFIED="1561827464646" TEXT="Vermutung: degeneriertes Subsystem">
|
||||
<node CREATED="1538321102148" ID="ID_862751524" MODIFIED="1538321102148">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...welches keinen separaten Thread aufruft....?
|
||||
|
|
@ -3315,9 +3311,7 @@
|
|||
</node>
|
||||
<node CREATED="1538320933291" ID="ID_573672353" MODIFIED="1538320975419" TEXT="removeall auf Collection, die grade iteriert wird">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
nämlich im shutdownAll() weiter oben im Stack
|
||||
|
|
@ -3566,9 +3560,7 @@
|
|||
<icon BUILTIN="yes"/>
|
||||
<node COLOR="#435e98" CREATED="1538440346730" ID="ID_1456330609" MODIFIED="1538440482615" TEXT="Fehler ist verschwunden">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
0000001028: INFO: proc-dispatcher.cpp:301: worker_2: processCommands: +++ dispatch Command("test_meta_markAction") {exec}
|
||||
|
|
@ -5445,9 +5437,7 @@
|
|||
</node>
|
||||
<node CREATED="1665350012213" ID="ID_1923573190" MODIFIED="1665363524296" TEXT="möglichst nur mit Transparenz arbeiten">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...damit das Icon in verschiedenstem Kontext gleichermaßen funktioniert
|
||||
|
|
@ -7467,9 +7457,7 @@
|
|||
</node>
|
||||
<node CREATED="1506263379070" HGAP="34" ID="ID_1755700140" MODIFIED="1518487921063" VSHIFT="28">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
wie funktioniert
|
||||
|
|
@ -10455,9 +10443,7 @@
|
|||
</html></richcontent>
|
||||
<node CREATED="1512358864343" FOLDED="true" ID="ID_1251747225" MODIFIED="1525124214828">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
ist das <font color="#9e1124">#190</font>
|
||||
|
|
@ -87731,7 +87717,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1721172918263" ID="ID_1614072808" MODIFIED="1721172930448" TEXT="die API-Methoden nehmen einen Bucket* ">
|
||||
<node CREATED="1721172938824" ID="ID_395287966" MODIFIED="1721172945553" TEXT="Bucket = ArrayBucket<I>"/>
|
||||
</node>
|
||||
<node CREATED="1721173008292" ID="ID_1183769323" MODIFIED="1721173026821" TEXT="weiteres Problem: die Stanard-Impl nimmt ein 3.Typargument (ALO)">
|
||||
<node CREATED="1721173008292" ID="ID_1183769323" MODIFIED="1721173026821" TEXT="weiteres Problem: die Standard-Impl nimmt ein 3.Typargument (ALO)">
|
||||
<node CREATED="1721173035609" ID="ID_420067425" MODIFIED="1721173043606" TEXT="AlocationPolicy<I,E,ALO>"/>
|
||||
<node CREATED="1721173048519" ID="ID_981820346" MODIFIED="1721173056258" TEXT="ALO ist selber wieder ein Template-Template"/>
|
||||
</node>
|
||||
|
|
@ -87758,8 +87744,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
es bieteten sich an: <font face="Monospaced" color="#5c1818">lib::several </font>und<font face="Monospaced" color="#5c1818"> lib::allo</font> ⟵ letzteres ist logischer!
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -87768,6 +87753,83 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<linktarget COLOR="#fefcc9" DESTINATION="ID_1620829594" ENDARROW="Default" ENDINCLINATION="-60;-64;" ID="Arrow_ID_864095772" SOURCE="ID_1312928828" STARTARROW="None" STARTINCLINATION="-82;4;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#c8c0b6" CREATED="1721693709675" ID="ID_936422168" MODIFIED="1721694100681">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
nach all den Vereinfachungen und Refactorings: das <i>ist</i> der <font face="Monospaced" color="#990428">ServeralBuilder</font><i>  selber</i>
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="forward"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1721693789066" ID="ID_1107287570" MODIFIED="1721693814879" TEXT="es gibt nur Unterschiede in der Anordnung der Typparameter">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
<node CREATED="1721693817542" ID="ID_1215694243" MODIFIED="1721693832113" TEXT="die aber für den jeweiligen Zweick adäquat sind">
|
||||
<node CREATED="1721693834500" ID="ID_577276695" MODIFIED="1721693869548" TEXT="ServeralBuilder : Typ E und POL sind meist defaulted"/>
|
||||
<node CREATED="1721693870778" ID="ID_1794117907" MODIFIED="1721693885537" TEXT="DataBuilder : POL ist zwingend, aber Typ E ist meist defaulted"/>
|
||||
</node>
|
||||
<node CREATED="1721693888045" ID="ID_1641203808" MODIFIED="1721694124331">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
<u>und wichtig</u>: hier ist noch eine Selector-Policy <i>darüber gesetzt</i>
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="forward"/>
|
||||
<node CREATED="1721693919577" ID="ID_1436146104" MODIFIED="1721693930500" TEXT="wir wollen hier einen Builder bauen"/>
|
||||
<node CREATED="1721693931207" ID="ID_1786424216" MODIFIED="1721693939626" TEXT="und diesem eine Policy durchgeben können"/>
|
||||
<node CREATED="1721693990680" ID="ID_350625208" MODIFIED="1721694027688">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
diese Policy ist ein <b>einfacher Typparameter</b>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<node CREATED="1721694029106" ID="ID_945915390" MODIFIED="1721694041669" TEXT="aber wir wollen hier den Umständen entsprechend"/>
|
||||
<node CREATED="1721694042489" ID="ID_1052228756" MODIFIED="1721694051165" TEXT="entweder ein HeapOwn einfügen">
|
||||
<node COLOR="#554398" CREATED="1721694135380" HGAP="69" ID="ID_1608024811" MODIFIED="1721694181414" TEXT="also z.B. NodeBuilder<UseHeapAlloc>" VSHIFT="5">
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1721694051920" ID="ID_544507369" MODIFIED="1721694060345" TEXT="oder ein Allocator-Selector-Template">
|
||||
<node COLOR="#554398" CREATED="1721694135380" HGAP="44" ID="ID_1439850410" MODIFIED="1721694256025" TEXT="also z.B. NodeBuilder<AllocatorPolicy>" VSHIFT="-3">
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
</node>
|
||||
<node COLOR="#554398" CREATED="1721694135380" HGAP="55" ID="ID_1248749188" MODIFIED="1721694536254">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
using AllocatorPolicy = AlloPolicySelector<<b><font color="#a12362">ALO</font></b>,<b><font color="#a12362">INIT</font></b>...>;
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
</node>
|
||||
<node COLOR="#554398" CREATED="1721694135380" HGAP="55" ID="ID_248020640" MODIFIED="1721694514913">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
⟶ withAllocator<<b><font color="#a12362">ALO</font></b>> (<b><font color="#a12362">INIT</font></b>&& ...)
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue