00001 #ifndef Impala_Core_Database_MakeRawDataSet_h
00002 #define Impala_Core_Database_MakeRawDataSet_h
00003
00004 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00005 #include "Core/ImageSet/ImageSet.h"
00006 #include "Core/VideoSet/VideoSet.h"
00007 #else
00008 #include "Core/ImageSet/MakeImageSet.h"
00009 #include "Core/VideoSet/MakeVideoSet.h"
00010 #include "Persistency/VideoSetsRepository.h"
00011 #include "Persistency/ImageSetsRepository.h"
00012 #endif
00013
00014 namespace Impala
00015 {
00016 namespace Core
00017 {
00018 namespace Database
00019 {
00020
00021
00022 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00023
00024 inline RawDataSet*
00025 MakeRawDataSet(String type, String fileName)
00026 {
00027 Util::Database* db = new Util::Database();
00028 if (type == "im")
00029 return new ImageSet::ImageSet(db, fileName, true);
00030 if (type == "vid")
00031 return new VideoSet::VideoSet(db, fileName, true);
00032 return 0;
00033 }
00034
00035 inline RawDataSet*
00036 MakeRawDataSet(String setName, bool silentFailure=false)
00037 {
00038 ILOG_VAR(Impala.Core.Database.MakeRawDataSet);
00039 Util::Database* db = new Util::Database(setName);
00040
00041 String path = db->GetFilePath("VideoData", setName, false, true);
00042 if (!path.empty())
00043 return new VideoSet::VideoSet(db, setName, true);
00044
00045 path = db->GetFilePath("ImageData", setName, false, true);
00046 if (!path.empty())
00047 return new ImageSet::ImageSet(db, setName, true);
00048
00049 if (!silentFailure)
00050 ILOG_ERROR("Unable to find " << setName);
00051 return 0;
00052 }
00053
00054 #else // REPOSITORY_USED
00055
00056 inline RawDataSet*
00057 MakeRawDataSet(String type, String setName)
00058 {
00059 if (type == "im")
00060 return ImageSet::MakeImageSet(setName);
00061 if (type == "vid")
00062 return VideoSet::MakeVideoSet(setName);
00063 return 0;
00064 }
00065
00066 inline RawDataSet*
00067 MakeRawDataSet(String setName, bool silentFailure=false)
00068 {
00069 ILOG_VAR(Impala.Core.Database.MakeRawDataSet);
00070
00071 if (Persistency::VideoSetsRepository::GetInstance().Contains(setName))
00072 return VideoSet::MakeVideoSet(setName);
00073
00074 if (Persistency::ImageSetsRepository::GetInstance().Contains(setName))
00075 return ImageSet::MakeImageSet(setName);
00076
00077 if (!silentFailure)
00078 ILOG_ERROR("Unable to find " << setName);
00079 return 0;
00080 }
00081
00082 #endif // REPOSITORY_USED
00083
00084 }
00085 }
00086 }
00087
00088 #endif