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

MakeRawDataSet.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Database_MakeRawDataSet_h
00002 #define Impala_Core_Database_MakeRawDataSet_h
00003 
00004 #include "Core/ImageSet/MakeImageSet.h"
00005 #include "Core/VideoSet/MakeVideoSet.h"
00006 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00007 #else
00008 #include "Persistency/VideoSetsRepository.h"
00009 #include "Persistency/ImageSetsRepository.h"
00010 #endif
00011 
00012 namespace Impala
00013 {
00014 namespace Core
00015 {
00016 namespace Database
00017 {
00018 
00019 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00020 
00021 /* not used?
00022 inline RawDataSet*
00023 MakeRawDataSet(String type, String fileName)
00024 {
00025     Util::Database* db = new Util::Database();
00026     if (type == "im")
00027         return new ImageSet::ImageSet(db, fileName, true);
00028     if (type == "vid")
00029         return new VideoSet::VideoSet(db, fileName, true);
00030     return 0;
00031 }
00032 */
00033 
00034 inline RawDataSet*
00035 MakeRawDataSet(String setName, bool silentFailure=false)
00036 {
00037     ILOG_VAR(Impala.Core.Database.MakeRawDataSet);
00038     Util::Database* db = new Util::Database(setName);
00039 
00040     String path = db->GetFilePath("VideoData", setName, false, true);
00041     if (!path.empty())
00042         //return new VideoSet::VideoSet(db, setName, true);
00043         return VideoSet::MakeVideoSet(setName);
00044 
00045     path = db->GetFilePath("ImageData", setName, false, true);
00046     if (!path.empty())
00047         //return new ImageSet::ImageSet(db, setName, true);
00048         return ImageSet::MakeImageSet(setName);
00049 
00050     if (!silentFailure)
00051         ILOG_ERROR("Unable to find " << setName);
00052     return 0;
00053 }
00054 
00055 #else // REPOSITORY_USED
00056 
00057 inline RawDataSet*
00058 MakeRawDataSet(String type, String setName)
00059 {
00060     if (type == "im")
00061         return ImageSet::MakeImageSet(setName);
00062     if (type == "vid")
00063         return VideoSet::MakeVideoSet(setName);
00064     return 0;
00065 }
00066 
00067 inline RawDataSet*
00068 MakeRawDataSet(String setName, bool silentFailure=false)
00069 {
00070     ILOG_VAR(Impala.Core.Database.MakeRawDataSet);
00071 
00072     if (Persistency::VideoSetsRepository::GetInstance().Contains(setName))
00073         return VideoSet::MakeVideoSet(setName);
00074 
00075     if (Persistency::ImageSetsRepository::GetInstance().Contains(setName))
00076         return ImageSet::MakeImageSet(setName);
00077 
00078     if (!silentFailure)
00079         ILOG_ERROR("Unable to find " << setName);
00080     return 0;
00081 }
00082 
00083 inline RawDataSet*
00084 MakeRawDataSet(String protocolAndHost, Quid q)
00085 {
00086     ILOG_VAR(Impala.Core.Database.MakeRawDataSet);
00087     using namespace Persistency;
00088     CmdOptions& options = CmdOptions::GetInstance();
00089     int id = QuidSet(q);
00090     //String setName;
00091     if (QuidClass(q) == QUID_CLASS_IMAGE)
00092     {
00093         String setName = ImageSetsRepository::GetInstance().GetSetName(id);
00094         String server = options.GetString("dataServer::"+setName, "");
00095         if (!server.empty())
00096         {
00097             protocolAndHost = "dataServer:" + server;
00098             ILOG_INFO("Options override protocol, set to " << protocolAndHost);
00099         }
00100         ImageSetLocator loc(protocolAndHost, setName + ".txt");
00101         return ImageSetRepository().Get(loc);
00102     }
00103     else
00104     {
00105         String setName = VideoSetsRepository::GetInstance().GetSetName(id);
00106         String server = options.GetString("dataServer::"+setName, "");
00107         if (!server.empty())
00108         {
00109             protocolAndHost = "dataServer:" + server;
00110             ILOG_INFO("Options override protocol, set to " << protocolAndHost);
00111         }
00112         Locator loc(protocolAndHost, setName + ".txt");
00113         return VideoSetRepository().Get(loc);
00114     }
00115     //return MakeRawDataSet(setName + ".txt");
00116 }
00117 
00118 #endif // REPOSITORY_USED
00119 
00120 } // namespace Database
00121 } // namespace Core
00122 } // namespace Impala
00123 
00124 #endif

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