ChaiScript
Classes | Functions
chaiscript::dispatch Namespace Reference

Classes and functions specific to the runtime dispatch side of ChaiScript. More...

Classes

class  Assignable_Proxy_Function
 
class  Assignable_Proxy_Function_Impl
 
class  Attribute_Access
 Attribute getter Proxy_Function implementation. More...
 
class  Bound_Function
 An implementation of Proxy_Function that takes a Proxy_Function and substitutes bound parameters into the parameter list at runtime, when call() is executed. More...
 
class  Dynamic_Object
 
class  Dynamic_Proxy_Function
 A Proxy_Function implementation that is not type safe, the called function is expecting a vector<Boxed_Value> that it works with how it chooses. More...
 
class  Dynamic_Proxy_Function_Impl
 
struct  option_explicit_set
 
class  Param_Types
 
struct  Placeholder_Object
 An object used by Bound_Function to represent "_" parameters of a binding. More...
 
class  Proxy_Function_Base
 Pure virtual base class for all Proxy_Function implementations Proxy_Functions are a type erasure of type safe C++ function calls. More...
 
class  Proxy_Function_Callable_Impl
 For any callable object. More...
 
class  Proxy_Function_Impl_Base
 

Functions

template<typename FunctionType >
std::function< FunctionType > functor (const std::vector< Const_Proxy_Function > &funcs, const Type_Conversions_State *t_conversions)
 Build a function caller that knows how to dispatch on a set of functions example: std::function<void (int)> f = build_function_caller(dispatchkit.get_function("print"));. More...
 
template<typename FunctionType >
std::function< FunctionType > functor (Const_Proxy_Function func, const Type_Conversions_State *t_conversions)
 Build a function caller for a particular Proxy_Function object useful in the case that a function is being pass out from scripting back into code example: void my_function(Proxy_Function f) { std::function<void (int)> local_f = build_function_caller(f); }. More...
 
template<typename FunctionType >
std::function< FunctionType > functor (const Boxed_Value &bv, const Type_Conversions_State *t_conversions)
 Helper for automatically unboxing a Boxed_Value that contains a function object and creating a typesafe C++ function caller from it. More...
 
template<typename FunctionType >
std::function< FunctionType > functor (std::shared_ptr< const Proxy_Function_Base > func, const Type_Conversions_State *t_conversions)
 
template<typename Callable , typename ... Arg>
Proxy_Function make_dynamic_proxy_function (Callable &&c, Arg &&... a)
 
template<typename Funcs >
Boxed_Value dispatch (const Funcs &funcs, const Function_Params &plist, const Type_Conversions_State &t_conversions)
 Take a vector of functions and a vector of parameters. More...
 

Detailed Description

Classes and functions specific to the runtime dispatch side of ChaiScript.

Some items may be of use to the end user.

Function Documentation

§ dispatch()

template<typename Funcs >
Boxed_Value chaiscript::dispatch::dispatch ( const Funcs &  funcs,
const Function_Params plist,
const Type_Conversions_State t_conversions 
)

Take a vector of functions and a vector of parameters.

Attempt to execute each function against the set of parameters, in order, until a matching function is found or throw dispatch_error if no matching function is found

§ functor() [1/3]

template<typename FunctionType >
std::function<FunctionType> chaiscript::dispatch::functor ( const std::vector< Const_Proxy_Function > &  funcs,
const Type_Conversions_State t_conversions 
)

Build a function caller that knows how to dispatch on a set of functions example: std::function<void (int)> f = build_function_caller(dispatchkit.get_function("print"));.

Returns
A std::function object for dispatching
Parameters
[in]funcsthe set of functions to dispatch on.

§ functor() [2/3]

template<typename FunctionType >
std::function<FunctionType> chaiscript::dispatch::functor ( Const_Proxy_Function  func,
const Type_Conversions_State t_conversions 
)

Build a function caller for a particular Proxy_Function object useful in the case that a function is being pass out from scripting back into code example: void my_function(Proxy_Function f) { std::function<void (int)> local_f = build_function_caller(f); }.

Returns
A std::function object for dispatching
Parameters
[in]funcA function to execute.

§ functor() [3/3]

template<typename FunctionType >
std::function<FunctionType> chaiscript::dispatch::functor ( const Boxed_Value bv,
const Type_Conversions_State t_conversions 
)

Helper for automatically unboxing a Boxed_Value that contains a function object and creating a typesafe C++ function caller from it.