Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::basic_type_converter< Interface > Struct Template Reference

#include <common.hpp>

Inheritance diagram for sysio::chain::basic_type_converter< Interface >:
Collaboration diagram for sysio::chain::basic_type_converter< Interface >:

Public Types

using base_type = sysio::vm::type_converter<webassembly::interface, Interface>
 
- Public Types inherited from sysio::vm::type_converter< webassembly::interface, Interface >
using base_type
 
using elem_type
 
- Public Types inherited from sysio::vm::running_context< webassembly::interface, Interface >
using running_context_t
 

Public Member Functions

 SYS_VM_FROM_WASM (bool,(uint32_t value))
 
 SYS_VM_FROM_WASM (memcpy_params,(vm::wasm_ptr_t dst, vm::wasm_ptr_t src, vm::wasm_size_t size))
 
 SYS_VM_FROM_WASM (memcmp_params,(vm::wasm_ptr_t lhs, vm::wasm_ptr_t rhs, vm::wasm_size_t size))
 
 SYS_VM_FROM_WASM (memset_params,(vm::wasm_ptr_t dst, int32_t val, vm::wasm_size_t size))
 
template<typename T >
auto from_wasm (vm::wasm_ptr_t ptr) const -> std::enable_if_t< std::is_pointer_v< T >, vm::argument_proxy< T > >
 
template<typename T >
auto from_wasm (vm::wasm_ptr_t ptr, vm::tag< T >={}) const -> std::enable_if_t< vm::is_argument_proxy_type_v< T > &&std::is_pointer_v< typename T::proxy_type >, T >
 
 SYS_VM_FROM_WASM (null_terminated_ptr,(vm::wasm_ptr_t ptr))
 
 SYS_VM_FROM_WASM (name,(uint64_t e))
 
uint64_t to_wasm (name &&n)
 
 SYS_VM_FROM_WASM (float32_t,(float f))
 
 SYS_VM_FROM_WASM (float64_t,(double f))
 
- Public Member Functions inherited from sysio::vm::type_converter< webassembly::interface, Interface >
 SYS_VM_FROM_WASM (bool,(uint32_t value))
 
 SYS_VM_FROM_WASM (bool,(uint32_t value))
 
uint32_t to_wasm (bool &&value)
 
no_match_t to_wasm (T &&)
 
uint32_t to_wasm (bool &&value)
 
no_match_t to_wasm (T &&)
 
auto from_wasm (wasm_ptr_t ptr, wasm_size_t len, tag< T >={}) const -> std::enable_if_t< is_span_type_v< T >, T >
 
auto from_wasm (wasm_ptr_t ptr, wasm_size_t len, tag< T >={}) const -> std::enable_if_t< is_argument_proxy_type_v< T > &&is_span_type_v< typename T::proxy_type >, T >
 
auto from_wasm (wasm_ptr_t ptr, tag< T >={}) const -> std::enable_if_t< is_argument_proxy_type_v< T > &&std::is_pointer_v< typename T::proxy_type >, T >
 
auto from_wasm (wasm_ptr_t ptr, wasm_size_t len, tag< T >={}) const -> std::enable_if_t< is_span_type_v< T >, T >
 
auto from_wasm (wasm_ptr_t ptr, wasm_size_t len, tag< T >={}) const -> std::enable_if_t< is_argument_proxy_type_v< T > &&is_span_type_v< typename T::proxy_type >, T >
 
auto from_wasm (wasm_ptr_t ptr, tag< T >={}) const -> std::enable_if_t< is_argument_proxy_type_v< T > &&std::is_pointer_v< typename T::proxy_type >, T >
 
decltype(auto) as_value (const elem_type &val) const
 
decltype(auto) as_value (const elem_type &val) const
 
constexpr auto as_result (T &&val) const
 
constexpr auto as_result (T &&val) const
 
 running_context (Host_Type *host, const Interface &ei)
 
 running_context (Host_Type *host, Interface &&ei)
 
decltype(auto) get_host ()
 
- Public Member Functions inherited from sysio::vm::running_context< webassembly::interface, Interface >
 running_context (webassembly::interface *host, const Interface &ei)
 
 running_context (webassembly::interface *host, Interface &&ei)
 
 running_context (webassembly::interface *host, const Interface &ei)
 
 running_context (webassembly::interface *host, Interface &&ei)
 
void * access (wasm_ptr_t addr=0) const
 
void * access (wasm_ptr_t addr=0) const
 
Interfaceget_interface ()
 
const Interfaceget_interface () const
 
Interfaceget_interface ()
 
const Interfaceget_interface () const
 
decltype(auto) get_host ()
 
decltype(auto) get_host ()
 
auto validate_pointer (U ptr, wasm_size_t len) const
 
auto validate_pointer (U ptr, wasm_size_t len) const
 
auto validate_null_terminated_pointer (T ptr) const
 
auto validate_null_terminated_pointer (T ptr) const
 

