27#ifndef INCLUDED_ADTS_RING_BUF
28#define INCLUDED_ADTS_RING_BUF
47 size_t idx = (size_t)(
head + ofs);
53 size_t idx = (size_t)(
head + ofs);
116 {
return data[(
pos+idx) % n]; }
122 { ++
pos;
return (*
this); }
124 {
iterator tmp = *
this; ++*
this;
return tmp; }
128 {
return !(*
this == rhs); }
130 {
return (
pos < rhs.
pos); }
132 {
pos += ofs;
return *
this; }
134 {
return (*
this += -ofs); }
136 {
iterator tmp = *
this;
return (tmp += ofs); }
138 {
iterator tmp = *
this;
return (tmp -= ofs); }
162 {
return data[(
pos+idx) % n]; }
168 { ++
pos;
return (*
this); }
174 {
return !(*
this == rhs); }
176 {
return (
pos < rhs.
pos); }
178 {
pos += ofs;
return *
this; }
180 {
return (*
this += -ofs); }
182 {
iterator tmp = *
this;
return (tmp += ofs); }
184 {
iterator tmp = *
this;
return (tmp -= ofs); }
Definition: ring_buf.h:149
bool operator!=(const const_iterator &rhs) const
Definition: ring_buf.h:173
const_iterator()
Definition: ring_buf.h:157
ptrdiff_t difference_type
Definition: ring_buf.h:153
const_iterator & operator++()
Definition: ring_buf.h:167
difference_type operator-(const iterator right) const
Definition: ring_buf.h:185
const T & reference
Definition: ring_buf.h:155
const_iterator(const T *data_, size_t pos_)
Definition: ring_buf.h:159
const T & operator[](int idx) const
Definition: ring_buf.h:161
const T & operator*() const
Definition: ring_buf.h:163
bool operator<(const const_iterator &rhs) const
Definition: ring_buf.h:175
iterator operator-(difference_type ofs) const
Definition: ring_buf.h:183
const_iterator operator++(int)
Definition: ring_buf.h:169
const T * data
Definition: ring_buf.h:189
iterator & operator-=(difference_type ofs)
Definition: ring_buf.h:179
const T * operator->() const
Definition: ring_buf.h:165
iterator operator+(difference_type ofs) const
Definition: ring_buf.h:181
bool operator==(const const_iterator &rhs) const
Definition: ring_buf.h:171
T value_type
Definition: ring_buf.h:152
size_t pos
Definition: ring_buf.h:190
const T * pointer
Definition: ring_buf.h:154
iterator & operator+=(difference_type ofs)
Definition: ring_buf.h:177
std::random_access_iterator_tag iterator_category
Definition: ring_buf.h:151
Definition: ring_buf.h:103
iterator operator+(difference_type ofs) const
Definition: ring_buf.h:135
std::random_access_iterator_tag iterator_category
Definition: ring_buf.h:105
iterator operator++(int)
Definition: ring_buf.h:123
T value_type
Definition: ring_buf.h:106
T & operator*() const
Definition: ring_buf.h:117
T & reference
Definition: ring_buf.h:109
T * pointer
Definition: ring_buf.h:108
iterator operator-(difference_type ofs) const
Definition: ring_buf.h:137
iterator & operator+=(difference_type ofs)
Definition: ring_buf.h:131
iterator & operator-=(difference_type ofs)
Definition: ring_buf.h:133
bool operator==(const iterator &rhs) const
Definition: ring_buf.h:125
bool operator<(const iterator &rhs) const
Definition: ring_buf.h:129
iterator(T *data_, size_t pos_)
Definition: ring_buf.h:113
bool operator!=(const iterator &rhs) const
Definition: ring_buf.h:127
T & operator[](int idx) const
Definition: ring_buf.h:115
T * data
Definition: ring_buf.h:143
ptrdiff_t difference_type
Definition: ring_buf.h:107
iterator & operator++()
Definition: ring_buf.h:121
size_t pos
Definition: ring_buf.h:144
T * operator->() const
Definition: ring_buf.h:119
iterator()
Definition: ring_buf.h:111
difference_type operator-(const iterator right) const
Definition: ring_buf.h:139
Definition: ring_buf.h:31
T & front()
Definition: ring_buf.h:57
RingBuf()
Definition: ring_buf.h:38
const T & back() const
Definition: ring_buf.h:72
T & back()
Definition: ring_buf.h:67
size_t tail
Definition: ring_buf.h:34
iterator begin()
Definition: ring_buf.h:194
T data[n]
Definition: ring_buf.h:35
T & operator[](int ofs)
Definition: ring_buf.h:50
void push_back(const T &item)
Definition: ring_buf.h:78
const T & front() const
Definition: ring_buf.h:62
const T & operator[](int ofs) const
Definition: ring_buf.h:44
const_iterator end() const
Definition: ring_buf.h:206
bool empty() const
Definition: ring_buf.h:42
size_t head
Definition: ring_buf.h:33
size_t size() const
Definition: ring_buf.h:41
void pop_front()
Definition: ring_buf.h:91
iterator end()
Definition: ring_buf.h:202
void clear()
Definition: ring_buf.h:39
const_iterator begin() const
Definition: ring_buf.h:198
size_t size_
Definition: ring_buf.h:32
#define DEBUG_WARN_ERR(status)
display the error dialog with text corresponding to the given error code.
Definition: debug.h:326
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:277
const Status LOGIC
Definition: status.h:411
#define T(string_literal)
Definition: secure_crt.cpp:77