1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
// Author:       Andreas F. Borchert
// Description:  register functions by their name

#ifndef DYNFUNCTION_REGISTRY_HPP
#define DYNFUNCTION_REGISTRY_HPP

#include <map>
#include <string>
#include "Function.hpp"

class DynFunctionRegistry {
   public:
      // constructors
      DynFunctionRegistry();
      DynFunctionRegistry(const std::string& dir);

      void add(Function* f);
      bool is_known(const std::string& fname);
      Function* get_function(const std::string& fname);
   private:
      const std::string dir;
      std::map< std::string, Function* > registry;
      Function* dynload(const std::string& fname);
}; // class DynFunctionRegistry

#endif