robometry::Buffer class

A class to represent the buffer of robometry::Record.

Public types

using iterator = typename boost::circular_buffer<Record>::iterator
using const_iterator = typename boost::circular_buffer<Record>::const_iterator

Constructors, destructors, conversion operators

Buffer() defaulted
Buffer(const Buffer& _other) defaulted
Construct a new Buffer object copying from another Buffer.
Buffer(Buffer&& _other) defaulted noexcept
Construct a new Buffer object moving from another Buffer.
~Buffer() defaulted virtual
Destroy the Buffer object.
Buffer(size_t num_elements)
Construct a new Buffer object.

Public functions

auto operator=(const Buffer& _other) -> Buffer& defaulted
Copy assignment operator.
auto operator=(Buffer&& _other) -> Buffer& defaulted noexcept
Move assignment operator.
void push_back(const Record& elem)
Push back copying the new Record.
void push_back(Record&& elem)
Push back moving the new Record.
auto getBufferFreeSpace() const -> size_t
Get the Buffer free space.
auto size() const -> size_t
Get the size of the Buffer.
auto capacity() const -> size_t
Get the capacity of Buffer.
auto empty() const -> bool
Return true if the Buffer is empty, false otherwise.
void resize(size_t new_size)
Resize the Buffer.
void set_capacity(size_t new_size)
Change the capacity of the Buffer.
auto full() const -> bool
Return true if the Buffer is full, false otherwise.
auto begin() -> iterator noexcept
Return the iterator referred to the begin of the Buffer.
auto end() -> iterator noexcept
Return the iterator referred to the end of the Buffer.
auto begin() const -> const_iterator noexcept
Return the const iterator referred to the begin of the Buffer.
auto end() const -> const_iterator noexcept
Return the const iterator referred to the end of the Buffer.
void clear() noexcept
Clear the content of the buffer.
auto getBufferSharedPtr() const -> std::shared_ptr<boost::circular_buffer<Record>>
Get the Buffer shared_ptr object.

Function documentation

robometry::Buffer::Buffer(const Buffer& _other) defaulted

Construct a new Buffer object copying from another Buffer.

Parameters
_other in Buffer to be copied.

robometry::Buffer::Buffer(Buffer&& _other) defaulted noexcept

Construct a new Buffer object moving from another Buffer.

Parameters
_other in Buffer to be moved.

robometry::Buffer::Buffer(size_t num_elements)

Construct a new Buffer object.

Parameters
num_elements in Number of elements of the Buffer to be constructed.

Buffer& robometry::Buffer::operator=(const Buffer& _other) defaulted

Copy assignment operator.

Parameters
_other in Buffer to be copied.
Returns Buffer& Resulting Buffer.

Buffer& robometry::Buffer::operator=(Buffer&& _other) defaulted noexcept

Move assignment operator.

Parameters
_other in Buffer to be moved.
Returns Buffer& Resulting Buffer.

void robometry::Buffer::push_back(const Record& elem)

Push back copying the new Record.

Parameters
elem in Record to be copied

void robometry::Buffer::push_back(Record&& elem)

Push back moving the new Record.

Parameters
elem in Record to be moved.

size_t robometry::Buffer::getBufferFreeSpace() const

Get the Buffer free space.

Returns size_t The free space expressed in bytes.

size_t robometry::Buffer::size() const

Get the size of the Buffer.

Returns size_t The size of the buffer

size_t robometry::Buffer::capacity() const

Get the capacity of Buffer.

Returns size_t The capacity of the buffer.

void robometry::Buffer::resize(size_t new_size)

Resize the Buffer.

Parameters
new_size in The new size to be resized to.

void robometry::Buffer::set_capacity(size_t new_size)

Change the capacity of the Buffer.

Parameters
new_size in The new size.

iterator robometry::Buffer::begin() noexcept

Return the iterator referred to the begin of the Buffer.

Returns iterator

iterator robometry::Buffer::end() noexcept

Return the iterator referred to the end of the Buffer.

Returns iterator

const_iterator robometry::Buffer::begin() const noexcept

Return the const iterator referred to the begin of the Buffer.

Returns const_iterator

const_iterator robometry::Buffer::end() const noexcept

Return the const iterator referred to the end of the Buffer.

Returns const_iterator

std::shared_ptr<boost::circular_buffer<Record>> robometry::Buffer::getBufferSharedPtr() const

Get the Buffer shared_ptr object.

Returns std::shared_ptr<boost::circular_buffer<Record>>