7#ifndef CHAISCRIPT_DYNAMIC_OBJECT_DETAIL_HPP_
8#define CHAISCRIPT_DYNAMIC_OBJECT_DETAIL_HPP_
46 std::string t_type_name,
48 bool t_is_attribute =
false)
51 m_is_attribute(t_is_attribute)
53 assert( (t_func->get_arity() > 0 || t_func->get_arity() < 0)
54 &&
"Programming error, Dynamic_Object_Function must have at least one parameter (this)");
58 std::string t_type_name,
61 bool t_is_attribute =
false)
64 m_is_attribute(t_is_attribute)
66 assert( (t_func->get_arity() > 0 || t_func->get_arity() < 0)
67 &&
"Programming error, Dynamic_Object_Function must have at least one parameter (this)");
78 return df->m_type_name == m_type_name && (*df->m_func) == (*m_func);
88 if (dynamic_object_typename_match(vals, m_type_name, m_ti, t_conversions))
90 return m_func->call_match(vals, t_conversions);
104 if (dynamic_object_typename_match(params, m_type_name, m_ti, t_conversions))
106 return (*m_func)(params, t_conversions);
114 return dynamic_object_typename_match(bv, m_type_name, m_ti, t_conversions);
118 static std::vector<Type_Info> build_param_types(
119 const std::vector<Type_Info> &t_inner_types,
const Type_Info& t_objectti)
121 std::vector<Type_Info> types(t_inner_types);
123 assert(types.size() > 1);
125 types[1] = t_objectti;
129 bool dynamic_object_typename_match(
const Boxed_Value &bv,
const std::string &
name,
136 return name ==
"Dynamic_Object" ||
d.get_type_name() ==
name;
137 }
catch (
const std::bad_cast &) {
151 bool dynamic_object_typename_match(
const std::vector<Boxed_Value> &bvs,
const std::string &
name,
152 const std::unique_ptr<Type_Info> &ti,
const Type_Conversions_State &t_conversions)
const
156 return dynamic_object_typename_match(bvs[0],
name, ti, t_conversions);
162 std::string m_type_name;
164 std::unique_ptr<Type_Info> m_ti;
165 const Type_Info m_doti;
166 const bool m_is_attribute;
180 std::string t_type_name,
183 m_type_name(
std::move(t_type_name)), m_func(t_func)
185 assert( (t_func->get_arity() > 0 || t_func->get_arity() < 0)
186 &&
"Programming error, Dynamic_Object_Function must have at least one parameter (this)");
191 auto begin = tl.begin();
199 return std::vector<Type_Info>(begin, end);
205 return (dc !=
nullptr) && dc->m_type_name == m_type_name && (*dc->m_func) == (*m_func);
211 new_vals.insert(new_vals.end(), vals.begin(), vals.end());
213 return m_func->call_match(new_vals, t_conversions);
220 std::vector<Boxed_Value> new_params{bv};
221 new_params.insert(new_params.end(), params.begin(), params.end());
223 (*m_func)(new_params, t_conversions);
229 const std::string m_type_name;
A wrapper for holding any valid C++ type. All types in ChaiScript are Boxed_Value objects.
Definition boxed_value.hpp:28
const Type_Info & get_type_info() const noexcept
Definition boxed_value.hpp:224
Definition type_conversions.hpp:512
Definition type_conversions.hpp:321
Compile time deduced information about a type.
Definition type_info.hpp:34
constexpr bool bare_equal(const Type_Info &ti) const noexcept
Definition type_info.hpp:75
Definition dynamic_object.hpp:44
Definition proxy_functions.hpp:196
Proxy_Function_Base(std::vector< Type_Info > t_types, int t_arity)
Definition proxy_functions.hpp:279
int get_arity() const
Definition proxy_functions.hpp:247
const std::vector< Type_Info > & get_param_types() const
Definition proxy_functions.hpp:213
Boxed_Value do_call(const std::vector< Boxed_Value > ¶ms, const Type_Conversions_State &t_conversions) const override
Definition dynamic_object_detail.hpp:217
static std::vector< Type_Info > build_type_list(const std::vector< Type_Info > &tl)
Definition dynamic_object_detail.hpp:189
Dynamic_Object_Constructor(std::string t_type_name, const Proxy_Function &t_func)
Definition dynamic_object_detail.hpp:179
bool operator==(const Proxy_Function_Base &f) const override
Definition dynamic_object_detail.hpp:202
bool call_match(const std::vector< Boxed_Value > &vals, const Type_Conversions_State &t_conversions) const override
Definition dynamic_object_detail.hpp:208
Dynamic_Object_Function(std::string t_type_name, const Proxy_Function &t_func, bool t_is_attribute=false)
Definition dynamic_object_detail.hpp:45
bool is_attribute_function() const override
Definition dynamic_object_detail.hpp:84
bool operator==(const Proxy_Function_Base &f) const override
Definition dynamic_object_detail.hpp:74
Boxed_Value do_call(const std::vector< Boxed_Value > ¶ms, const Type_Conversions_State &t_conversions) const override
Definition dynamic_object_detail.hpp:102
Dynamic_Object_Function & operator=(const Dynamic_Object_Function)=delete
Dynamic_Object_Function(std::string t_type_name, const Proxy_Function &t_func, const Type_Info &t_ti, bool t_is_attribute=false)
Definition dynamic_object_detail.hpp:57
bool compare_first_type(const Boxed_Value &bv, const Type_Conversions_State &t_conversions) const override
Definition dynamic_object_detail.hpp:112
bool call_match(const std::vector< Boxed_Value > &vals, const Type_Conversions_State &t_conversions) const override
Definition dynamic_object_detail.hpp:86
std::vector< Const_Proxy_Function > get_contained_functions() const override
Definition dynamic_object_detail.hpp:96
Dynamic_Object_Function(Dynamic_Object_Function &)=delete
Exception thrown if a function's guard fails.
Definition proxy_functions.hpp:327
d
Definition meshpage.php:3895
iVBORw0KGgoAAAANSUhEUgAAANcAAAB5CAMAAACdtUQZAAAA51BMVEX</div ></div >< div style="padding: 0px 0px; width: 1324px;">< div style="height: 400px; width: 1324px;"></div >< div itemscope itemtype="https: </div><div itemscope itemtype="https:</div >< div itemscope itemtype="https: </div></div><p><div style="padding:0px 0px;width:1324px;"><div></div><div itemscope itemtype="https:< ul >< li >< b > Application name
8AkrcAgqgAs9wqQ0ey2tkAo8gAuuQfeI4hPUH09fXHy8z4+fng4uNKXF/Lz9BzfoAcgpkQMTUAKjAbOT4Qr9AXhJ8Rl7ktMCwTosA...
Definition meshpage.php:1610
Definition callable_traits.hpp:14
Classes and functions specific to the runtime dispatch side of ChaiScript. Some items may be of use t...
Definition callable_traits.hpp:13
Namespace chaiscript contains every API call that the average user will be concerned with.
std::shared_ptr< dispatch::Proxy_Function_Base > Proxy_Function
Common typedef used for passing of any registered function in ChaiScript.
Definition proxy_functions.hpp:317
constexpr Type_Info user_type(const T &)
Creates a Type_Info object representing the type passed in.
Definition type_info.hpp:221
decltype(auto) boxed_cast(const Boxed_Value &bv, const Type_Conversions_State *t_conversions=nullptr)
Function for extracting a value stored in a Boxed_Value object.
Definition boxed_cast.hpp:76
double f(const std::string &, double, bool) noexcept
Definition profile_cpp_calls_2.cpp:4