11#ifndef ARK_VM_SCOPE_HPP
12#define ARK_VM_SCOPE_HPP
29 using pair_t = std::pair<uint16_t, Value>;
50 void push_back(uint16_t
id,
Value&& val)
noexcept;
58 void push_back(uint16_t
id,
const Value& val)
noexcept;
67 bool maybeHas(uint16_t
id)
const noexcept;
75 Value* operator[](uint16_t id_to_look_for)
noexcept;
83 const Value* operator[](uint16_t id_to_look_for)
const noexcept;
91 [[nodiscard]] uint16_t idFromValue(
const Value& val)
const noexcept;
98 [[nodiscard]]
inline const pair_t&
atPos(
const std::size_t i)
const noexcept
100 return m_storage[m_start + i];
110 return m_storage[m_start + m_size - 1 - i];
116 void reset() noexcept;
123 [[nodiscard]] inline std::
size_t size() const noexcept
135 return m_start + m_size;
Default value type handled by the virtual machine.
The ArkScript virtual machine, executing ArkScript bytecode.
A class to handle the VM scope more efficiently.
ScopeView()=delete
Deleted constructor to avoid creating ScopeViews pointing to nothing. Helps catch bugs at compile tim...
uint16_t m_max_id
Maximum stored ID, used for a basic bloom filter.
std::size_t storageEnd() const noexcept
Compute the position of the first free slot in the shared storage, after this scope.
std::pair< uint16_t, Value > pair_t
const pair_t & atPos(const std::size_t i) const noexcept
Return the element at index in scope.
uint16_t m_min_id
Minimum stored ID, used for a basic bloom filter.
pair_t & atPosReverse(const std::size_t i) noexcept
Return the element at index, starting from the end.
bool operator==(const Namespace &A, const Namespace &B)