|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Variadic adaptor that fan-outs notifications to many observers. More...
#include <ca-observer.H>
Public Member Functions | |
| Composite_Observer (Observers... observers) | |
| Build the composite from child observers. | |
| template<std::size_t I> | |
| const auto & | get () const noexcept |
| Return read-only access to a child observer. | |
| template<std::size_t I> | |
| auto & | get () noexcept |
| Return mutable access to a child observer. | |
| template<typename Lattice > | |
| void | on_step_begin (std::size_t step, const Lattice &frame) |
| Forward a step-begin event to every child observer. | |
| template<typename Lattice > | |
| void | on_step_end (std::size_t step, const Lattice &frame) |
| Forward a step-end event to every child observer. | |
Static Public Member Functions | |
| static constexpr std::size_t | size () noexcept |
| Return the number of child observers. | |
Private Attributes | |
| std::tuple< Observers... > | obs_ |
Variadic adaptor that fan-outs notifications to many observers.
Composite_Observer<O1, O2, ...> owns its child observers by value (move-constructed at build time) and forwards on_step_begin / on_step_end to each one in declaration order. This lets the engine's single pre/post hook host an arbitrary number of independent observers.
| Observers | types of the child observers. |
Definition at line 128 of file ca-observer.H.
|
inlineexplicit |
Build the composite from child observers.
Reference types in Observers... are preserved and borrowed; value types are moved into the tuple and owned by the composite.
| [in] | observers | child observers to store or reference. |
| Any | exception thrown while constructing the internal tuple. |
Definition at line 148 of file ca-observer.H.
|
inlinenoexcept |
Return read-only access to a child observer.
| I | child index. |
| This | function does not throw. |
Definition at line 157 of file ca-observer.H.
References Aleph::CA::Composite_Observer< Observers >::obs_.
|
inlinenoexcept |
Return mutable access to a child observer.
| I | child index. |
| This | function does not throw. |
Definition at line 168 of file ca-observer.H.
References Aleph::CA::Composite_Observer< Observers >::obs_.
|
inline |
Forward a step-begin event to every child observer.
| Lattice | lattice type. |
| [in] | step | step index about to run. |
| [in] | frame | current frame before the step. |
| Any | exception thrown by a child observer. |
Definition at line 192 of file ca-observer.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::CA::Composite_Observer< Observers >::obs_.
|
inline |
Forward a step-end event to every child observer.
| Lattice | lattice type. |
| [in] | step | step index just completed. |
| [in] | frame | current frame after the step. |
| Any | exception thrown by a child observer. |
Definition at line 210 of file ca-observer.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::CA::Composite_Observer< Observers >::obs_.
|
inlinestaticconstexprnoexcept |
Return the number of child observers.
sizeof...(Observers). | This | function does not throw. |
Definition at line 177 of file ca-observer.H.
|
private |