/* core/func.cc This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ #include "core/func.h" #include #include namespace core { namespace func { std::map registry; void add(const char * functionname, Func functionptr) { registry[std::string(functionname)] = functionptr; } void remove(const char *functionname) { registry.erase(std::string(functionname)); } void remove(const std::string &functionname) { registry.erase(functionname); } Func find(const std::string &functionname) { std::map::iterator it = registry.find(functionname); if (it == registry.end()) return 0; else return (*it).second; } void list() { con_print << "-- listfunc -----------------" << std::endl; std::map::iterator it; for (it = registry.begin(); it != registry.end(); it++) { con_print << " " << (*it).first << std::endl; } } } // namespace func } // namespace core