00001 #ifndef Impala_Persistency_StillsRepositoryInFile_h
00002 #define Impala_Persistency_StillsRepositoryInFile_h
00003
00004 #include "Persistency/RepositoryInFileSystem.h"
00005 #include "Core/VideoSet/Stills.h"
00006 #include "Persistency/StillsLocator.h"
00007
00008 namespace Impala
00009 {
00010 namespace Persistency
00011 {
00012
00013
00014 class StillsRepositoryInFile
00015 {
00016 public:
00017
00018 typedef Core::VideoSet::Stills Stills;
00019
00020 StillsRepositoryInFile()
00021 {
00022 }
00023
00024 bool
00025 Exists(const StillsLocator& loc)
00026 {
00027 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00028 false, true);
00029 return file.Valid();
00030 }
00031
00032 Stills*
00033 Get(StillsLocator loc, Core::VideoSet::VideoSet* vidSet)
00034 {
00035 Stills* res = new Stills(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 StillsLocator& loc, Core::VideoSet::Stills* stills)
00045 {
00046 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00047 true, false);
00048 Write(stills, file);
00049 }
00050
00051 void
00052 Delete(const StillsLocator& 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(StillsRepositoryInFile, Impala.Persistency);
00071
00072 }
00073 }
00074
00075 #endif