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

FrameRepositoryInFile.h

Go to the documentation of this file.
00001 #ifndef Impala_Persistency_FrameRepositoryInFile_h
00002 #define Impala_Persistency_FrameRepositoryInFile_h
00003 
00004 #include "Persistency/RepositoryInFileSystem.h"
00005 #include "Core/Array/Arrays.h"
00006 #include "Persistency/FrameLocator.h"
00007 #include "Core/Array/ReadFile.h"
00008 #include "Core/Array/WriteFile.h"
00009 
00010 namespace Impala
00011 {
00012 namespace Persistency
00013 {
00014 
00015 
00016 class FrameRepositoryInFile
00017 {
00018 public:
00019 
00020     typedef Core::Array::Array2dVec3UInt8 Array2dVec3UInt8;
00021 
00022     FrameRepositoryInFile()
00023     {
00024     }
00025 
00026     Array2dVec3UInt8*
00027     Get(const FrameLocator& loc)
00028     {
00029         String dir = GetDir(loc);
00030         File file = RepFS().GetFile(loc, dir, loc.GetName(), false, false);
00031         if (!file.Valid())
00032             return 0;
00033 
00034         Array2dVec3UInt8* res = 0;
00035         Core::Array::ReadFile(res, file);
00036         return res;
00037     }
00038 
00039     void
00040     Add(const FrameLocator& loc, Array2dVec3UInt8* frame)
00041     {
00042         String dir = GetDir(loc);
00043         File file = RepFS().GetFile(loc, dir, loc.GetName(), true, false);
00044         Core::Array::WriteFile(frame, file);
00045     }
00046 
00047 private:
00048 
00049     RepositoryInFileSystem&
00050     RepFS()
00051     {
00052         return RepositoryInFileSystem::GetInstance();
00053     }
00054 
00055     String
00056     GetDir(const FrameLocator& loc)
00057     {
00058         String dir = "Frames";
00059         dir = FileNameConcat(dir, loc.GetContainer());
00060         return dir;
00061     }
00062 
00063     ILOG_VAR_DEC;
00064 };
00065 
00066 ILOG_VAR_INIT(FrameRepositoryInFile, Impala.Persistency);
00067 
00068 } // namespace Persistency
00069 } // namespace Impala
00070 
00071 #endif

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