You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "object.h"
|
|
|
|
#include "globals.h"
|
|
|
|
|
|
|
|
template<> EXPORT std::string ObjectSimple<bool>::type="bool";
|
|
|
|
template<> EXPORT std::string ObjectSimple<int64_t>::type="integer";
|
|
|
|
template<> EXPORT std::string ObjectSimple<double>::type="real";
|
|
|
|
template<> EXPORT std::string ObjectSimple<std::string>::type="string";
|
|
|
|
|
|
|
|
ObjectBase* OFunc::Evaluate(bool* err)
|
|
|
|
{
|
|
|
|
*err=false;
|
|
|
|
if(G_funcs.find(name)==G_funcs.end())
|
|
|
|
{
|
|
|
|
*err=true;
|
|
|
|
COUT(ERROR)<<"Function "<<name<< " not found"<<std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
args->Evaluate(err);
|
|
|
|
if(*err)
|
|
|
|
{
|
|
|
|
COUT(ERROR)<<" in function call "<<Dump()<<std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectBase* ret;
|
|
|
|
auto p=G_funcs.equal_range(name);
|
|
|
|
for(auto f=p.first;f!=p.second;f++)
|
|
|
|
{
|
|
|
|
ret=(*(f->second))(args);
|
|
|
|
if(ret!=0) return ret;
|
|
|
|
}
|
|
|
|
*err=true;
|
|
|
|
COUT(ERROR)<<"Function "<<name<<" can't evaluate expression "<<args->Dump()<<std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|