|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_POPULATION_WINDOW_WINDOW_VIEW_H_
2 #define GENESIS_POPULATION_WINDOW_WINDOW_VIEW_H_
44 namespace population {
137 if( ! current_element_ ) {
158 assert( current_element_ );
159 return current_element_;
165 assert( current_element_ );
166 return current_element_;
172 assert( current_element_ );
173 return *current_element_;
179 assert( current_element_ );
180 return *current_element_;
193 if( ! current_element_ ) {
214 return parent_ == other.parent_;
219 return !(*
this == other);
228 Data* current_element_ =
nullptr;
258 if( index >= window.
size() ) {
261 return &window[index++].data;
274 if( index >= window.
size() ) {
277 return &window[index++].data;
296 throw std::runtime_error(
297 "WindowView begin() has been called without setting "
298 "the get_element function first."
302 throw std::runtime_error(
303 "WindowView is an input iterator (single pass), "
304 "but begin() has been called multiple times."
334 mutable bool started_ =
false;
341 #endif // include guard
Iterator()=default
Default constructor for empty (past-the-end) data.
value_type * operator->()
std::input_iterator_tag iterator_category
virtual ~WindowView() override=default
Window over the chromosomes of a genome.
Iterator & operator=(self_type const &)=default
value_type const & const_reference
WindowView & operator=(WindowView const &)=default
bool operator==(self_type const &other) const
Compare two iterators for equality.
value_type const * pointer
size_t size() const
Get the number of D/Data Entries that are stored in the Window.
const value_type * operator->() const
Iterator(WindowView const *parent)
Constructor for data iteration.
std::ptrdiff_t difference_type
Proxy view over window-like regions of a genome.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
const value_type & operator*() const
WindowView(Window< Data > &window)
Constructor that takes a Window window and creates a view into it.
value_type const & const_reference
WindowView(Window< Data > const &window)
Constructor that takes a Window window and creates a view into it.
std::input_iterator_tag iterator_category
std::function< Data *()> get_element
Function to read the next element from some input source.
Base class for Window and WindowView, to share common functionality.
bool operator!=(self_type const &other) const