Home || Visual Search || Applications || Architecture || 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         // Make VideoSet also Repository compatible
00040         Persistency::Locator loc(fileName, options);
00041         vidSet->SetProtocolAndHost(loc.GetProtocolAndHost());
00042     }
00043     else if (ext == "vxs")
00044     {
00045         String setName = options.GetString("videoSet");
00046         Util::Database* db = new Util::Database(setName);
00047         vidSet = new VideoSet(db, setName, true);
00048     }
00049     else
00050     {
00051         String fileNameSlashed = StringReplaceAll(fileName, "\\", "/");
00052         StringList pList(fileNameSlashed, '/');
00053         String vidName = *(pList.rbegin());
00054         pList.pop_back();
00055         String dirName = ".";
00056         if (pList.size() > 0)
00057         {
00058             dirName = *(pList.rbegin());
00059             pList.pop_back();
00060         }
00061         String section = (pList.empty()) ? "." : pList.ToString('/');
00062         Util::Database* db = &Util::Database::GetInstance();
00063         vidSet = new VideoSet(db, "tmpSet.txt", false);
00064         vidSet->AddFile(vidName, FileNameConcat(section, dirName));
00065     }
00066     return vidSet;
00067 }
00068 
00069 #else // REPOSITORY_USED
00070 
00071 inline VideoSet*
00072 MakeVideoSet(CString setName)
00073 {
00074     CmdOptions& options = CmdOptions::GetInstance();
00075     if (FileNameExt(setName) == "vxs")
00076     {
00077         Persistency::Locator loc(options.GetString("videoSet"), options);
00078         return Persistency::VideoSetRepository().Get(loc);
00079     }
00080     Persistency::Locator loc(setName, options);
00081     return Persistency::VideoSetRepository().Get(loc);
00082 }
00083 #endif // REPOSITORY_USED
00084 
00085 } // namespace VideoSet
00086 } // namespace Core
00087 } // namespace Impala
00088 
00089 #endif

Generated on Thu Jan 13 09:04:47 2011 for ImpalaSrc by  doxygen 1.5.1