Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

KeywordListRepositoryInFile.h

Go to the documentation of this file.
00001 #ifndef Impala_Persistency_KeywordListRepositoryInFile_h
00002 #define Impala_Persistency_KeywordListRepositoryInFile_h
00003 
00004 #include "Persistency/RepositoryInFileSystem.h"
00005 #include "Core/Table/KeywordList.h"
00006 #include "Persistency/KeywordListLocator.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Persistency
00011 {
00012 
00013 
00014 class KeywordListRepositoryInFile
00015 {
00016 public:
00017 
00018     typedef Core::Table::KeywordList KeywordList;
00019 
00020     KeywordListRepositoryInFile()
00021     {
00022     }
00023 
00024     bool
00025     Exists(const KeywordListLocator& loc)
00026     {
00027         File file = RepFS().GetFile(loc, "Annotations", loc.GetConceptSet(),
00028                                     false, true);
00029         return file.Valid();
00030     }
00031 
00032     KeywordList*
00033     Get(const KeywordListLocator& loc)
00034     {
00035         File file = RepFS().GetFile(loc, "Annotations", loc.GetConceptSet(),
00036                                     false, false);
00037         if (!file.Valid())
00038             return 0;
00039         KeywordList* res = new KeywordList();
00040         file.ReadStrings(std::back_inserter(*res));
00041         return res;
00042     }
00043 
00044     void
00045     Add(const KeywordListLocator& loc, KeywordList* keyList)
00046     {
00047         File file = RepFS().GetFile(loc, "Annotations", loc.GetConceptSet(),
00048                                     true, false);
00049         if (!file.Valid())
00050             return;
00051         file.WriteStrings(keyList->begin(), keyList->end());
00052     }
00053 
00054 private:
00055 
00056     RepositoryInFileSystem&
00057     RepFS()
00058     {
00059         return RepositoryInFileSystem::GetInstance();
00060     }
00061 
00062     ILOG_VAR_DEC;
00063 };
00064 
00065 ILOG_VAR_INIT(KeywordListRepositoryInFile, Impala.Persistency);
00066 
00067 } // namespace Persistency
00068 } // namespace Impala
00069 
00070 #endif

Generated on Fri Mar 19 09:31:44 2010 for ImpalaSrc by  doxygen 1.5.1