A class to handle the VM scope more efficiently.
More...
#include <ScopeView.hpp>
|
| ScopeView ()=delete |
| Deleted constructor to avoid creating ScopeViews pointing to nothing. Helps catch bugs at compile time.
|
|
| ScopeView (pair_t *storage, std::size_t start) noexcept |
| Create a new ScopeView.
|
|
void | push_back (uint16_t id, Value &&val) noexcept |
| Put a value in the scope.
|
|
void | push_back (uint16_t id, const Value &val) noexcept |
| Put a value in the scope.
|
|
bool | maybeHas (uint16_t id) const noexcept |
| Check if the scope maybe holds a specific symbol in memory.
|
|
Value * | operator[] (uint16_t id_to_look_for) noexcept |
| Get a value from its symbol id.
|
|
const Value * | operator[] (uint16_t id_to_look_for) const noexcept |
| Get a value from its symbol id.
|
|
uint16_t | idFromValue (const Value &val) const noexcept |
| Get the id of a variable based on its value ; used for debug only.
|
|
const pair_t & | atPos (const std::size_t i) const noexcept |
| Return the element at index in scope.
|
|
pair_t & | atPosReverse (const std::size_t i) noexcept |
| Return the element at index, starting from the end.
|
|
void | reset () noexcept |
| Reset size, min and max id for the scope, to signify it's empty.
|
|
std::size_t | size () const noexcept |
| Return the size of the scope.
|
|
std::size_t | storageEnd () const noexcept |
| Compute the position of the first free slot in the shared storage, after this scope.
|
|
A class to handle the VM scope more efficiently.
Definition at line 26 of file ScopeView.hpp.
◆ pair_t
◆ ScopeView() [1/2]
Ark::internal::ScopeView::ScopeView |
( |
| ) |
|
|
delete |
Deleted constructor to avoid creating ScopeViews pointing to nothing. Helps catch bugs at compile time.
◆ ScopeView() [2/2]
Ark::internal::ScopeView::ScopeView |
( |
pair_t * | storage, |
|
|
std::size_t | start ) |
|
noexcept |
Create a new ScopeView.
- Parameters
-
storage | pointer to the shared scope storage |
start | first free starting position |
Definition at line 7 of file ScopeView.cpp.
◆ atPos()
const pair_t & Ark::internal::ScopeView::atPos |
( |
const std::size_t | i | ) |
const |
|
inlinenodiscardnoexcept |
◆ atPosReverse()
pair_t & Ark::internal::ScopeView::atPosReverse |
( |
const std::size_t | i | ) |
|
|
inlinenodiscardnoexcept |
Return the element at index, starting from the end.
- Returns
- const pair_t&
Definition at line 108 of file ScopeView.hpp.
◆ idFromValue()
uint16_t Ark::internal::ScopeView::idFromValue |
( |
const Value & | val | ) |
const |
|
nodiscardnoexcept |
Get the id of a variable based on its value ; used for debug only.
- Parameters
-
- Returns
- uint16_t
Definition at line 66 of file ScopeView.cpp.
◆ maybeHas()
bool Ark::internal::ScopeView::maybeHas |
( |
uint16_t | id | ) |
const |
|
noexcept |
Check if the scope maybe holds a specific symbol in memory.
- Parameters
-
- Returns
- true On success
-
false Otherwise
Definition at line 33 of file ScopeView.cpp.
◆ operator[]() [1/2]
const Value * Ark::internal::ScopeView::operator[] |
( |
uint16_t | id_to_look_for | ) |
const |
|
noexcept |
Get a value from its symbol id.
- Parameters
-
- Returns
- const Value* Returns nullptr if the value can not be found
Definition at line 52 of file ScopeView.cpp.
◆ operator[]() [2/2]
Value * Ark::internal::ScopeView::operator[] |
( |
uint16_t | id_to_look_for | ) |
|
|
noexcept |
Get a value from its symbol id.
- Parameters
-
- Returns
- Value* Returns nullptr if the value can not be found
Definition at line 38 of file ScopeView.cpp.
◆ push_back() [1/2]
void Ark::internal::ScopeView::push_back |
( |
uint16_t | id, |
|
|
const Value & | val ) |
|
noexcept |
Put a value in the scope.
- Parameters
-
id | The symbol id of the variable |
val | The value linked to the symbol |
Definition at line 22 of file ScopeView.cpp.
◆ push_back() [2/2]
void Ark::internal::ScopeView::push_back |
( |
uint16_t | id, |
|
|
Value && | val ) |
|
noexcept |
◆ reset()
void Ark::internal::ScopeView::reset |
( |
| ) |
|
|
noexcept |
◆ size()
std::size_t Ark::internal::ScopeView::size |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ storageEnd()
std::size_t Ark::internal::ScopeView::storageEnd |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Compute the position of the first free slot in the shared storage, after this scope.
- Returns
- std::size_t
Definition at line 133 of file ScopeView.hpp.
◆ Ark::VM
◆ operator==
◆ m_max_id
uint16_t Ark::internal::ScopeView::m_max_id |
|
private |
Maximum stored ID, used for a basic bloom filter.
Definition at line 147 of file ScopeView.hpp.
Referenced by reset().
◆ m_min_id
uint16_t Ark::internal::ScopeView::m_min_id |
|
private |
Minimum stored ID, used for a basic bloom filter.
Definition at line 146 of file ScopeView.hpp.
Referenced by reset().
◆ m_size
std::size_t Ark::internal::ScopeView::m_size |
|
private |
◆ m_start
std::size_t Ark::internal::ScopeView::m_start |
|
private |
◆ m_storage
pair_t* Ark::internal::ScopeView::m_storage |
|
private |
The documentation for this class was generated from the following files:
- /Users/fola/Documents/ArkScript/Ark/include/Ark/VM/ScopeView.hpp
- /Users/fola/Documents/ArkScript/Ark/src/arkreactor/VM/ScopeView.cpp