X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fregistrar.cpp;h=2f5ac70c979658337937bccffb791b251dfd1dc9;hb=9d92d4b442fc4c1a95685884be4ba0494cd02bbe;hp=7aee59464f4e4851c88811a9a76a5cb615c7b909;hpb=68fdf425abf14d016d5f95ee7b9d06a19a3c5926;p=ginac.git diff --git a/ginac/registrar.cpp b/ginac/registrar.cpp index 7aee5946..2f5ac70c 100644 --- a/ginac/registrar.cpp +++ b/ginac/registrar.cpp @@ -3,7 +3,7 @@ * GiNaC's class registrar (for class basic and all classes derived from it). */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -28,46 +28,4 @@ namespace GiNaC { -registered_class_info *first_registered_class = NULL; - -/** Find registered_class_info strucure by class name. */ -static const registered_class_info *find_registered_class_info(const std::string &class_name) -{ - // Use a map for faster lookup. The registered_class_info list doesn't - // change at run-time, so it's sufficient to construct the map once - // on the first trip through this function. - typedef std::map name_map_type; - static name_map_type name_map; - static bool name_map_initialized = false; - - if (!name_map_initialized) { - // Construct map - const registered_class_info *p = first_registered_class; - while (p) { - name_map[p->name] = p; - p = p->next; - } - name_map_initialized = true; - } - - name_map_type::const_iterator it = name_map.find(class_name); - if (it == name_map.end()) - throw (std::runtime_error("class '" + class_name + "' not registered")); - else - return it->second; -} - -unsigned int find_tinfo_key(const std::string &class_name) -{ - const registered_class_info *p = find_registered_class_info(class_name); - return p->tinfo_key; -} - -unarch_func find_unarch_func(const std::string &class_name) -{ - const registered_class_info *p = find_registered_class_info(class_name); - return p->unarchive; -} - - } // namespace GiNaC