1#ifndef WASMTIME_VAL_CLASS_HH
2#define WASMTIME_VAL_CLASS_HH
5#include <wasmtime/_anyref_class.hh>
6#include <wasmtime/_arrayref_class.hh>
7#include <wasmtime/_eqref_class.hh>
8#include <wasmtime/_externref_class.hh>
9#include <wasmtime/_func_class.hh>
10#include <wasmtime/_store_class.hh>
11#include <wasmtime/_structref_class.hh>
95 Val(std::optional<Func> func);
98#ifdef WASMTIME_FEATURE_GC
100 Val(std::optional<ExternRef> ptr);
102 Val(std::optional<AnyRef> ptr);
125 other.val.of.i32 = 0;
133 other.val.of.i32 = 0;
152 return ValKind::FuncRef;
154 return ValKind::ExternRef;
156 return ValKind::AnyRef;
158 return ValKind::ExnRef;
160 return ValKind::V128;
210#ifdef WASMTIME_FEATURE_GC
216 std::optional<ExternRef> externref()
const;
223 std::optional<AnyRef> anyref()
const;
231 std::optional<Func>
funcref()
const;
Representation of a WebAssembly anyref value.
Definition: _anyref_class.hh:21
Representation of a WebAssembly externref value.
Definition: _externref_class.hh:27
Representation of a WebAssembly function.
Definition: _func_class.hh:108
A WebAssembly global.
Definition: global.hh:28
A WebAssembly table.
Definition: table.hh:31
Representation of a generic WebAssembly value.
Definition: _val_class.hh:53
Val(const Val &other)
Copy constructor to clone other.
Definition: _val_class.hh:112
Val(int32_t i32)
Creates a new i32 WebAssembly value.
Definition: _val_class.hh:70
Val(float f32)
Creates a new f32 WebAssembly value.
Definition: _val_class.hh:80
float f32() const
Definition: _val_class.hh:185
int32_t i32() const
Definition: _val_class.hh:167
double f64() const
Definition: _val_class.hh:194
const Raw * capi() const
Returns the underlying C API pointer.
Definition: _val_class.hh:239
int64_t i64() const
Definition: _val_class.hh:176
V128 v128() const
Definition: _val_class.hh:203
ValKind kind() const
Returns the kind of value that this value has.
Definition: _val_class.hh:141
Val(int64_t i64)
Creates a new i64 WebAssembly value.
Definition: _val_class.hh:75
Raw * capi()
Returns the underlying C API pointer.
Definition: _val_class.hh:244
Val(const V128 &v128)
Creates a new v128 WebAssembly value.
Definition: _val_class.hh:90
~Val()
Unroots the values in val, if any.
Definition: _val_class.hh:138
Val(wasmtime_val_t val)
Creates a new value from the raw C API representation.
Definition: _val_class.hh:67
Val(double f64)
Creates a new f64 WebAssembly value.
Definition: _val_class.hh:85
Val & operator=(const Val &other)
Copy assignment to clone from other.
Definition: _val_class.hh:115
Val & operator=(Val &&other)
Move assignment to move the contents of other.
Definition: _val_class.hh:129
std::optional< Func > funcref() const
Definition: val.hh:26
Val(Val &&other)
Move constructor to move the contents of other.
Definition: _val_class.hh:122
Container for the v128 WebAssembly type.
Definition: _val_class.hh:18
V128()
Creates a new zero-value v128.
Definition: _val_class.hh:23
wasmtime_v128 v128
The little-endian bytes of the v128 value.
Definition: _val_class.hh:20
V128(const wasmtime_v128 &v)
Creates a new V128 from its C API representation.
Definition: _val_class.hh:26
Container for different kinds of wasm values.
Definition: val.h:376
wasmtime_valkind_t kind
Discriminant of which field of of is valid.
Definition: val.h:378
wasmtime_valunion_t of
Container for the extern item's value.
Definition: val.h:380
int32_t i32
Field used if wasmtime_val_t::kind is WASMTIME_I32.
Definition: val.h:235
wasmtime_v128 v128
Field used if wasmtime_val_t::kind is WASMTIME_V128.
Definition: val.h:256
float32_t f32
Field used if wasmtime_val_t::kind is WASMTIME_F32.
Definition: val.h:239
int64_t i64
Field used if wasmtime_val_t::kind is WASMTIME_I64.
Definition: val.h:237
float64_t f64
Field used if wasmtime_val_t::kind is WASMTIME_F64.
Definition: val.h:241
#define WASMTIME_EXTERNREF
Value of wasmtime_valkind_t meaning that wasmtime_val_t is an externref.
Definition: val.h:38
#define WASMTIME_ANYREF
Value of wasmtime_valkind_t meaning that wasmtime_val_t is an anyref.
Definition: val.h:41
#define WASMTIME_I32
Value of wasmtime_valkind_t meaning that wasmtime_val_t is an i32.
Definition: val.h:22
uint8_t wasmtime_v128[16]
A 128-bit value representing the WebAssembly v128 type. Bytes are stored in little-endian order.
Definition: val.h:49
#define WASMTIME_F32
Value of wasmtime_valkind_t meaning that wasmtime_val_t is a f32.
Definition: val.h:26
#define WASMTIME_FUNCREF
Value of wasmtime_valkind_t meaning that wasmtime_val_t is a funcref.
Definition: val.h:33
WASM_API_EXTERN void wasmtime_val_unroot(wasmtime_val_t *val)
Unroot the value contained by val.
#define WASMTIME_F64
Value of wasmtime_valkind_t meaning that wasmtime_val_t is a f64.
Definition: val.h:28
WASM_API_EXTERN void wasmtime_val_clone(const wasmtime_val_t *src, wasmtime_val_t *dst)
Clones the value pointed to by src into the dst provided.
struct wasmtime_val wasmtime_val_t
Convenience alias for wasmtime_val_t.
#define WASMTIME_I64
Value of wasmtime_valkind_t meaning that wasmtime_val_t is an i64.
Definition: val.h:24
#define WASMTIME_EXNREF
Value of wasmtime_valkind_t meaning that wasmtime_val_t is an exnref.
Definition: val.h:44
#define WASMTIME_V128
Value of wasmtime_valkind_t meaning that wasmtime_val_t is a v128.
Definition: val.h:30