#include <wipal/tool/window.hh>
Public Types | |
enum | { max_size = WSize, step = Step } |
Static hierarchies related types | |
typedef HIDDEN | exact_type |
typedef HIDDEN | value_type |
Iterator types. | |
typedef ssize_t | difference_type |
typedef value_type * | pointer |
typedef value_type & | reference |
typedef std::input_iterator_tag | iterator_category |
Public Member Functions | |
template<class Iterable> | |
window (Iterable &, bool) | |
const InputIterator::value_type & | operator[] (unsigned i) const |
Abstract method implementations | |
bool | equal (const window &) const |
void | increment () |
const value_type & | get () const |
const value_type * | get_ptr () const |
Equality checks | |
bool | operator== (const exact_type &) const |
bool | operator!= (const exact_type &) const |
Increment operators | |
const exact_type & | operator++ () |
exact_type | operator++ (int) |
Indirections | |
const value_type & | operator* () const |
const value_type * | operator-> () const |
Downcast methods | |
const exact_type & | exact () const |
exact_type & | exact () |
const exact_type * | exact_ptr () const |
exact_type * | exact_ptr () |
Protected Attributes | |
bool | at_end_ |
InputIterator | next_ |
InputIterator | last_ |
value_type | v_ |
window provides a sliding window over a sequence. It behaves as an iterator which value type is a container for the window's elements. Slide the window using its operator++() . An operator[]() is provided for convenience.
InputIterator | The sequence's input iterator type. | |
WSize | The window's size (length). | |
Step | Number of elements to "eat" when calling increment(). | |
Bottom | Exact type or bottom (see static_base). |
typedef std::vector<int> vector_type; typedef vector_type::iterator iterator_type; typedef window<iterator_type, 2> window_type; vector_type v; // Fill the vector. window_type w (v, false); window_type end (v, true); while(w != end) { std::cout << w[0] << std::endl << w[1] << std::endl << std::endl; ++w; }
typedef HIDDEN tool::window< InputIterator, WSize, Step, Bottom >::exact_type |
anonymous enum |
tool::window< I, Ws, S, B >::window | ( | Iterable & | i, | |
bool | end | |||
) | [inline] |
iterable compatible constructor.
References tool::window< InputIterator, WSize, Step, Bottom >::last_, tool::window< InputIterator, WSize, Step, Bottom >::next_, and tool::window< InputIterator, WSize, Step, Bottom >::v_.
const I::value_type & tool::window< I, Ws, S, B >::operator[] | ( | unsigned | i | ) | const [inline] |
Access to the window's i
'th element.
References tool::window< InputIterator, WSize, Step, Bottom >::v_.
const static_base< Bottom >::exact_type & tool::static_base< Bottom >::exact | ( | ) | const [inline, inherited] |
Safely downcast to the exact type as a const reference.
Referenced by tool::iterable< Bottom >::begin(), phy::header< Bottom >::decapsulate(), tool::iterable< Bottom >::end(), phy::time< Bottom >::get(), phy::header< Bottom >::len(), phy::time< Bottom >::operator+(), phy::header< Bottom >::time_get(), and phy::header< Bottom >::time_set().
static_base< Bottom >::exact_type & tool::static_base< Bottom >::exact | ( | ) | [inline, inherited] |
Safely downcast to the exact type as a non-const reference.
const static_base< Bottom >::exact_type * tool::static_base< Bottom >::exact_ptr | ( | ) | const [inline, inherited] |
Safely downcast to the exact type as a const pointer.
Referenced by pcapxx::frame_descriptor< PCAPDescriptor >::frame_descriptor().
static_base< Bottom >::exact_type * tool::static_base< Bottom >::exact_ptr | ( | ) | [inline, inherited] |
Safely downcast to the exact type as a non-const pointer.
bool tool::window< InputIterator, WSize, Step, Bottom >::at_end_ [protected] |
Is this window the last one.
InputIterator tool::window< InputIterator, WSize, Step, Bottom >::next_ [protected] |
Iterator to the next element to retrieve.
Referenced by tool::window< InputIterator, WSize, Step, Bottom >::window().
InputIterator tool::window< InputIterator, WSize, Step, Bottom >::last_ [protected] |
Iterator past the last element.
Referenced by tool::window< InputIterator, WSize, Step, Bottom >::window().
value_type tool::window< InputIterator, WSize, Step, Bottom >::v_ [protected] |
Current window value.
Referenced by tool::window< InputIterator, WSize, Step, Bottom >::operator[](), and tool::window< InputIterator, WSize, Step, Bottom >::window().