#include <genesis/population/window/window_view_stream.hpp>
Stream wrapper that turns a BaseWindowStream over Window into a BaseWindowStream over WindowView.
This serves as an abstraction to be able to use WindowViewStream everywhere, instead of having to switch between WindowViewStream and WindowStream depending on the type of windowing that is being done. For example, SlidingIntervalWindowStream, SlidingEntriesWindowStream, and RegionWindowStream yield streams over Windows, while the ChromosomeStream (and the whole genome stream that can be created with it as well) yield streams over WindowViews instead. This makes it cumbersome to switch between the two types downstream. Hence, yet another abstraction.
In more technical terms, some of our window streams are inheriting from BaseWindowStream<InputStreamIterator, Data, Window>
, while others are inheriting from BaseWindowStream<InputStreamIterator, Data, WindowView>
, making their base classes incompatible, so that they cannot be assigned to the same pointer variable. This class here solves this, by wrapping the former into a class derived from the latter, and hence using the latter type as the one that we can use for uniform access to window streams.
The class takes the BaseWindowStream to be iterated over as input, and iteraters its windows, and then simply wraps them into a WindowView whose elements point to these windows.
Definition at line 74 of file window_view_stream.hpp.
Public Member Functions | |
WindowViewStream (std::unique_ptr< WrappedWindowStream > window_iterator) | |
WindowViewStream (WindowViewStream &&)=default | |
WindowViewStream (WindowViewStream const &)=default | |
virtual | ~WindowViewStream () override=default |
WindowViewStream & | operator= (WindowViewStream &&)=default |
WindowViewStream & | operator= (WindowViewStream const &)=default |
Public Member Functions inherited from BaseWindowStream< InputStreamIterator, typename InputStreamIterator::value_type, ::genesis::population::WindowView< typename InputStreamIterator::value_type > > | |
BaseWindowStream (BaseWindowStream &&)=default | |
BaseWindowStream (BaseWindowStream const &)=default | |
BaseWindowStream (InputStreamIterator begin, InputStreamIterator end) | |
virtual | ~BaseWindowStream ()=default |
self_type & | add_begin_callback (std::function< void()> const &callback) |
Add a callback function that is executed when beginning the iteration. More... | |
self_type & | add_end_callback (std::function< void()> const &callback) |
Add a callback function that is executed when the end of the iteration is reached. More... | |
self_type & | add_on_enter_observer (std::function< void(::genesis::population::WindowView< typename InputStreamIterator::value_type > const &)> const &observer) |
Add a observer function that is executed once for each window during the iteration, when entering the window during the iteration. More... | |
self_type & | add_on_leave_observer (std::function< void(::genesis::population::WindowView< typename InputStreamIterator::value_type > const &)> const &observer) |
Add a observer function that is executed once for each window during the iteration, when leaving the window during the iteration. More... | |
Iterator | begin () |
self_type & | clear_callbacks () |
Clear all functions that have been added via add_begin_callback() and add_end_callback(). More... | |
self_type & | clear_observers () |
Clear all functions that are executed on incrementing to the next element. More... | |
Iterator | end () |
BaseWindowStream & | operator= (BaseWindowStream &&)=default |
BaseWindowStream & | operator= (BaseWindowStream const &)=default |
Public Attributes | |
friend | DerivedIterator |
Public Attributes inherited from BaseWindowStream< InputStreamIterator, typename InputStreamIterator::value_type, ::genesis::population::WindowView< typename InputStreamIterator::value_type > > | |
std::function< std::string(InputType const &)> | chromosome_function |
Functor that yields the current chromosome, given the input stream data. More... | |
std::function< DataType(InputType const &)> | entry_input_function |
Functor to convert from the underlying input stream that provides the data to fill the windows to the data that is stored per window. More... | |
friend | Iterator |
std::function< size_t(InputType const &)> | position_function |
Functor that yields the current position on the chromosome, given the input stream data. More... | |
Classes | |
class | DerivedIterator |
Internal iterator that produces WindowViews. More... | |
Protected Member Functions | |
std::unique_ptr< typename base_type::BaseIterator > | get_begin_iterator_ () override final |
Get the begin iterator. More... | |
std::unique_ptr< typename base_type::BaseIterator > | get_end_iterator_ () override final |
Get the end iterator. More... | |
Protected Member Functions inherited from BaseWindowStream< InputStreamIterator, typename InputStreamIterator::value_type, ::genesis::population::WindowView< typename InputStreamIterator::value_type > > | |
BaseWindowStream ()=default | |
|
inline |
Definition at line 253 of file window_view_stream.hpp.
|
overridevirtualdefault |
|
default |
|
default |
|
inlinefinaloverrideprotectedvirtual |
Get the begin iterator.
Needs to be implemented by the derived class, to give the correct derived BaseIterator instance.
Definition at line 276 of file window_view_stream.hpp.
|
inlinefinaloverrideprotectedvirtual |
Get the end iterator.
Needs to be implemented by the derived class, to give the correct derived BaseIterator instance.
Definition at line 285 of file window_view_stream.hpp.
|
default |
|
default |
Definition at line 89 of file window_view_stream.hpp.
using const_reference = value_type const& |
Definition at line 109 of file window_view_stream.hpp.
using DataType = Data |
Definition at line 85 of file window_view_stream.hpp.
using InputStreamType = InputStreamIterator |
Definition at line 84 of file window_view_stream.hpp.
using InputType = typename InputStreamIterator::value_type |
Definition at line 99 of file window_view_stream.hpp.
using iterator_category = std::input_iterator_tag |
Definition at line 105 of file window_view_stream.hpp.
using pointer = value_type* |
Definition at line 107 of file window_view_stream.hpp.
using reference = value_type& |
Definition at line 108 of file window_view_stream.hpp.
using self_type = WindowViewStream<InputStreamType, DataType> |
Definition at line 90 of file window_view_stream.hpp.
using value_type = WindowViewType |
Definition at line 106 of file window_view_stream.hpp.
using WindowType = ::genesis::population::WindowView<DataType> |
Definition at line 86 of file window_view_stream.hpp.
using WindowViewType = WindowType |
Definition at line 87 of file window_view_stream.hpp.
Definition at line 92 of file window_view_stream.hpp.
using WrappedWindowStreamIterator = typename WrappedWindowStream::Iterator |
Definition at line 101 of file window_view_stream.hpp.
friend DerivedIterator |
Definition at line 267 of file window_view_stream.hpp.