A circular buffer of fixed size (defined at construction-time), implemented with a std::vector as the underlying storage. More...
#include <mrpt/utils/stl_extensions.h>
Public Member Functions | |
| circular_buffer (const size_t size) | |
| virtual | ~circular_buffer () |
| void | push (T d) |
| Insert a copy of the given element in the buffer. | |
| void | push_ref (const T &d) |
| Insert a reference of the given element in the buffer. | |
| void | push_many (T *array_elements, size_t count) |
| Insert an array of elements in the buffer. | |
| T | pop () |
| Retrieve an element from the buffer. | |
| void | pop (T &out_val) |
| Retrieve an element from the buffer. | |
| void | pop_many (T *out_array, size_t count) |
| Pop a number of elements into a user-provided array. | |
| size_t | size () const |
| Return the number of elements available for read ("pop") in the buffer (this is NOT the maximum size of the internal buffer). | |
| size_t | capacity () const |
| Return the maximum capacity of the buffer. | |
| size_t | available () const |
| The maximum number of elements that can be written ("push") without rising an overflow error. | |
| void | clear () |
| Delete all the stored data, if any. | |
Private Attributes | |
| std::vector< T > | m_data |
| const size_t | m_size |
| size_t | m_next_read |
| size_t | m_next_write |
A circular buffer of fixed size (defined at construction-time), implemented with a std::vector as the underlying storage.
Definition at line 270 of file stl_extensions.h.
| mrpt::utils::circular_buffer< T >::circular_buffer | ( | const size_t | size | ) | [inline] |
Definition at line 278 of file stl_extensions.h.
| virtual mrpt::utils::circular_buffer< T >::~circular_buffer | ( | ) | [inline, virtual] |
Definition at line 286 of file stl_extensions.h.
| size_t mrpt::utils::circular_buffer< T >::available | ( | ) | const [inline] |
The maximum number of elements that can be written ("push") without rising an overflow error.
Definition at line 367 of file stl_extensions.h.
| size_t mrpt::utils::circular_buffer< T >::capacity | ( | ) | const [inline] |
Return the maximum capacity of the buffer.
Definition at line 361 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::available().
| void mrpt::utils::circular_buffer< T >::clear | ( | void | ) | [inline] |
Delete all the stored data, if any.
Definition at line 372 of file stl_extensions.h.
| void mrpt::utils::circular_buffer< T >::pop | ( | T & | out_val | ) | [inline] |
Retrieve an element from the buffer.
| std::out_of_range | If the buffer is empty. |
Definition at line 333 of file stl_extensions.h.
| T mrpt::utils::circular_buffer< T >::pop | ( | ) | [inline] |
Retrieve an element from the buffer.
| std::out_of_range | If the buffer is empty. |
Definition at line 321 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::pop_many().
| void mrpt::utils::circular_buffer< T >::pop_many | ( | T * | out_array, | |
| size_t | count | |||
| ) | [inline] |
Pop a number of elements into a user-provided array.
| std::out_of_range | If the buffer has less elements than requested. |
Definition at line 344 of file stl_extensions.h.
| void mrpt::utils::circular_buffer< T >::push | ( | T | d | ) | [inline] |
Insert a copy of the given element in the buffer.
| std::out_of_range | If the buffer run out of space. |
Definition at line 291 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::push_many().
| void mrpt::utils::circular_buffer< T >::push_many | ( | T * | array_elements, | |
| size_t | count | |||
| ) | [inline] |
Insert an array of elements in the buffer.
| std::out_of_range | If the buffer run out of space. |
Definition at line 313 of file stl_extensions.h.
| void mrpt::utils::circular_buffer< T >::push_ref | ( | const T & | d | ) | [inline] |
Insert a reference of the given element in the buffer.
| std::out_of_range | If the buffer run out of space. |
Definition at line 302 of file stl_extensions.h.
| size_t mrpt::utils::circular_buffer< T >::size | ( | ) | const [inline] |
Return the number of elements available for read ("pop") in the buffer (this is NOT the maximum size of the internal buffer).
Definition at line 352 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::available().
std::vector<T> mrpt::utils::circular_buffer< T >::m_data [private] |
Definition at line 273 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::pop(), mrpt::utils::circular_buffer< uint8_t >::push(), and mrpt::utils::circular_buffer< uint8_t >::push_ref().
size_t mrpt::utils::circular_buffer< T >::m_next_read [private] |
Definition at line 275 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::clear(), mrpt::utils::circular_buffer< uint8_t >::pop(), mrpt::utils::circular_buffer< uint8_t >::push(), mrpt::utils::circular_buffer< uint8_t >::push_ref(), and mrpt::utils::circular_buffer< uint8_t >::size().
size_t mrpt::utils::circular_buffer< T >::m_next_write [private] |
Definition at line 275 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::clear(), mrpt::utils::circular_buffer< uint8_t >::pop(), mrpt::utils::circular_buffer< uint8_t >::push(), mrpt::utils::circular_buffer< uint8_t >::push_ref(), and mrpt::utils::circular_buffer< uint8_t >::size().
const size_t mrpt::utils::circular_buffer< T >::m_size [private] |
Definition at line 274 of file stl_extensions.h.
Referenced by mrpt::utils::circular_buffer< uint8_t >::capacity(), mrpt::utils::circular_buffer< uint8_t >::circular_buffer(), mrpt::utils::circular_buffer< uint8_t >::pop(), mrpt::utils::circular_buffer< uint8_t >::push(), mrpt::utils::circular_buffer< uint8_t >::push_ref(), and mrpt::utils::circular_buffer< uint8_t >::size().
| Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010 |