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 */ 00045 #ifndef _CACURL2FTS 00046 #define _CACURL2FTS 00047 #include "libGIFTAcURL2FTS/include/uses-declarations.h" 00048 #include <string> 00049 #include "libMRML/include/TID.h" 00050 #include <iostream> 00051 #include <fstream> 00052 #include <map> 00053 #ifdef HAS_HASH_MAP 00054 #include <hash_map> 00055 #else 00056 #define hash_map map 00057 #endif 00058 #include "libMRML/include/CAccessorImplementation.h" 00059 #include "libMRML/include/CMutex.h" // multithreading 00060 class CXMLElement; // parameter of constructor 00061 00066 class CAcURL2FTS:public CAccessorImplementation{ 00067 private: 00069 bool mWellConstructed; 00070 protected: 00074 TID mID; 00078 string mURLPrefix; 00082 string mThumbnailURLPrefix; 00088 CMutex mMutexURL2FTS; 00090 string_string_map mURLToFFN; 00092 TID_string_map mIDToFFN; 00094 mutable ifstream mURLToFeatureFile; 00098 string mURLToFeatureFileName; 00099 // this seems to be necessary 00100 friend class CAcIFFileSystem; 00101 public: 00103 const string& getURLToFeatureFileName()const; 00104 00122 CAcURL2FTS(const CXMLElement& inContentElement); 00123 00129 virtual operator bool()const; 00135 virtual int size()const; 00142 pair<bool,string> URLToFFN(const string& inURL)const; 00149 pair<bool,string> IDToFFN(TID inID)const; 00151 friend void newStartURL2FTSElement(void *inUserData, 00152 const char *inElementName, 00153 const char **inAttributes); 00155 friend void newEndURL2FTSElement(void *inUserData, 00156 const char *inElementName); 00157 }; 00158 00159 #endif