1#include "FunctionSet.h" 
   10        existFunc[
"*"] = 
true;
 
   11        existFunc[
"/"] = 
true;
 
   12        existFunc[
"sin"] = 
true;
 
   13        existFunc[
"cos"] = 
true;
 
   14        existFunc[
"AND"] = 
true;
 
   15        existFunc[
"OR"] = 
true;
 
   16        existFunc[
"NOT"] = 
true;
 
   17        existFunc[
"XOR"] = 
true;
 
   18        existFunc[
"XNOR"] = 
true;
 
   25            cerr << 
"FunctionSet error: Function " << name << 
" isn't implemented." << endl;
 
   33                this->push_back((FunctionP) (
new AddDouble));
 
   37                this->push_back((FunctionP) (
new SubDouble));
 
   41                this->push_back((FunctionP) (
new MulDouble));
 
   45                this->push_back((FunctionP) (
new DivDouble));
 
   47            else if (name == 
"sin")
 
   49                this->push_back((FunctionP) (
new SinDouble));
 
   51            else if (name == 
"cos")
 
   53                this->push_back((FunctionP) (
new CosDouble));
 
   57                cerr << 
"FunctionSet error: Unkown function name: " << name << endl;
 
   61        else if (type == 
"int")
 
   65                this->push_back((FunctionP) (
new AddInt));
 
   69                this->push_back((FunctionP) (
new SubInt));
 
   73                this->push_back((FunctionP) (
new MulInt));
 
   77                this->push_back((FunctionP) (
new DivInt));
 
   79            else if (name == 
"sin")
 
   81                this->push_back((FunctionP) (
new SinInt));
 
   83            else if (name == 
"cos")
 
   85                this->push_back((FunctionP) (
new CosInt));
 
   89                cerr << 
"FunctionSet error: Unkown function name: " << name << endl;
 
   93        else if (type == 
"uint")
 
   97                this->push_back((FunctionP) (
new AndUint));
 
   99            else if (name == 
"OR")
 
  101                this->push_back((FunctionP) (
new OrUint));
 
  103            else if (name == 
"NOT")
 
  105                this->push_back((FunctionP) (
new NotUint));
 
  107            else if (name == 
"XOR")
 
  109                this->push_back((FunctionP) (
new XorUint));
 
  111            else if (name == 
"XNOR")
 
  113                this->push_back((FunctionP) (
new XnorUint));
 
  117                cerr << 
"FunctionSet error: Unkown function name: " << name << endl;
 
  123            cerr << 
"FunctionSet error: Unkown data type: " << type << endl;
 
  132        if (!existFunc[name])
 
  134            cerr << 
"FunctionSet error: Function " << name << 
" isn't implemented." << endl;
 
  138        if (type == 
"double")
 
  142                this->push_back((FunctionP) (
new AddDouble(numArgs)));
 
  144            else if (name == 
"-")
 
  146                this->push_back((FunctionP) (
new SubDouble(numArgs)));
 
  148            else if (name == 
"*")
 
  150                this->push_back((FunctionP) (
new MulDouble(numArgs)));
 
  152            else if (name == 
"/")
 
  154                this->push_back((FunctionP) (
new DivDouble(numArgs)));
 
  158                cerr << 
"FunctionSet error: Unkown function name: " << name;
 
  159                cerr << 
" for " << numArgs << 
" arguments." << endl;
 
  163        else if (type == 
"int")
 
  167                this->push_back((FunctionP) (
new AddInt(numArgs)));
 
  169            else if (name == 
"-")
 
  171                this->push_back((FunctionP) (
new SubInt(numArgs)));
 
  173            else if (name == 
"*")
 
  175                this->push_back((FunctionP) (
new MulInt(numArgs)));
 
  177            else if (name == 
"/")
 
  179                this->push_back((FunctionP) (
new DivInt(numArgs)));
 
  183                cerr << 
"FunctionSet error: Unkown function name: " << name;
 
  184                cerr << 
" for " << numArgs << 
" arguments." << endl;
 
  188        else if (type == 
"uint")
 
  192                this->push_back((FunctionP) (
new AndUint(numArgs)));
 
  194            else if (name == 
"OR")
 
  196                this->push_back((FunctionP) (
new OrUint(numArgs)));
 
  198            else if (name == 
"XOR")
 
  200                this->push_back((FunctionP) (
new XorUint(numArgs)));
 
  202            else if (name == 
"XNOR")
 
  204                this->push_back((FunctionP) (
new XnorUint(numArgs)));
 
  208                cerr << 
"FunctionSet error: Unkown function name: " << name;
 
  209                cerr << 
" for " << numArgs << 
" arguments." << endl;
 
  215            cerr << 
"FunctionSet error: Unkown data type: " << type << endl;
 
  224        this->at(funcNum)->evaluate(inputs, result);
 
bool addFunction(string name)
 
void evaluate(voidP inputs, void *result, uint funcNum)
 
FunctionSet(string gettype)