00001 #ifndef Impala_Core_Array_ReadFile_h
00002 #define Impala_Core_Array_ReadFile_h
00003
00004 #include "Basis/FileName.h"
00005 #include "Core/Array/ReadRaw.h"
00006 #include "Core/Array/ReadImage.h"
00007
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Array
00013 {
00014
00015
00016 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00017 template<class ArrayT>
00018 inline void
00019 ReadFile(ArrayT*& dst, String fileName, Util::Database* db)
00020 {
00021 ILOG_VAR(Impala.Core.Array.ReadFile);
00022 String nameExt = FileNameExt(fileName, true);
00023 if (nameExt == "raw")
00024 return ReadRaw(dst, fileName, db);
00025 if ((nameExt == "jpg") || (nameExt == "jpeg"))
00026 return ReadJpg(dst, fileName, db);
00027 if (nameExt == "png")
00028 return ReadPng(dst, fileName, db);
00029 ILOG_ERROR("Don't know how to read " << fileName);
00030 }
00031 #endif // REPOSITORY_USED
00032
00033 template<class ArrayT>
00034 inline void
00035 ReadFile(ArrayT*& dst, Persistency::File file)
00036 {
00037 ILOG_VAR(Impala.Core.Array.ReadFile);
00038 String nameExt = FileNameExt(file.GetPath(), true);
00039 if (nameExt == "raw")
00040 return ReadRaw(dst, file);
00041 if ((nameExt == "jpg") || (nameExt == "jpeg") || (nameExt == "png"))
00042 return ReadImage(dst, file);
00043 ILOG_ERROR("Don't know how to read " << file.GetPath());
00044 }
00045
00046 }
00047 }
00048 }
00049
00050 #endif