00001 #ifndef Impala_Core_Geometry_DatabaseReadVxRectangle_h 00002 #define Impala_Core_Geometry_DatabaseReadVxRectangle_h 00003 00004 #include "Persistency/FileLocator.h" 00005 #include "Persistency/RepositoryInFileSystem.h" 00006 #include "Core/Geometry/VxRectangle.h" 00007 #include "Basis/FileName.h" 00008 #include "Util/StringParser.h" 00009 00010 namespace Impala 00011 { 00012 namespace Core 00013 { 00014 namespace Geometry 00015 { 00016 00017 00018 template <class BackInsertIterator> 00019 inline void 00020 DatabaseReadVxRectangle(BackInsertIterator bi, 00021 const Persistency::FileLocator& loc) 00022 { 00023 typedef Persistency::RepositoryInFileSystem FS; 00024 Persistency::File file = FS::GetInstance().GetFile(loc, false, false); 00025 Util::IOBuffer* buf = file.GetReadBuffer(true, "");; 00026 if (! buf) 00027 return; 00028 00029 bool hasSection = false; 00030 while (buf->Available()) 00031 { 00032 String line = buf->ReadLine(); 00033 if (! line[0]) 00034 continue; 00035 Util::StringParser p(line); 00036 if (p.At("#@") && (p.Contains("section"))) 00037 hasSection = true; 00038 if (p.At("#")) 00039 continue; 00040 VxRectangle vr; 00041 vr.mStartFrame = p.GetInt(); 00042 vr.mEndFrame = p.GetInt(); 00043 vr.mAnno = p.GetString(); 00044 vr.mRect = p.GetRectangle(); 00045 vr.mVideoName = p.GetString(); 00046 if (hasSection) 00047 { 00048 vr.mSection = p.GetString(); 00049 vr.mDir = p.GetString(); 00050 } 00051 else 00052 if (FileNameExt(vr.mVideoName) == "") 00053 vr.mVideoName = vr.mVideoName + ".mpg"; 00054 if (! p.TheEnd()) 00055 vr.mExtra = p.GetString(); 00056 *bi++ = vr; 00057 } 00058 delete buf; 00059 } 00060 00061 } // namespace Geometry 00062 } // namespace Core 00063 } // namespace Impala 00064 00065 #endif