5#ifndef WASMTIME_TYPES_MEMORY_HH
6#define WASMTIME_TYPES_MEMORY_HH
25 std::unique_ptr<wasm_memorytype_t, deleter> ptr;
46 std::optional<uint64_t>
max()
const {
114 std::optional<uint64_t> _max;
120 Builder() : _min(0), _memory64(false), _shared(false) {}
149 _min, _max.has_value(), _max.has_value() ? *_max : 0,
150 _memory64, _shared));
Helper class to build a MemoryType.
Definition: memory.hh:112
Builder & max(std::optional< uint64_t > max)
Configure the maximal size, in pages, of linear memory.
Definition: memory.hh:129
Builder & memory64(bool enable)
Configure whether this is a 64-bit linear memory.
Definition: memory.hh:135
Builder & min(uint64_t min)
Configure the minimum size, in pages, of linear memory.
Definition: memory.hh:123
MemoryType build() const
Construct the final MemoryType value.
Definition: memory.hh:147
Builder()
Default constructor for a memory type with 0 initial size.
Definition: memory.hh:120
Builder & shared(bool enable)
Configure whether this is a shared linear memory.
Definition: memory.hh:141
Non-owning reference to a MemoryType, must not be used after the original owner has been deleted.
Definition: memory.hh:30
Ref(const wasm_memorytype_t *ptr)
Creates a reference from the raw C API representation.
Definition: memory.hh:37
bool is_64() const
Returns whether or not this is a 64-bit memory type.
Definition: memory.hh:56
bool is_shared() const
Returns whether or not this is a shared memory type.
Definition: memory.hh:59
std::optional< uint64_t > max() const
Definition: memory.hh:46
uint64_t min() const
Returns the minimum size, in WebAssembly pages, of this memory.
Definition: memory.hh:42
Ref(const MemoryType &ty)
Creates a reference from an original MemoryType.
Definition: memory.hh:39
Type information about a WebAssembly linear memory.
Definition: memory.hh:18
Ref * operator*()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: memory.hh:109
MemoryType & operator=(const MemoryType &other)
Copies the provided type into a new type.
Definition: memory.hh:94
MemoryType(const MemoryType &other)
Copies the provided type into a new type.
Definition: memory.hh:91
MemoryType(Ref other)
Definition: memory.hh:89
static MemoryType New64(uint64_t min, uint64_t max)
Same as the MemoryType constructor, except creates a 64-bit memory.
Definition: memory.hh:83
static MemoryType New64(uint64_t min)
Same as the MemoryType constructor, except creates a 64-bit memory.
Definition: memory.hh:78
MemoryType & operator=(MemoryType &&other)=default
Moves the type information from another type into this one.
MemoryType(MemoryType &&other)=default
Moves the type information from another type into this one.
MemoryType(uint32_t min, uint32_t max)
Definition: memory.hh:74
Ref * operator->()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: memory.hh:106
MemoryType(uint32_t min)
Definition: memory.hh:70
A WebAssembly linear memory.
Definition: wasmtime.hh:864
uint64_t wasmtime_memorytype_minimum(const wasm_memorytype_t *ty)
Returns the minimum size, in pages, of the specified memory type.
bool wasmtime_memorytype_is64(const wasm_memorytype_t *ty)
Returns whether this type of memory represents a 64-bit memory.
bool wasmtime_memorytype_isshared(const wasm_memorytype_t *ty)
Returns whether this type of memory represents a shared memory.
wasm_memorytype_t * wasmtime_memorytype_new(uint64_t min, bool max_present, uint64_t max, bool is_64, bool shared)
Creates a new memory type from the specified parameters.
bool wasmtime_memorytype_maximum(const wasm_memorytype_t *ty, uint64_t *max)
Returns the maximum size, in pages, of the specified memory type.
An opaque object representing the type of a memory.
void wasm_memorytype_delete(wasm_memorytype_t *)
Deletes a type.
wasm_memorytype_t * wasm_memorytype_copy(const wasm_memorytype_t *)
Creates a new value which matches the provided one.