Toast Engine
Loading...
Searching...
No Matches
toast::FunctionInfo Struct Reference

Runtime descriptor for one reflected member function. More...

#include <reflect.hpp>

Public Types

using Invoker = void (*)()
 Generic erased trampoline pointer; reinterpret_cast back to the real signature before calling.
using DynamicInvoker = std::any (*)(void* obj, std::span<const std::any> args)
 receives args as std::any, returns std::any (void → empty std::any)

Public Member Functions

auto attributeMap () const -> const nlohmann::json *
auto hasAttribute (std::string_view attr_name) const -> bool
auto getAttribute (std::string_view attr_name) const -> std::string
template<typename R = void, typename... Args>
auto call (void *obj, Args &&... args) const -> R
auto callDynamic (void *obj, std::span< const std::any > args) const -> std::any
 Calls the function with runtime-typed arguments for scripting dispatch.

Public Attributes

std::string_view name
std::string_view return_type
const std::type_info * return_type_id
std::span< const ParameterInfo > parameters
nlohmann::json attributes
Invoker invoke = nullptr
DynamicInvoker invoke_dynamic = nullptr

Detailed Description

Runtime descriptor for one reflected member function.

Note
Do not call invoke directly; go through NodeInfo::call() or callDynamic()

Member Function Documentation

◆ callDynamic()

auto toast::FunctionInfo::callDynamic ( void * obj,
std::span< const std::any > args ) const -> std::any
inlinenodiscard

Calls the function with runtime-typed arguments for scripting dispatch.

Each element of args must hold the exact std::decay_t<ParamType> that we expect Arg count must match parameters.size() exactly

Returns
the function's return value boxed in std::any, or an empty std::any for void functions

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