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