OGLplus  (0.59.0) a C++ wrapper for rendering APIs

fold_node.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_TEXGEN_FOLD_NODE_HPP
9 #define OGLPLUS_TEXGEN_FOLD_NODE_HPP
10 
11 #include "fallback_input.hpp"
12 #include "multi_input_node.hpp"
13 #include <map>
14 
15 namespace eagine::oglp::texgen {
16 
17 enum class fold_function {
18  add,
19  multiply,
20  max,
21  min
22  // TODO
23 };
24 
25 class fold_output : public multi_input_output {
26 private:
27  friend class fold_node;
28 
29  fold_function _func;
30 
31 public:
32  fold_output(node_intf& parent, fold_function);
33 
34  fold_output(node_intf& parent)
35  : fold_output(parent, fold_function::multiply) {}
36 
37  string_view type_name() override;
38 
39  slot_data_type value_type() override;
40 
41  std::ostream& definitions(std::ostream& out, compile_context& ctxt) override;
42 };
43 
44 class fold_node : public multi_input_node {
45 private:
46  fold_output _output;
47 
48 public:
49  fold_node();
50 
51  fold_output& single_output() override {
52  return _output;
53  }
54 
55  fold_node& set_function(fold_function func) {
56  _output._func = func;
57  return *this;
58  }
59 };
60 
61 } // namespace eagine::oglp::texgen
62 
63 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
64 #include <oglplus/texgen/fold_node.inl>
65 #endif
66 
67 #endif // OGLPLUS_TEXGEN_FOLD_NODE_HPP
value_type
Value tree value element data type enumeration.
Definition: interface.hpp:27
basic_string_span< const char > string_view
Alias for const string views.
Definition: string_span.hpp:116
static auto type_name(const T &) noexcept -> std::string
Returns the demangled name for type T.
Definition: type_name.hpp:24
static auto multiply(const matrix< T, K, M, RM1, V > &m1, const matrix< T, N, K, RM2, V > &m2) noexcept -> matrix< T, N, M, RM1, V >
Matrix multiplication function.
Definition: matrix.hpp:529

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).