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