[Glacier] Add buffer types for holding bytes and capabilities.
This commit is contained in:
parent
ca5361b847
commit
d45f831b46
3 changed files with 67 additions and 0 deletions
24
lib/glacier/buffer/cap_buffer.h
Normal file
24
lib/glacier/buffer/cap_buffer.h
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue