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

MakeVideoSet.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_VideoSet_MakeVideoSet_h
00002 #define Impala_Core_VideoSet_MakeVideoSet_h
00003 
00004 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00005 #include "Basis/CmdOptions.h"
00006 #include "Basis/FileName.h"
00007 #include "Basis/String.h"
00008 #include "Basis/StringList.h"
00009 #include "Util/Database.h"
00010 #include "Core/VideoSet/VideoSet.h"
00011 #else // REPOSITORY_USED
00012 #include "Persistency/VideoSetRepository.h"
00013 #endif // REPOSITORY_USED
00014 
00015 namespace Impala
00016 {
00017 namespace Core
00018 {
00019 namespace VideoSet
00020 {
00021 
00022 
00023 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00024 
00025 inline VideoSet*
00026 MakeVideoSet(CString fileName)
00027 {
00028     CmdOptions& options = CmdOptions::GetInstance();
00029     String ext = FileNameExt(fileName);
00030     VideoSet* vidSet;
00031     if (ext == "txt")
00032     {
00033         Util::Database* db = new Util::Database(fileName);
00034         if (db->GetFilePath("VideoData", fileName, false, false).empty())
00035         {
00036             return 0;
00037         }
00038         vidSet = new VideoSet(db, fileName, true);
00039     }
00040     else if (ext == "vxs")
00041     {
00042         String setName = options.GetString("videoSet");
00043         Util::Database* db = new Util::Database(setName);
00044         vidSet = new VideoSet(db, setName, true);
00045     }
00046     else
00047     {
00048         String fileNameSlashed = StringReplaceAll(fileName, "\\", "/");
00049         StringList pList(fileNameSlashed, '/');
00050         String vidName = *(pList.rbegin());
00051         pList.pop_back();
00052         String dirName = ".";
00053         if (pList.size() > 0)
00054         {
00055             dirName = *(pList.rbegin());
00056             pList.pop_back();
00057         }
00058         String section = (pList.empty()) ? "." : pList.ToString('/');
00059         Util::Database* db = &Util::Database::GetInstance();
00060         vidSet = new VideoSet(db, "tmpSet.txt", false);
00061         vidSet->AddFile(vidName, section, dirName);
00062     }
00063     return vidSet;
00064 }
00065 
00066 #else // REPOSITORY_USED
00067 
00068 inline VideoSet*
00069 MakeVideoSet(CString setName)
00070 {
00071     CmdOptions& options = CmdOptions::GetInstance();
00072     if (FileNameExt(setName) == "vxs")
00073     {
00074         Persistency::Locator loc(options.GetString("videoSet"), options);
00075         return Persistency::VideoSetRepository().Get(loc);
00076     }
00077     Persistency::Locator loc(setName, options);
00078     return Persistency::VideoSetRepository().Get(loc);
00079 }
00080 #endif // REPOSITORY_USED
00081 
00082 } // namespace VideoSet
00083 } // namespace Core
00084 } // namespace Impala
00085 
00086 #endif

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