00001 /* -*- mode: c++ -*- 00002 */ 00003 /* 00004 00005 GIFT, a flexible content based image retrieval system. 00006 Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 00022 */ 00023 // -*- mode: c++ -*- 00024 #ifndef _CALGORITHMCOLLECTION 00025 #define _CALGORITHMCOLLECTION 00026 #include "libMRML/include/uses-declarations.h" 00027 #include <string> 00028 #include <map> 00029 #include "libMRML/include/CAlgorithm.h" 00030 #ifdef LINK_DYNAMICALLY 00031 #include "libMRML/include/CStaticQueryFactory.h" 00032 #else 00033 #include "libMRML/include/CDynamicQueryFactory.h" 00034 #endif 00035 #include "libMRML/include/CXMLElement.h" // for toXMLElement 00036 00037 class CAccessorAdminCollection; 00038 00039 00056 class CAlgorithmCollection:public CStaticQueryFactory{ 00057 protected: 00059 CAlgorithm* mAlgorithmInConstruction; 00063 protected: 00064 typedef map<string,CAlgorithm*> CContent; 00065 00068 CContent mContent; 00070 CContent::const_iterator begin()const; 00072 CContent::const_iterator end()const; 00073 public: 00074 //---------------------------------------- 00078 CAlgorithm* getAlgorithmInConstruction(); 00079 //---------------------------------------- 00082 void startAlgorithmConstruction(CAlgorithm* inAlgorithm); 00084 CAlgorithmCollection(string inConfigFileName); 00087 ~CAlgorithmCollection(); 00089 void addAlgorithm(CAlgorithm* inAlgorithm); 00093 CAlgorithm& getAlgorithmByType(const string& inType)const; 00097 bool containsAlgorithmByType(const string& inType)const; 00104 CAlgorithm* makeAlgorithmByType(const string& inType)const; 00105 //---------------------------------------- 00110 CAlgorithm* getDefaultAlgorithm()const; 00111 //---------------------------------------- 00114 CAlgorithm* makeDefaultAlgorithm()const; 00115 //---------------------------------------- 00120 CXMLElement* getAlgorithmList(const CXMLElement& inGetAlgorithms)const; 00121 //---------------------------------------- 00124 string toXML(bool inIsPrivate=false)const; 00128 CXMLElement* toXMLElement()const; 00130 CQuery* makeQuery(const string & inBaseType, 00131 CAccessorAdminCollection & inAccessorAdminCollection, 00132 CAlgorithm & inAlgorithm, 00133 CStaticQueryFactory& inFactory); 00134 00135 }; 00136 #endif