10 using namespace Reflex;
14 method_(method), ints_(ints), isFunction_(method.IsFunctionMember())
25 method_(other.method_), ints_(other.ints_), isFunction_(other.isFunction_) {
38 for(
size_t i = 0;
i <
ints_.size(); ++
i) {
45 Reflex::Object
ret = retstore;
55 retType =
method_.TypeOf().ReturnType();
60 void * addr = ret.Address();
64 <<
"method \"" <<
method_.Name() <<
"\" called with " <<
args_.size()
65 <<
" arguments returned a null pointer ";
68 if(retType.IsPointer() || retType.IsReference()) {
69 if (retType.IsPointer()) {
70 retType = retType.ToType();
72 retType =
Type(retType, 0);
74 while (retType.IsTypedef()) retType = retType.ToType();
75 ret = Object(retType, *static_cast<void **>(addr));
80 <<
"method \"" <<
method_.Name()
81 <<
"\" returned void invoked on object of type \""
82 << o.TypeOf().Name(QUALIFIED) <<
"\"\n";
88 argsBeforeFixups_(args)
111 pair<Object, bool>
ret(o,
false);
114 if (type.IsClass()) type = ret.first.DynamicType();
115 ret =
invoker(type).
invoke(Object(type, ret.first.Address()), v);
116 }
while (ret.second ==
false);
123 pair<Object, bool>
ret(o,
false);
127 if (type.IsClass()) type = ret.first.DynamicType();
129 ret = i->
invoke(Object(type, ret.first.Address()), v);
130 }
while (ret.second ==
false);
135 const std::string &
name,
136 const std::vector<AnyMethodArgument> &
args)
142 isRefGet_ = !setter.
push(name, args,
"LazyInvoker dynamic resolution",
false);
178 <<
"member \"" <<
invokers_.back().method().Name(QUALIFIED)
179 <<
"\" return type is \"" <<
invokers_.back().method().TypeOf().Name(QUALIFIED)
180 <<
"\" retured a \"" << o.TypeOf().Name(QUALIFIED)
181 <<
"\" which is not convertible to double.";
std::map< void *, SingleInvokerPtr > invokers_
method::TypeCode retType_
std::vector< void * > args_
MethodInvoker & operator=(const MethodInvoker &)
bool isRefGet_
true if this invoker just pops out a ref and returns (ref.get(), false)
bool storageNeedsDestructor_
MethodInvoker(const Reflex::Member &method, const std::vector< AnyMethodArgument > &ints=std::vector< AnyMethodArgument >())
bool push(const std::string &, const std::vector< AnyMethodArgument > &, const char *, bool deep=true) const
double retToDouble(const Reflex::Object &o) const
Reflex::Object invoke(const Reflex::Object &o, Reflex::Object &retstore) const
boost::shared_ptr< SingleInvoker > SingleInvokerPtr
static void delStorage(Reflex::Object &obj)
static bool isValidReturnType(method::TypeCode)
std::vector< AnyMethodArgument > MethodArgumentStack
TypeCode typeCode(const Type &t)
std::vector< LazyInvoker > LazyMethodStack
double invokeLast(const Reflex::Object &o, std::vector< Reflex::Object > &v) const
invoke and coerce result to double
Reflex::Object invoke(const Reflex::Object &o, std::vector< Reflex::Object > &v) const
std::pair< Reflex::Object, bool > invoke(const Reflex::Object &o, std::vector< Reflex::Object > &v) const
SingleInvoker(const Reflex::Type &t, const std::string &name, const std::vector< AnyMethodArgument > &args)
const SingleInvoker & invoker(const Reflex::Type &t) const
std::vector< AnyMethodArgument > ints_
void throwFailedConversion(const Reflex::Object &o) const
static bool makeStorage(Reflex::Object &obj, const Reflex::Member &member)
std::vector< AnyMethodArgument > argsBeforeFixups_
static double objToDouble(const Reflex::Object &obj, method::TypeCode type)
std::vector< MethodInvoker > invokers_
LazyInvoker(const std::string &name, const std::vector< AnyMethodArgument > &args)
std::vector< Reflex::Type > TypeStack