Class for buffer for storing large data.
More...
#include <LargeBuffer.hpp>
|
| | LargeBuffer ()=default |
| | Default constructor for an empty buffer. This does not allocate any memory.
|
| | LargeBuffer (std::size_t buffer_size) |
| | Constructor with a buffer size.
|
| | LargeBuffer (const LargeBuffer &other)=delete |
| | Default copy constructor. Very slow and should be avoided.
|
| | LargeBuffer (LargeBuffer &&other) noexcept=default |
| | Move constructor via swapping.
|
| auto | operator= (const LargeBuffer &other) -> LargeBuffer &=delete |
| | Default copy assignment. Very slow and should be avoided.
|
| auto | operator= (LargeBuffer &&other) noexcept -> LargeBuffer &=default |
| | Move assignment via swapping.
|
| | ~LargeBuffer ()=default |
| | Default destructor.
|
| auto | operator== (std::span< char > msg) const -> bool |
| | Comparison with a span.
|
| auto | operator== (std::string_view msg) const -> bool |
| | Comparison with a string_view.
|
| auto | data () const -> std::string_view |
| | Return a string_view with the underlying data and current size.
|
| auto | empty () const -> bool |
| void | resize (std::size_t size) |
| | Change the size of this buffer.
|
| auto | get_buffer_size () const -> std::size_t |
| | Getter for the buffer size.
|
| auto | get_size () const -> std::size_t |
| | Getter for the size.
|
| auto | get_all_data () -> std::span< char > |
| | Return the total underlying data.
|
| auto | is_empty () -> bool |
Class for buffer for storing large data.
It has two different length indicators: size and buffer size (capacity). Similar to std::vector, size represents the current amount of valid values and buffer size represents the memory allocated for the buffer. The reason to use LargeBuffer instead of simply std::vector is because the std::vector::resize() also initialize the values when vector grows, while LargeBuffer::resize() just change the size value, without furthering operations. The LargeBuffer is not supposed to grow or reallocated and all the memory should be allocated up front via the constructor LargeBuffer(std::size_t).
Definition at line 22 of file LargeBuffer.hpp.
◆ LargeBuffer() [1/4]
| srs::LargeBuffer::LargeBuffer |
( |
| ) |
|
|
default |
Default constructor for an empty buffer. This does not allocate any memory.
◆ LargeBuffer() [2/4]
| srs::LargeBuffer::LargeBuffer |
( |
std::size_t | buffer_size | ) |
|
|
inlineexplicit |
Constructor with a buffer size.
The number of the elements pre-allocated is equal to the buffer_size.
- Parameters
-
| buffer_size | Number of element whose memory pre-allocated to the buffer. |
Definition at line 38 of file LargeBuffer.hpp.
◆ LargeBuffer() [3/4]
| srs::LargeBuffer::LargeBuffer |
( |
const LargeBuffer & | other | ) |
|
|
explicitdelete |
Default copy constructor. Very slow and should be avoided.
◆ LargeBuffer() [4/4]
| srs::LargeBuffer::LargeBuffer |
( |
LargeBuffer && | other | ) |
|
|
explicitdefaultnoexcept |
Move constructor via swapping.
This "move" constructor does not move the data of the other, but rather perform the swap action with other object.
- Parameters
-
◆ ~LargeBuffer()
| srs::LargeBuffer::~LargeBuffer |
( |
| ) |
|
|
default |
◆ data()
| auto srs::LargeBuffer::data |
( |
| ) |
const -> std::string_view |
|
inlinenodiscard |
Return a string_view with the underlying data and current size.
- Returns
- string_view data
Definition at line 94 of file LargeBuffer.hpp.
◆ empty()
| auto srs::LargeBuffer::empty |
( |
| ) |
const -> bool |
|
inlinenodiscard |
◆ get_all_data()
| auto srs::LargeBuffer::get_all_data |
( |
| ) |
-> std::span< char > |
|
inline |
Return the total underlying data.
- Returns
- Span of the underlying data.
Definition at line 130 of file LargeBuffer.hpp.
◆ get_buffer_size()
| auto srs::LargeBuffer::get_buffer_size |
( |
| ) |
const -> std::size_t |
|
inlinenodiscard |
Getter for the buffer size.
- Returns
- Buffer size
Definition at line 115 of file LargeBuffer.hpp.
◆ get_size()
| auto srs::LargeBuffer::get_size |
( |
| ) |
const -> std::size_t |
|
inlinenodiscard |
Getter for the size.
- Returns
- Size of elements in the buffer
Definition at line 122 of file LargeBuffer.hpp.
◆ is_empty()
| auto srs::LargeBuffer::is_empty |
( |
| ) |
-> bool |
|
inline |
◆ operator=() [1/2]
Default copy assignment. Very slow and should be avoided.
◆ operator=() [2/2]
Move assignment via swapping.
This "move" assignment does not move the data of the other, but rather perform the swap action with other object.
- Parameters
-
◆ operator==() [1/2]
| auto srs::LargeBuffer::operator== |
( |
std::span< char > | msg | ) |
const -> bool |
|
inline |
Comparison with a span.
- Parameters
-
- Returns
- True if equal
Definition at line 79 of file LargeBuffer.hpp.
◆ operator==() [2/2]
| auto srs::LargeBuffer::operator== |
( |
std::string_view | msg | ) |
const -> bool |
|
inline |
Comparison with a string_view.
- Parameters
-
- Returns
- True if equal
Definition at line 87 of file LargeBuffer.hpp.
◆ resize()
| void srs::LargeBuffer::resize |
( |
std::size_t | size | ) |
|
|
inline |
Change the size of this buffer.
Changing the size to the new size value, without assigning or changing the old data values.
- Parameters
-
Definition at line 103 of file LargeBuffer.hpp.
◆ data_
◆ size_
| std::size_t srs::LargeBuffer::size_ = 0 |
|
private |
The documentation for this class was generated from the following file: