00001 #ifndef Impala_Persistency_SegmentationRepositoryInFile_h
00002 #define Impala_Persistency_SegmentationRepositoryInFile_h
00003
00004 #include "Persistency/RepositoryInFileSystem.h"
00005 #include "Core/VideoSet/Segmentation.h"
00006 #include "Persistency/SegmentationLocator.h"
00007
00008 namespace Impala
00009 {
00010 namespace Persistency
00011 {
00012
00013
00014 class SegmentationRepositoryInFile
00015 {
00016 public:
00017
00018 typedef Core::VideoSet::Segmentation Segmentation;
00019
00020 SegmentationRepositoryInFile()
00021 {
00022 }
00023
00024 Segmentation*
00025 Get(SegmentationLocator loc, Core::VideoSet::VideoSet* vidSet)
00026 {
00027 Segmentation* res = new Segmentation(vidSet, "");
00028 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00029 false, false);
00030 Read(res, file);
00031 res->UpdateGroups();
00032 return res;
00033 }
00034
00035 void
00036 Add(const SegmentationLocator& loc, Core::VideoSet::Segmentation* seg)
00037 {
00038 File file = RepFS().GetFile(loc, "VideoIndex", loc.GetName() + ".tab",
00039 true, false);
00040 Write(seg, file);
00041 }
00042
00043 private:
00044
00045 RepositoryInFileSystem&
00046 RepFS()
00047 {
00048 return RepositoryInFileSystem::GetInstance();
00049 }
00050
00051 ILOG_VAR_DEC;
00052 };
00053
00054 ILOG_VAR_INIT(SegmentationRepositoryInFile, Impala.Persistency);
00055
00056 }
00057 }
00058
00059 #endif