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

base_output.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_TEXGEN_BASE_OUTPUT_HPP
9 #define OGLPLUS_TEXGEN_BASE_OUTPUT_HPP
10 
11 #include "interface.hpp"
12 #include "param_format.hpp"
13 #include <set>
14 
15 namespace eagine::oglp::texgen {
16 
17 class base_output : public output_intf {
18 private:
19  node_intf& _parent;
20  std::set<input_intf*> _inputs;
21 
22 protected:
23  std::ostream& input_defs(std::ostream&, compile_context&);
24  std::ostream& opening_expr(std::ostream&, compile_context&);
25  std::ostream& closing_expr(std::ostream&, compile_context&);
26 
27  bool already_defined(compile_context&);
28 
29 public:
30  base_output(node_intf& parent) noexcept
31  : _parent(parent) {}
32 
33  node_intf& parent() noexcept {
34  return _parent;
35  }
36 
37  virtual string_view type_name() = 0;
38 
39  string_view name() noexcept override;
40 
41  render_param_bits required_params() override;
42 
43  std::ostream& definitions(std::ostream&, compile_context&) override;
44 
45  std::ostream& expression(std::ostream&, compile_context&) override;
46 
47  bool is_connected(input_intf&) override;
48 
49  bool connect(input_intf&) override;
50 
51  bool disconnect(input_intf&) override;
52 
53  void disconnect_all() override;
54 
55  virtual bool set_default_value(span_size_t, float) {
56  return false;
57  }
58 
59  void notify_connected() override;
60 
61  void prepare_parent() override;
62 
63  bool render_parent(const render_params&) override;
64 
65  std::intptr_t get_id() const noexcept;
66 
67  void append_id(std::ostream&, string_view);
68  void append_id(std::ostream&);
69 };
70 
71 namespace expr {
72 struct output_id {
73  output_intf& output;
74  compile_context& context;
75 };
76 std::ostream& operator<<(std::ostream& out, const output_id&);
77 } // namespace expr
78 } // namespace eagine::oglp::texgen
79 
80 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
81 #include <oglplus/texgen/base_output.inl>
82 #endif
83 
84 #endif // OGLPLUS_TEXGEN_BASE_OUTPUT_HPP
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
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 operator<<(std::ostream &out, const identifier_name< M > &n) -> std::ostream &
Operator for writing identifier_name into output streams.
Definition: identifier.hpp:159

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