23 #ifndef ICL_CORE_RING_BUFFER_HPP_INCLUDED 24 #define ICL_CORE_RING_BUFFER_HPP_INCLUDED 31 if (m_write >= m_read)
33 return array_range(&m_buffer[m_read], m_write-m_read);
37 return array_range(&m_buffer[m_read], m_buffer.size()-m_read);
44 if (m_write >= m_read)
57 if (m_write >= m_read)
70 if (m_write >= m_read)
83 if (m_write >= m_read)
87 return array_range(&m_buffer[m_write], m_buffer.size()-m_write-1);
91 return array_range(&m_buffer[m_write], m_buffer.size()-m_write);
96 return array_range(&m_buffer[m_write], m_read-m_write-1);
100 template <
typename T>
103 if (m_write >= m_read)
120 template <
typename T>
123 if (m_write >= m_read)
125 return array_range(&m_buffer[0], (m_read>0?m_read:1) - 1);
133 template <
typename T>
136 if (m_write >= m_read)
146 template <
typename T>
155 m_read = (m_read+count) % m_buffer.size();
159 template <
typename T>
162 if (count > reserve())
166 m_write = (m_write + count) % m_buffer.size();
170 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 175 template <
typename T>
187 template <
typename T>
190 write(val, overwrite);
199 template <
typename T>
211 template <
typename T>
220 template <
typename T>
230 template <
typename T>
239 template <
typename T>
248 template <
typename T>
260 template <
typename T>
263 setCapacity(capacity);
void fakeWrite(size_t count)
void skip()
Removes an element from the ring buffer without returning it.
std::vector< T >::size_type size_type
std::pair< const T *, size_type > const_array_range
Array range as in boost::circular_buffer::const_array_range.
array_range emptyArrayOne()
std::pair< T *, size_type > array_range
Array range as in boost::circular_buffer::array_range.
array_range emptyArrayTwo()
A simple ring buffer implementation based on std::vector.