Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
turnout.hpp
Go to the documentation of this file.
1/*
2 TURNOUT.hpp - Fixed standard scheme to generate data within a Render Node
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6 2024, Hermann Vosseler <Ichthyostega@web.de>
7
8  **Lumiera** is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by the
10  Free Software Foundation; either version 2 of the License, or (at your
11  option) any later version. See the file COPYING for further details.
12
13*/
14
15
54#ifndef STEAM_ENGINE_TURNOUT_H
55#define STEAM_ENGINE_TURNOUT_H
56
57#include "steam/common.hpp"
60
61#include <utility>
62
63
64namespace steam {
65namespace engine {
66
67 using std::forward;
68
69
78 template<class ADA>
79 constexpr bool
81 {
82 // also: array-like outBuff
83 // optionally array-like inBuff
84 ASSERT_MEMBER_FUNCTOR (&ADA::connect, void());
85 ASSERT_MEMBER_FUNCTOR (&ADA::invoke, void());
86 return sizeof(ADA);
87 }
88
89
90 template<class PAT>
91 constexpr bool
93 {
94 using Feed = PAT::Feed;
95 ASSERT_MEMBER_FUNCTOR (&PAT::mount, Feed(TurnoutSystem&));
96 ASSERT_MEMBER_FUNCTOR (&PAT::pull, void(Feed&, TurnoutSystem&));
97 ASSERT_MEMBER_FUNCTOR (&PAT::shed, void(Feed&, TurnoutSystem&, OptionalBuff));
98 ASSERT_MEMBER_FUNCTOR (&PAT::weft, void(Feed&, TurnoutSystem&));
100 return sizeof(PAT);
101 }
102
103
104
113 template<class PAT>
115 : public Port
116 , public PAT
117 {
118 static_assert (_verify_usable_as_WeavingPattern<PAT>());
119
120 using Feed = PAT::Feed;
121
122 public:
123 template<typename...INIT>
124 Turnout (ProcID& id, INIT&& ...init)
125 : Port{id}
126 , PAT{forward<INIT> (init)...}
127 { }
128
135 weave (TurnoutSystem& turnoutSys, OptionalBuff outBuff =std::nullopt) override
136 {
137 Feed feed = PAT::mount (turnoutSys);
138 PAT::pull (feed, turnoutSys);
139 PAT::shed (feed, turnoutSys, outBuff);
140 PAT::weft (feed, turnoutSys);
141 return PAT::fix (feed, turnoutSys);
142 }
143 };
144
145
146
147
148
153 template<class PAT>
155 : public Port
156 , public PAT
157 {
159 weave (TurnoutSystem&, OptionalBuff =std::nullopt) override
160 {
161 throw err::Fatal{"Diagnostic class -- must not be invoked"};
162 }
163
164 public:
177 static auto
179 { // Note: deliberately static, not dynamic-cast
180 auto& internalView = static_cast<_TurnoutDiagnostic&> (port);
181 auto& weavingPattern = static_cast<PAT&> (internalView);
182 return _accessInternal(weavingPattern);
183 }
184 };
185
186
187
188}}// namespace steam::engine
189#endif /*STEAM_ENGINE_TURNOUT_H*/
Derived specific exceptions within Lumiera's exception hierarchy.
Definition error.hpp:193
Handle for a buffer for processing data, abstracting away the actual implementation.
Metadata to qualify a Port (and implicitly the enclosing Node).
Definition proc-id.hpp:124
Communication hub to coordinate and activate the »Render Node Network« performance.
Processing structure to activate a Render Node and produce result data.
Definition turnout.hpp:117
Turnout(ProcID &id, INIT &&...init)
Definition turnout.hpp:124
BuffHandle weave(TurnoutSystem &turnoutSys, OptionalBuff outBuff=std::nullopt) override
Entrance point to the next recursive step of media processing.
Definition turnout.hpp:135
BuffHandle weave(TurnoutSystem &, OptionalBuff=std::nullopt) override
Definition turnout.hpp:159
static auto accessInternal(Port &port)
Access to internals of the Weaving Pattern bypassing the VTable.
Definition turnout.hpp:178
#define ASSERT_MEMBER_FUNCTOR(_EXPR_, _SIG_)
Macro for a compile-time check to verify some member is present and comprises something invokable wit...
Definition function.hpp:342
std::optional< BuffHandle > OptionalBuff
constexpr bool _verify_usable_as_WeavingPattern()
Definition turnout.hpp:92
constexpr bool _verify_usable_as_InvocationAdapter()
Definition to emulate a Concept for the Invocation Adapter.
Definition turnout.hpp:80
Steam-Layer implementation namespace root.
Interface to the processing nodes and the Render Nodes network.
Basic set of definitions and includes commonly used together.
A actual state of a rendering evaluation parametrised for a single job.