/* * NonPrimitiveFunction.cc * * Created on: Feb 10, 2010 * Author: petergoodman * Version: $Id$ */ #include "DerivedFunction.h" /** * Constructor, expand the tokens. */ template::size_type num_args> DerivedFunction::DerivedFunction(string expand) { TokenGenerator gen(expand); toks.assign(gen.begin(), gen.end()); } /** * Destructor, free the stored tokens. */ template::size_type num_args> DerivedFunction::~DerivedFunction() { while(!toks.empty()) { Token *tok(toks.back()); toks.pop_back(); delete tok; } } /** * Call operator, put copies of the internal tokens onto the stack. */ template::size_type num_args> void DerivedFunction::call(deque &stack, deque &tokens, map &symbols) { (void) stack; (void) symbols; deque::reverse_iterator it = toks.rbegin(); deque::reverse_iterator end = toks.rend(); for(TS::MinSize constraint(stack); it != end; it++) { tokens.push_front(new Token(*it)); (void) constraint; } } /** * For linking purposes. */ template struct DerivedFunction<0>; template struct DerivedFunction<1>; template struct DerivedFunction<2>; template struct DerivedFunction<3>;