1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
// Author:       Andreas F. Borchert
// Description:  test of function registry

#include <iostream>
#include "DynFunctionRegistry.hpp"

int main() {
   DynFunctionRegistry registry(".");

   std::string fname; double x;

   while (std::cout << ": " && std::cin >> fname >> x) {
      if (registry.is_known(fname)) {
         Function* f = registry.get_function(fname);
         std::cout << f->execute(x) << std::endl;
      } else {
         std::cout << "Unknown function name: " << fname << std::endl;
      }
   }
// main