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

FileReadVxRectangle.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Geometry_FileReadVxRectangle_h
00002 #define Impala_Core_Geometry_FileReadVxRectangle_h
00003 
00004 #include "Core/Geometry/VxRectangle.h"
00005 #include "Basis/File.h"
00006 #include "Basis/FileName.h"
00007 #include "Util/StringParser.h"
00008 
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Geometry
00014 {
00015 
00016 
00017 template <class BackInsertIterator>
00018 inline void
00019 FileReadVxRectangle(BackInsertIterator bi, std::string fileName)
00020 {
00021     File f(fileName, "r");
00022     if (! f.Valid())
00023         return;
00024     bool hasSection = false;
00025     while (! f.Eof())
00026     {
00027         std::string line = f.ReadLine(false);
00028         if (! line[0])
00029             continue;
00030         Util::StringParser p(line);
00031         if (p.At("#@") && (p.Contains("section")))
00032             hasSection = true;
00033         if (p.At("#"))
00034             continue;
00035         VxRectangle vr;
00036         vr.mStartFrame = p.GetInt();
00037         vr.mEndFrame = p.GetInt();
00038         vr.mAnno = p.GetString();
00039         vr.mRect = p.GetRectangle();
00040         vr.mVideoName = p.GetString();
00041         if (hasSection)
00042         {
00043             vr.mSection = p.GetString();
00044             vr.mDir = p.GetString();
00045         }
00046         else
00047             if (FileNameExt(vr.mVideoName) == std::string(""))
00048                 vr.mVideoName = vr.mVideoName + ".mpg";
00049         if (! p.TheEnd())
00050             vr.mExtra = p.GetString();
00051         *bi++ = vr;
00052     }
00053 }
00054 
00055 } // namespace Geometry
00056 } // namespace Core
00057 } // namespace Impala
00058 
00059 #endif

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