System documentation of the GNU Image-Finding Tool

CAcIFMySQL.h
1 /* -*- mode: c++ -*-
2 */
3 #ifdef __GIFT_WITH_MYSQL__
4 /*
5 
6  GIFT, a flexible content based image retrieval system.
7  Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
8 
9  Copyright (C) 2003, 2004 Bayreuth University
10  2005 Bamberg University
11  This program is free software; you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation; either version 2 of the License, or
14  (at your option) any later version.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 
25 */
26 // -*- mode: c++ -*-
27 
28 
29 class CXMLElement;
30 
50 #ifndef _CACIFMYSQL
51 #define _CACIFMYSQL
52 #include "libGIFTAcInvertedFile/include/uses-declarations.h"
53 class CXMLElement;
54 
55 #include "libGIFTAcInvertedFile/include/CAcInvertedFile.h"
56 #include "libGIFTAcURL2FTS/include/CAcURL2FTS.h"
57 #include <string>
58 #include "libMRML/include/TID.h"
59 #include "libMRML/include/CSelfDestroyPointer.h"
60 #include "libMRML/include/CArraySelfDestroyPointer.h"
61 #include "libGIFTAcInvertedFile/include/CDocumentFrequencyList.h"
62 
63 #include "libGIFTAcInvertedFile/include/CADIHash.h"
64 #include <iostream>
65 #include <fstream>
66 #include <map>
67 #include <vector>
68 #ifdef HAS_HASH_MAP
69 #include <hash_map>
70 #else
71 #define hash_map map
72 #endif
73 #include <functional>
74 #include <algorithm>
75 
76 #include <sqlplus.hh>
77 #include <custom.hh>
78 #include "libMRML/include/CMagic.h"
79 
80 
81 typedef TID TFeatureID ;
82 
90 class documentFeatureConnection;
91 
92 class CAcIFMySQL:public CAccessor{
100  documentFeatureConnection* mConnection;
101 
102  string GdbName;
103  string GdbUser;
104  string GdbHost;
105  string GdbPassword;
106 
107  bool connection2dbOK;
108 
109  Connection *cnx;
110 
112  //vector <documentFeatureConnection> queryReturn;
114  vector <documentFeatureConnection>::iterator It;
116  CDocumentFrequencyList* featureList2docList(CDocumentFrequencyList inFeatureList);
118  void showDocFreqList(CDocumentFrequencyList docFreqList);
119  /* neither this */
120  CDocumentFrequencyList* blob2docFreqList(string inBlobFile)const;
121 
122 protected:
123  int CAcIFMySQL::recordCount(string ltableName)const;
124  bool CAcIFMySQL::selectDB( string);
125  bool CAcIFMySQL::createDB( string);
126  bool CAcIFMySQL::dropDB( string);
127  void CAcIFMySQL::initialiseGIFTTables(bool, bool,string);
128 
129 
130 public:
132  virtual bool operator()()const;
133 
148  CAcIFMySQL(const CXMLElement& inCollectionElement);
150  ~CAcIFMySQL();
151 
155  virtual string IDToURL(TID inID)const;
156 
158  virtual pair<bool,TID> URLToID(const string& inURL)const;
159 
176  virtual CDocumentFrequencyList* FeatureToList(TFeatureID inFID)const;
177 
179  virtual CDocumentFrequencyList* URLToFeatureList(string inURL)const;
180 
182  virtual CDocumentFrequencyList* DIDToFeatureList(TID inDID)const;
183 
196 
197 
201  virtual double FeatureToCollectionFrequency(TFeatureID)const;
202 
204  virtual unsigned int getFeatureDescription(TID inFeatureID)const;
206 
210  virtual double DIDToMaxDocumentFrequency(TID)const;
211 
213  virtual double DIDToDFSquareSum(TID)const;
214 
216  virtual double DIDToSquareDFLogICFSum(TID)const;
218 
219  /*@name Inverted File Generation and Consistency Checking*/
221 
228 
236  void CAcIFMySQL::getAllIDs( list<TID > &) const;
237  void CAcIFMySQL::getAllAccessorElements( list<CAccessorElement> &) const;
238  void CAcIFMySQL::getRandomIDs(list<TID > &, size_t) const;
239  void CAcIFMySQL::getRandomAccessorElements(list<CAccessorElement > &, size_t) const;
240  virtual list<TID>* getAllFeatureIDs()const;
246  virtual pair<bool,CAccessorElement> IDToAccessorElement(TID inID)const;
247 
248  int CAcIFMySQL::size() const;
249  CAcIFMySQL::operator bool()const;
250 
251 };
252 
253 
254 #endif
255 #endif

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