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 00025 #include "libMRML/include/CAccessorElement.h" 00026 #include "libMRML/include/CXMLElement.h" 00048 #ifndef _CQUERY 00049 #define _CQUERY 00050 #include "libMRML/include/uses-declarations.h" 00051 #include <memory> 00052 #include <map> 00053 #include "libMRML/include/CSelfDestroyPointer.h" 00054 #include "libMRML/include/CIDRelevanceLevelPairList.h" 00055 #include "libMRML/include/CXMLElement.h" 00056 00057 //#include "CWeightingFunctionPointerList.h" 00058 //#include "CWeightingFunctionPointerHash.h" 00059 00060 #include "libMRML/include/CAlgorithm.h" 00061 #include "libMRML/include/CAccessor.h" 00062 #include "libMRML/include/CAccessorAdminCollection.h" 00063 #include "libMRML/include/CAccessorAdmin.h" 00064 #include "libMRML/include/CMagic.h" //public CMagic 00065 00066 class CScoreBoard; 00067 class CAccessor; 00068 00069 00071 class CQuery:public CMagic{ 00072 00073 protected: 00079 CAccessor* mAccessor; 00084 CAccessorAdmin* mAccessorAdmin; 00089 CAccessorAdminCollection* mAccessorAdminCollection; 00090 00091 00096 CAlgorithm* mAlgorithm; 00097 00101 class lCChild{ 00102 public: 00104 CQuery* mQuery; 00106 double mWeight; 00107 }; 00109 typedef list<lCChild> lCChildren; 00112 lCChildren mChildren; 00113 00114 00115 00116 protected: 00122 virtual void init()=0; 00123 00124 public: 00130 CQuery(); 00136 virtual ~CQuery(); 00149 CQuery(CAccessorAdminCollection& inAccessorAdminCollection, 00150 CAlgorithm& inAlgorithm); 00151 00157 void addChild(CQuery* inChild, 00158 double inWeight=1); 00159 00160 00166 virtual CXMLElement* query(const CXMLElement& inQuery); 00167 00174 virtual CIDRelevanceLevelPairList* fastQuery(const CXMLElement& inQuery, 00175 int inNumberOfInterestingImages, 00176 double inDifferenceToBest)=0; 00177 00183 virtual CXMLElement* getRandomImages(int inNumberOfInterestingImages)const; 00189 virtual CIDRelevanceLevelPairList* getRandomIDs(int inNumberOfInterestingImages)const; 00195 virtual list<TID>* getAllIDs()const; 00201 virtual list<CAccessorElement>* getAllAccessorElements()const; 00208 virtual bool setAlgorithm(CAlgorithm& inAlgorithm); 00215 const CAlgorithm& getAlgorithm()const; 00216 00224 virtual void finishInit(); 00225 00226 }; /* end of class */ 00227 00228 #endif 00229