[Glacier] Add buffer types for holding bytes and capabilities.

This commit is contained in:
Drew Galbraith 2023-10-24 12:35:37 -07:00
parent ca5361b847
commit d45f831b46
3 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,24 @@
#pragma once
#include <stdint.h>
namespace glcr {
// TODO: Hold cap type instead of uint64_t
class CapBuffer {
public:
CapBuffer(uint64_t size) : buffer_(new uint64_t[size]) {}
CapBuffer(const CapBuffer&) = delete;
CapBuffer(CapBuffer&&) = delete;
~CapBuffer() { delete[] buffer_; }
uint64_t At(uint64_t offset) const { return buffer_[offset]; }
void WriteAt(uint64_t offset, uint64_t cap) { buffer_[offset] = cap; }
private:
uint64_t* buffer_;
};
} // namespace glcr