9#ifndef AVARA3D_BUFFER_H
10#define AVARA3D_BUFFER_H
33 explicit Buffer(
const std::filesystem::path& path);
36 explicit Buffer(
const std::vector<std::byte>& buf);
73 std::unique_ptr<std::byte[]> _data;
Container for a contiguous byte buffer.
Buffer(const std::filesystem::path &path)
Reads the complete contents of path into a Buffer.
std::byte operator[](std::size_t idx) const
Returns the byte at idx without bounds checking.
std::byte * data() const
Returns a mutable pointer to the owned bytes, or nullptr when the Buffer is empty.
std::size_t size() const
Returns the buffer size in bytes.
Buffer(const std::vector< std::byte > &buf)
Creates a Buffer by copying the bytes in buf.
Buffer(const std::byte *buf, std::size_t size)
Creates a Buffer containing size bytes copied from buf.
Buffer(std::size_t size)
Creates a Buffer with storage for size bytes.
std::byte * operator*() const
Returns a mutable pointer to the owned bytes, equivalent to data().