2023-11-04 15:32:45 +01:00
|
|
|
#pragma once
|
2024-11-27 20:44:36 +01:00
|
|
|
|
2023-11-04 15:32:45 +01:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class HeapMemoryFixedSize {
|
|
|
|
public:
|
2024-11-27 20:44:36 +01:00
|
|
|
HeapMemoryFixedSize();
|
2023-11-04 15:32:45 +01:00
|
|
|
|
2024-11-27 20:44:36 +01:00
|
|
|
explicit HeapMemoryFixedSize(std::size_t size);
|
2023-11-04 15:32:45 +01:00
|
|
|
|
|
|
|
// Delete the copy constructor and copy assignment operator
|
|
|
|
HeapMemoryFixedSize(const HeapMemoryFixedSize &) = delete;
|
|
|
|
HeapMemoryFixedSize &operator=(const HeapMemoryFixedSize &) = delete;
|
|
|
|
|
2024-11-27 20:44:36 +01:00
|
|
|
HeapMemoryFixedSize(HeapMemoryFixedSize &&other) noexcept;
|
|
|
|
|
|
|
|
HeapMemoryFixedSize &operator=(HeapMemoryFixedSize &&other) noexcept;
|
|
|
|
|
|
|
|
explicit operator bool() const;
|
|
|
|
|
|
|
|
[[nodiscard]] const void *data() const;
|
|
|
|
|
|
|
|
[[nodiscard]] std::size_t size() const;
|
2023-11-04 15:32:45 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<uint8_t[]> mData{};
|
|
|
|
std::size_t mSize{};
|
|
|
|
};
|