class
#include <eckit/io/Buffer.h>
Buffer Simple class to implement memory buffers.
Derived classes
- class CountedBuffer
Constructors, destructors, conversion operators
- Buffer(size_t size = 0) explicit
-
Buffer(const std::
string& s) explicit - Buffer(const void* src, size_t size)
- Buffer(Buffer&& rhs) noexcept
- Move constructor. Note that rhs is not guaranteed to be valid!
- ~Buffer()
- operator char*()
- operator const char*() const
- operator void*()
- operator const void*() const
Public functions
- auto operator=(Buffer&& rhs) -> Buffer& noexcept
- Move assignment. Note that rhs is not guaranteed to be valid!
- auto data() -> void*
- auto data() const -> const void*
- auto size() const -> size_t
- void zero()
- Zero content of buffer.
- void resize(size_t newSize, bool preserveData = false)
- void copy(const void*, size_t size, size_t pos = 0)
Function documentation
eckit:: Buffer:: Buffer(size_t size = 0) explicit
Parameters | |
---|---|
size | in bytes of the buffer. |
Creates a buffer with 'size' many bytes.
eckit:: Buffer:: Buffer(const std:: string& s) explicit
Parameters | |
---|---|
s | content of buffer, including null-terminator |
Creates a buffer from the string s. NOTE: the buffer will contain the string as a zero terminated c-string. I.e. the resulting size of buffer is s.size() + 1
eckit:: Buffer:: Buffer(const void* src,
size_t size)
Parameters | |
---|---|
src | to copy bytes from |
size | of data |
Creates buffer with initial content
size_t eckit:: Buffer:: size() const
Returns | buffer size in bytes |
---|
Returns size of the buffer in bytes Note: The actual allocation held by this buffer may be larger if the buffer has been resized with 'preserveData' set to a smaller size than before.
void eckit:: Buffer:: copy(const void*,
size_t size,
size_t pos = 0)
Copy data of given size (bytes) into buffer at given position