Additional Inherited Members

- Public Attributes inherited from sysio::vm::running_context< webassembly::interface, Interface >
webassembly::interfacehost
 
Interface interface
 

Detailed Description

template<typename Interface>
struct sysio::chain::basic_type_converter< Interface >

Definition at line 60 of file common.hpp.

Member Typedef Documentation

◆ base_type

Definition at line 61 of file common.hpp.

Member Function Documentation

◆ from_wasm() [1/2]

template<typename Interface >
template<typename T >
auto sysio::chain::basic_type_converter< Interface >::from_wasm ( vm::wasm_ptr_t ptr) const -> std::enable_if_t< std::is_pointer_v<T>, vm::argument_proxy<T> >
inline

Definition at line 88 of file common.hpp.

90 {
91 auto p = this->template validate_pointer<std::remove_pointer_t<T>>(ptr, 1);
92 return {p};
93 }
const mie::Vuint & p
Definition bn.cpp:27
Here is the call graph for this function:

◆ from_wasm() [2/2]

template<typename Interface >
template<typename T >
auto sysio::chain::basic_type_converter< Interface >::from_wasm ( vm::wasm_ptr_t ptr,
vm::tag< T > = {} ) const -> std::enable_if_t< vm::is_argument_proxy_type_v<T> && std::is_pointer_v<typename T::proxy_type>, T>
inline

Definition at line 96 of file common.hpp.

96 {}) const
97 -> std::enable_if_t< vm::is_argument_proxy_type_v<T> &&
98 std::is_pointer_v<typename T::proxy_type>, T> {
99 if constexpr(T::is_legacy()) {
100 SYS_ASSERT(ptr != 0, wasm_execution_error, "references cannot be created for null pointers");
101 }
102 auto p = this->template validate_pointer<typename T::pointee_type>(ptr, 1);
103 return {p};
104 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
#define T(meth, val, expected)

◆ SYS_VM_FROM_WASM() [1/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( bool ,
(uint32_t value)  )
inline

Definition at line 66 of file common.hpp.

66{ return value ? 1 : 0; }
#define value
Definition pkcs11.h:157

◆ SYS_VM_FROM_WASM() [2/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( float32_t ,
(float f)  )
inline

Definition at line 112 of file common.hpp.

112{ return ::to_softfloat32(f); }

◆ SYS_VM_FROM_WASM() [3/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( float64_t ,
(double f)  )
inline

Definition at line 113 of file common.hpp.

113{ return ::to_softfloat64(f); }

◆ SYS_VM_FROM_WASM() [4/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( memcmp_params ,
(vm::wasm_ptr_t lhs, vm::wasm_ptr_t rhs, vm::wasm_size_t size)  )
inline

Definition at line 75 of file common.hpp.

75 {
76 auto l = this->template validate_pointer<char>(lhs, size);
77 auto r = this->template validate_pointer<char>(rhs, size);
78 return { l, r, size };
79 }
const mie::Vuint & r
Definition bn.cpp:28
int l
Here is the call graph for this function:

◆ SYS_VM_FROM_WASM() [5/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( memcpy_params ,
(vm::wasm_ptr_t dst, vm::wasm_ptr_t src, vm::wasm_size_t size)  )
inline

Definition at line 68 of file common.hpp.

68 {
69 auto d = this->template validate_pointer<char>(dst, size);
70 auto s = this->template validate_pointer<char>(src, size);
71 this->template validate_pointer<char>(dst, 1);
72 return { d, s, size };
73 }
CK_ULONG d
char * s
Here is the call graph for this function:

◆ SYS_VM_FROM_WASM() [6/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( memset_params ,
(vm::wasm_ptr_t dst, int32_t val, vm::wasm_size_t size)  )
inline

Definition at line 81 of file common.hpp.

81 {
82 auto d = this->template validate_pointer<char>(dst, size);
83 this->template validate_pointer<char>(dst, 1);
84 return { d, val, size };
85 }
Here is the call graph for this function:

◆ SYS_VM_FROM_WASM() [7/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( name ,
(uint64_t e)  )
inline

Definition at line 110 of file common.hpp.

110{ return name{e}; }
std::string name

◆ SYS_VM_FROM_WASM() [8/8]

template<typename Interface >
sysio::chain::basic_type_converter< Interface >::SYS_VM_FROM_WASM ( null_terminated_ptr ,
(vm::wasm_ptr_t ptr)  )
inline

Definition at line 106 of file common.hpp.

106 {
107 auto p = this->validate_null_terminated_pointer(ptr);
108 return {static_cast<const char*>(p)};
109 }
Here is the call graph for this function:

◆ to_wasm()

template<typename Interface >
uint64_t sysio::chain::basic_type_converter< Interface >::to_wasm ( name && n)
inline

Definition at line 111 of file common.hpp.

111{ return n.to_uint64_t(); }

The documentation for this struct was generated from the following file: