System documentation of the GNU Image-Finding Tool

CAcIFMySQL.h
00001 /* -*- mode: c++ -*- 
00002 */
00003 #ifdef __GIFT_WITH_MYSQL__
00004 /* 
00005 
00006     GIFT, a flexible content based image retrieval system.
00007     Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
00008 
00009      Copyright (C) 2003, 2004 Bayreuth University
00010       2005 Bamberg University
00011     This program is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     This program is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU General Public License for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with this program; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025 */
00026 // -*- mode: c++ -*-
00027 
00028 
00029 class CXMLElement;
00030 
00050 #ifndef _CACIFMYSQL
00051 #define _CACIFMYSQL
00052 #include "libGIFTAcInvertedFile/include/uses-declarations.h"
00053 class CXMLElement;
00054 
00055 #include "libGIFTAcInvertedFile/include/CAcInvertedFile.h"
00056 #include "libGIFTAcURL2FTS/include/CAcURL2FTS.h"
00057 #include <string>
00058 #include "libMRML/include/TID.h"
00059 #include "libMRML/include/CSelfDestroyPointer.h"
00060 #include "libMRML/include/CArraySelfDestroyPointer.h"
00061 #include "libGIFTAcInvertedFile/include/CDocumentFrequencyList.h"
00062 
00063 #include "libGIFTAcInvertedFile/include/CADIHash.h"
00064 #include <iostream>
00065 #include <fstream>
00066 #include <map>
00067 #include <vector>
00068 #ifdef HAS_HASH_MAP
00069 #include <hash_map>
00070 #else
00071 #define hash_map map
00072 #endif
00073 #include <functional>
00074 #include <algorithm>
00075 
00076 #include <sqlplus.hh>
00077 #include <custom.hh>
00078 #include "libMRML/include/CMagic.h"
00079 
00080 
00081 typedef TID TFeatureID ;
00082 
00090 class documentFeatureConnection;
00091 
00092 class CAcIFMySQL:public CAccessor{  
00098   CSelfDestroyPointer<CAcURL2FTS> mURL2FTS;
00100   documentFeatureConnection* mConnection;
00101 
00102   string GdbName;
00103   string GdbUser;
00104   string GdbHost;
00105   string GdbPassword;
00106 
00107   bool connection2dbOK;
00108 
00109   Connection *cnx;
00110 
00112   //vector <documentFeatureConnection> queryReturn;
00114   vector <documentFeatureConnection>::iterator It;
00116   CDocumentFrequencyList* featureList2docList(CDocumentFrequencyList inFeatureList);
00118   void showDocFreqList(CDocumentFrequencyList docFreqList);
00119   /* neither this */
00120   CDocumentFrequencyList* blob2docFreqList(string inBlobFile)const;
00121 
00122 protected:
00123   int CAcIFMySQL::recordCount(string ltableName)const;
00124   bool CAcIFMySQL::selectDB( string);
00125   bool CAcIFMySQL::createDB( string);
00126   bool CAcIFMySQL::dropDB( string);
00127   void CAcIFMySQL::initialiseGIFTTables(bool, bool,string);
00128 
00129 
00130 public:
00132   virtual bool operator()()const;
00133 
00148   CAcIFMySQL(const CXMLElement& inCollectionElement);
00150   ~CAcIFMySQL();
00151 
00155   virtual string IDToURL(TID inID)const;
00156 
00158   virtual pair<bool,TID> URLToID(const string& inURL)const;
00159   
00176   virtual CDocumentFrequencyList* FeatureToList(TFeatureID inFID)const;
00177 
00179   virtual CDocumentFrequencyList* URLToFeatureList(string inURL)const;
00180 
00182   virtual CDocumentFrequencyList* DIDToFeatureList(TID inDID)const;
00183 
00196 
00197 
00201   virtual double FeatureToCollectionFrequency(TFeatureID)const;
00202 
00204   virtual unsigned int getFeatureDescription(TID inFeatureID)const;
00206 
00210   virtual double DIDToMaxDocumentFrequency(TID)const;
00211 
00213   virtual double DIDToDFSquareSum(TID)const;
00214 
00216   virtual double DIDToSquareDFLogICFSum(TID)const;
00218 
00219   /*@name Inverted File Generation and Consistency Checking*/
00221 
00228 
00236   void CAcIFMySQL::getAllIDs( list<TID > &) const;
00237   void CAcIFMySQL::getAllAccessorElements( list<CAccessorElement> &) const;
00238   void CAcIFMySQL::getRandomIDs(list<TID > &, size_t) const;
00239   void CAcIFMySQL::getRandomAccessorElements(list<CAccessorElement > &, size_t) const;
00240   virtual list<TID>* getAllFeatureIDs()const;
00246   virtual pair<bool,CAccessorElement> IDToAccessorElement(TID inID)const;
00247 
00248   int CAcIFMySQL::size() const;
00249   CAcIFMySQL::operator bool()const;
00250 
00251 };
00252 
00253 
00254 #endif
00255 #endif

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen