alternative Standard Libary  0.29.8
std::ring_buffer< T, TAllocator > Template-Klassenreferenz

#include <ringbuffer.hpp>

Öffentliche Typen

using value_type = T
 
using pointer = T *
 
using const_pointer = const T *
 
using reference = T &
 
using const_reference = const T &
 
using size_type = size_t
 
using difference_type = ptrdiff_t
 
using allocator_type = TAllocator
 
using iterator = ring_buffer_iterator< ring_buffer< T, TAllocator >, value_type >
 
using const_iterator = ring_buffer_iterator< ring_buffer< T, TAllocator >, const value_type >
 

Öffentliche Methoden

 ring_buffer (size_t capacity=100)
 
 ~ring_buffer ()
 
void clear ()
 
void push_back (const value_type &item)
 
reference pop_front ()
 
const_reference pop_front () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin ()
 
const_iterator end ()
 
reference front ()
 
const_reference front () const
 
const_reference back () const
 
reference back ()
 
size_type size () const
 
size_type capacity () const
 
bool empty () const
 
bool full () const
 
size_type max () const
 

Ausführliche Beschreibung

template<class T, class TAllocator = std::allocator>
class std::ring_buffer< T, TAllocator >

Dokumentation der benutzerdefinierten Datentypen

◆ allocator_type

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::allocator_type = TAllocator

◆ const_iterator

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::const_iterator = ring_buffer_iterator<ring_buffer<T, TAllocator>, const value_type>

◆ const_pointer

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::const_pointer = const T*

◆ const_reference

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::const_reference = const T&

◆ difference_type

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::difference_type = ptrdiff_t

◆ iterator

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::iterator = ring_buffer_iterator<ring_buffer<T, TAllocator>, value_type>

◆ pointer

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::pointer = T*

◆ reference

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::reference = T&

◆ size_type

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::size_type = size_t

◆ value_type

template<class T , class TAllocator = std::allocator>
using std::ring_buffer< T, TAllocator >::value_type = T

Beschreibung der Konstruktoren und Destruktoren

◆ ring_buffer()

template<class T , class TAllocator = std::allocator>
std::ring_buffer< T, TAllocator >::ring_buffer ( size_t  capacity = 100)
inlineexplicit
146  : m_Array(new T[capacity]),
147  m_ArraySize(capacity),
148  m_Head(0), m_Tail(0),
149  m_ContentsSize(0) {}
size_type capacity() const
Definition: ringbuffer.hpp:200

◆ ~ring_buffer()

template<class T , class TAllocator = std::allocator>
std::ring_buffer< T, TAllocator >::~ring_buffer ( )
inline
151 { delete [] m_Array; }

Dokumentation der Elementfunktionen

◆ back() [1/2]

template<class T , class TAllocator = std::allocator>
const_reference std::ring_buffer< T, TAllocator >::back ( ) const
inline
190  {
191  return m_Array[m_Tail];
192  }

◆ back() [2/2]

template<class T , class TAllocator = std::allocator>
reference std::ring_buffer< T, TAllocator >::back ( )
inline
193  {
194  return m_Array[m_Tail];
195  }

◆ begin() [1/2]

template<class T , class TAllocator = std::allocator>
iterator std::ring_buffer< T, TAllocator >::begin ( )
inline
172  {
173  return iterator(this, empty() ? 0 : front());
174  }
ring_buffer_iterator< ring_buffer< T, TAllocator >, value_type > iterator
Definition: ringbuffer.hpp:142
reference front()
Definition: ringbuffer.hpp:184
bool empty() const
Definition: ringbuffer.hpp:203

◆ begin() [2/2]

template<class T , class TAllocator = std::allocator>
const_iterator std::ring_buffer< T, TAllocator >::begin ( )
inline
178  {
179  return const_iterator(this, 0);
180  }
ring_buffer_iterator< ring_buffer< T, TAllocator >, const value_type > const_iterator
Definition: ringbuffer.hpp:143

◆ capacity()

template<class T , class TAllocator = std::allocator>
size_type std::ring_buffer< T, TAllocator >::capacity ( ) const
inline
200  {
201  return m_ContentsSize;
202  }

◆ clear()

template<class T , class TAllocator = std::allocator>
void std::ring_buffer< T, TAllocator >::clear ( )
inline
154  {
155  m_Head = m_Tail = m_ContentsSize = 0;
156  }

◆ empty()

template<class T , class TAllocator = std::allocator>
bool std::ring_buffer< T, TAllocator >::empty ( ) const
inline
203  {
204  return size() == 0;
205  }
size_type size() const
Definition: ringbuffer.hpp:197

◆ end() [1/2]

template<class T , class TAllocator = std::allocator>
iterator std::ring_buffer< T, TAllocator >::end ( )
inline
175  {
176  return iterator(this, size());
177  }
ring_buffer_iterator< ring_buffer< T, TAllocator >, value_type > iterator
Definition: ringbuffer.hpp:142
size_type size() const
Definition: ringbuffer.hpp:197

◆ end() [2/2]

template<class T , class TAllocator = std::allocator>
const_iterator std::ring_buffer< T, TAllocator >::end ( )
inline
181  {
182  return const_iterator(this, size());
183  }
ring_buffer_iterator< ring_buffer< T, TAllocator >, const value_type > const_iterator
Definition: ringbuffer.hpp:143
size_type size() const
Definition: ringbuffer.hpp:197

◆ front() [1/2]

template<class T , class TAllocator = std::allocator>
reference std::ring_buffer< T, TAllocator >::front ( )
inline
184  {
185  return m_Array[m_Head];
186  }

◆ front() [2/2]

template<class T , class TAllocator = std::allocator>
const_reference std::ring_buffer< T, TAllocator >::front ( ) const
inline
187  {
188  return m_Array[m_Head];
189  }

◆ full()

template<class T , class TAllocator = std::allocator>
bool std::ring_buffer< T, TAllocator >::full ( ) const
inline
206  {
207  return size() == capacity();
208  }
size_type capacity() const
Definition: ringbuffer.hpp:200
size_type size() const
Definition: ringbuffer.hpp:197

◆ max()

template<class T , class TAllocator = std::allocator>
size_type std::ring_buffer< T, TAllocator >::max ( ) const
inline
209  {
210  return size_type(-1) / sizeof(value_type);
211  }
size_t size_type
Definition: ringbuffer.hpp:138
T value_type
Definition: ringbuffer.hpp:133

◆ pop_front() [1/2]

template<class T , class TAllocator = std::allocator>
reference std::ring_buffer< T, TAllocator >::pop_front ( )
inline
164  {
165  inc_head();
166  return front();
167  }
reference front()
Definition: ringbuffer.hpp:184

◆ pop_front() [2/2]

template<class T , class TAllocator = std::allocator>
const_reference std::ring_buffer< T, TAllocator >::pop_front ( ) const
inline
168  {
169  inc_head();
170  return front();
171  }
reference front()
Definition: ringbuffer.hpp:184

◆ push_back()

template<class T , class TAllocator = std::allocator>
void std::ring_buffer< T, TAllocator >::push_back ( const value_type item)
inline
158  {
159  inc_tail();
160  if (m_ContentsSize == m_ArraySize)
161  inc_head();
162  m_Array[m_Tail] = item;
163  }

◆ size()

template<class T , class TAllocator = std::allocator>
size_type std::ring_buffer< T, TAllocator >::size ( ) const
inline
197  {
198  return m_ArraySize;
199  }

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: