00001 /******************************************************************************* 00002 * * 00003 * Copyright (C) 2003 Erik Sjolund, (<html>Erik Sjölund</html>) * 00004 * Center for Genomics and Bioinformatics, * 00005 * Karolinska Institutet, * 00006 * Stockholm, * 00007 * Sweden * 00008 * * 00009 * Author: Erik Sjolund * 00010 * Email: erik.sjolund@adivo.se * 00011 * * 00012 ******************************************************************************* 00013 */ 00014 #include "algomaker.h" 00015 #include "algo.h" 00016 00017 using namespace std; 00018 00019 list<string> AlgoMaker::algosRegistered() 00020 { 00021 list<string> list; 00022 00023 for ( MakerMap::const_iterator it = registry().begin(); it != registry().end(); ++it ) 00024 { 00025 if ( it->second->algoIsPopup() )//NOTA BENE, maybe put this info in a separate map... 00026 list.push_back( it->first ); 00027 } 00028 return list; 00029 } 00030 00031 AlgoMaker::MakerMap & AlgoMaker::registry() 00032 { 00033 /* We use this because static instances of sub classes of AlgoMaker 00034 make use of this map. The idea comes from c++ faq lite 00035 [10.12] How do I prevent the "static initialization order fiasco"? 00036 */ 00037 static AlgoMaker::MakerMap reg; 00038 return reg; 00039 } 00040 00041 Algo * AlgoMaker::newAlgo( const std::string& AlgoType, 00042 TrapperDoc * doc, std::set< db_recno_t >& recnoList, AlgoParam* param ) 00043 { 00044 AlgoMaker* maker = 00045 (*registry().find( AlgoType )).second; 00046 return maker ? maker->makeAlgo( doc, recnoList, param ) : NULL; 00047 } 00048