00001 #ifndef Impala_Persistency_FeatureTableRepository_h 00002 #define Impala_Persistency_FeatureTableRepository_h 00003 00004 #include "Persistency/RepositoryDispatcher.h" 00005 #include "Persistency/FeatureTableRepositoryInFile.h" 00006 #include "Persistency/FeatureTableRepositoryInMonet.h" 00007 00008 namespace Impala 00009 { 00010 namespace Persistency 00011 { 00012 00013 00014 class FeatureTableRepository 00015 : public RepositoryDispatcher<FeatureLocator, 00016 Core::Feature::FeatureTable, 00017 FeatureTableRepositoryInFile, 00018 FeatureTableRepositoryInMonet> 00019 { 00020 public: 00021 00022 // Allow for others to get at the path where data is/would be stored. 00023 // Needed to store external data alongside the features as done in, 00024 // for example, InterestPointProc. 00025 String 00026 ExposeFilePath(const FeatureLocator& loc, bool toWrite) 00027 { 00028 String protocol = loc.GetProtocol(); 00029 if ((protocol == "file") || (protocol == "dataServer")) 00030 { 00031 File file = ExposeFile(loc, toWrite); 00032 return file.GetPath(); 00033 } 00034 ILOG_ERROR("ExposeFilePath: unknown protocol: [" << loc.GetProtocol() 00035 << "] in " << loc); 00036 return ""; 00037 } 00038 00039 File 00040 ExposeFile(const FeatureLocator& loc, bool toWrite) 00041 { 00042 String protocol = loc.GetProtocol(); 00043 if ((protocol == "file") || (protocol == "dataServer")) 00044 { 00045 return mRepFile.ExposeFile(loc, toWrite); 00046 } 00047 ILOG_ERROR("ExposeFile: unknown protocol: [" << loc.GetProtocol() 00048 << "] in " << loc); 00049 return File(); 00050 } 00051 00052 private: 00053 00054 ILOG_VAR_DEC; 00055 00056 }; 00057 00058 ILOG_VAR_INIT(FeatureTableRepository, Impala.Persistency); 00059 00060 } // namespace Persistency 00061 } // namespace Impala 00062 00063 #endif