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 */ 00043 #ifndef _CACURL2FTS 00044 #define _CACURL2FTS 00045 #include "libGIFTAcURL2FTS/include/uses-declarations.h" 00046 #include <string> 00047 #include "libMRML/include/TID.h" 00048 #include <iostream> 00049 #include <fstream> 00050 #include <map> 00051 #ifdef HAS_HASH_MAP 00052 #include <hash_map> 00053 #else 00054 #define hash_map map 00055 #endif 00056 #include "libMRML/include/CAccessorImplementation.h" 00057 #include "libMRML/include/CMutex.h" // multithreading 00058 class CXMLElement; // parameter of constructor 00059 00064 class CAcURL2FTS:public CAccessorImplementation{ 00065 private: 00067 bool mWellConstructed; 00068 protected: 00072 TID mID; 00076 string mURLPrefix; 00080 string mThumbnailURLPrefix; 00086 CMutex mMutexURL2FTS; 00088 string_string_map mURLToFFN; 00090 TID_string_map mIDToFFN; 00092 mutable ifstream mURLToFeatureFile; 00096 string mURLToFeatureFileName; 00097 // this seems to be necessary 00098 friend class CAcIFFileSystem; 00099 public: 00101 const string& getURLToFeatureFileName()const; 00102 00120 CAcURL2FTS(const CXMLElement& inContentElement); 00121 00127 virtual operator bool()const; 00133 virtual int size()const; 00140 pair<bool,string> URLToFFN(const string& inURL)const; 00147 pair<bool,string> IDToFFN(TID inID)const; 00149 friend void newStartURL2FTSElement(void *inUserData, 00150 const char *inElementName, 00151 const char **inAttributes); 00153 friend void newEndURL2FTSElement(void *inUserData, 00154 const char *inElementName); 00155 }; 00156 00157 #endif