Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
proc-id.hpp
Go to the documentation of this file.
1/*
2 PROC-ID.hpp - symbolic and hash identification of processing steps
3
4 Copyright (C)
5 2024, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
62#ifndef ENGINE_PROC_ID_H
63#define ENGINE_PROC_ID_H
64
65
66#include "lib/error.hpp"
67#include "lib/hash-standard.hpp"
68#include "lib/several.hpp"
69#include "lib/nocopy.hpp"
70
71#include <utility>
72#include <string>
73
74
75namespace steam {
76namespace engine {
77 namespace err = lumiera::error;
78
79 using std::move;
80 using lib::HashVal;
81 using std::string;
82 using StrView = std::string_view;
83
84 class ProcNode;
85
86
96 {
97 bool manifold :1;
98 bool isProxy :1;
99
101 : manifold{true}
102 , isProxy{false}
103 { }
104
105 friend bool
107 {
108 return l.manifold == r.manifold
109 and l.isProxy == r.isProxy;
110 }
111 };
112
122 class ProcID
123 : util::MoveOnly // ◁—— you must not create instances, use ProcID::describe()
124 {
129
130 ProcID (StrView nodeSymb, StrView portQual, StrView argLists, ProcAttrib);
131
134
135 public:
137 static ProcID& describe (StrView nodeSymb, StrView portSpec, ProcAttrib extAttrib =ProcAttrib{});
138
139 /* === symbolic descriptors === */
140
141 string genProcName() const;
142 string genProcSpec() const;
143 string genQualifier() const;
144 string genNodeName() const;
145 string genNodeSymbol() const;
146 string genNodeDomain() const;
147 string genNodeSpec(Leads&) const;
148 string genSrcSpec (Leads&) const;
149
150 struct ArgModel;
152
153 bool hasManifoldPatt() const { return attrib_.manifold; }
154 bool hasProxyPatt() const { return attrib_.isProxy; }
155
156 friend bool
157 operator== (ProcID const& l, ProcID const& r)
158 {
159 return l.nodeName_ == r.nodeName_
160 and l.portQual_ == r.portQual_
161 and l.argLists_ == r.argLists_
162 and l.attrib_ == r.attrib_;
163 }
164
165 friend bool
166 operator!= (ProcID const& l, ProcID const& r)
167 { return not (l == r); }
168
169 friend HashVal hash_value (ProcID const&);
170 };
171
172
173
180 {
183
186
187 bool empty() const { return not hasArgs(); };
188 bool hasArgs() const { return hasInArgs() or hasOutArgs();}
189 bool hasInArgs() const { return not iArg.empty(); }
190 bool hasOutArgs() const { return not oArg.empty(); }
191 uint inArity() const { return iArg.size(); }
192 uint outArity() const { return oArg.size(); }
193
194 private:
195 ArgModel (Strings&& iarg, Strings&& oarg)
196 : iArg{move (iarg)}
197 , oArg{move (oarg)}
198 { }
200 };
201
202
203}} // namespace steam::engine
204#endif /*ENGINE_PROC_ID_H*/
Subscript-index based access to a container, packaged as iterator.
lib::IndexIter< Several > iterator
Definition several.hpp:221
size_t size() const
Definition several.hpp:194
bool empty() const
Definition several.hpp:200
Metadata to qualify a Port (and implicitly the enclosing Node).
Definition proc-id.hpp:124
string genNodeSymbol() const
string genProcSpec() const
render a descriptor for the operation (without predecessors)
string genProcName() const
std::reference_wrapper< ProcNode > ProcNodeRef
Definition proc-id.hpp:132
friend HashVal hash_value(ProcID const &)
friend bool operator==(ProcID const &l, ProcID const &r)
Definition proc-id.hpp:157
static ProcID & describe(StrView nodeSymb, StrView portSpec, ProcAttrib extAttrib=ProcAttrib{})
build and register a processing ID descriptor
string genSrcSpec(Leads &) const
transitively enumerate all unique source nodes
string genNodeSpec(Leads &) const
bool hasProxyPatt() const
Definition proc-id.hpp:154
string genNodeName() const
friend bool operator!=(ProcID const &l, ProcID const &r)
Definition proc-id.hpp:166
bool hasManifoldPatt() const
Definition proc-id.hpp:153
string genNodeDomain() const
string genQualifier() const
ArgModel genArgModel() const
ProcID(StrView nodeSymb, StrView portQual, StrView argLists, ProcAttrib)
Key abstraction of the Render Engine: A Data processing Node.
Types marked with this mix-in may be moved and move-assigned.
Definition nocopy.hpp:64
Types marked with this mix-in may be moved but not copied.
Definition nocopy.hpp:50
Lumiera error handling (C++ interface).
Helper to use a single extension point for specialised hash functions.
unsigned int uint
Definition integral.hpp:29
size_t HashVal
a STL compatible hash value
Definition hash-value.h:52
std::string_view StrView
Definition proc-id.hpp:82
Steam-Layer implementation namespace root.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Abstraction interface: array-like random access by subscript.
Extended Attributes for ProcID metadata.
Definition proc-id.hpp:96
friend bool operator==(ProcAttrib const &l, ProcAttrib const &r)
Definition proc-id.hpp:106
Expanded information regarding node input and output.
Definition proc-id.hpp:180
ArgModel(Strings &&iarg, Strings &&oarg)
Definition proc-id.hpp:195