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 Copyright (C) 2003, 2004 Bayreuth University 00009 2005 Bamberg University 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2 of the License, or 00013 (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 */ 00025 #ifndef _CACCESSORPROXY 00026 #define _CACCESSORPROXY 00027 #include "libMRML/include/uses-declarations.h" 00028 #include "libMRML/include/CSelfDestroyPointer.h" 00029 #include <string> 00030 #include <functional> 00031 #include "libMRML/include/CAccessor.h" 00032 #include "libMRML/include/CAccessorFactory.h" 00033 #include "libMRML/include/CAccessorFactoryContainer.h" 00045 class CAccessorAdmin{ 00046 protected: 00050 CAccessorFactoryContainer& mFactoryContainer; 00052 CSelfDestroyPointer<CXMLElement> mCollectionElement; 00058 class CContentElement{ 00059 public: 00061 CAccessor* mAccessor; 00063 CAccessorFactory* mFactory; 00065 int mOpenCloseCounter; 00066 }; 00072 typedef map<string,CContentElement> CContent; 00074 CContent mContent; 00075 public: 00076 //---------------------------------------- 00086 CAccessor* openAccessor(string inType); 00089 void closeAccessor(string inType); 00090 //---------------------------------------- 00094 void setCollectionElement(CXMLElement*); 00096 const CXMLElement* getCollectionElement()const; 00098 const CXMLElement* getQueryParadigmList()const; 00100 list<string>* getAvailableIndices()const; 00101 //---------------------------------------- 00103 string toXML(bool isPrivate=false)const; 00107 CXMLElement* toXMLElement()const; 00108 //---------------------------------------- 00110 CAccessorAdmin(CAccessorFactoryContainer& inFactoryContainer); 00112 ~CAccessorAdmin(); 00114 string getAlgorithmIDListID()const; 00116 string getName()const; 00118 string getID()const; 00119 00121 friend class CSortByName_pAP; 00122 }; 00123 00124 00125 /* Sort pointers to Accessor Proxies by the name of what they point to */ 00126 class CSortByName_pAP:public binary_function<const CAccessorAdmin*,const CAccessorAdmin*,bool>{ 00127 public: 00129 bool operator()(const CAccessorAdmin* l, 00130 const CAccessorAdmin* t); 00131 }; 00132 00133 00134 #endif