00001 #ifndef Impala_Persistency_KeyframesRepositoryInFile_h
00002 #define Impala_Persistency_KeyframesRepositoryInFile_h
00003
00004 #include "Persistency/RepositoryInFileSystem.h"
00005 #include "Core/VideoSet/Keyframes.h"
00006 #include "Persistency/KeyframesLocator.h"
00007
00008 namespace Impala
00009 {
00010 namespace Persistency
00011 {
00012
00013
00014 class KeyframesRepositoryInFile
00015 {
00016 public:
00017
00018 typedef Core::VideoSet::Keyframes Keyframes;
00019
00020 KeyframesRepositoryInFile()
00021 {
00022 }
00023
00024 bool
00025 Exists(const KeyframesLocator& loc)
00026 {
00027 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00028 false, true);
00029 return file.Valid();
00030 }
00031
00032 Keyframes*
00033 Get(KeyframesLocator loc, Core::VideoSet::VideoSet* vidSet)
00034 {
00035 Keyframes* res = new Keyframes(vidSet, "");
00036 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00037 false, false);
00038 Read(res, file);
00039 res->UpdateGroups();
00040 return res;
00041 }
00042
00043 void
00044 Add(const KeyframesLocator& loc, Core::VideoSet::Keyframes* keys)
00045 {
00046 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00047 true, false);
00048 Write(keys, file);
00049 }
00050
00051 void
00052 Delete(const KeyframesLocator& loc)
00053 {
00054 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00055 true, true);
00056 file.Delete();
00057 }
00058
00059 private:
00060
00061 RepositoryInFileSystem&
00062 RepFS()
00063 {
00064 return RepositoryInFileSystem::GetInstance();
00065 }
00066
00067 ILOG_VAR_DEC;
00068 };
00069
00070 ILOG_VAR_INIT(KeyframesRepositoryInFile, Impala.Persistency);
00071
00072 }
00073 }
00074
00075 #endif