00001 #ifndef Impala_Core_Array_WriteFile_h
00002 #define Impala_Core_Array_WriteFile_h
00003
00004 #include "Basis/FileName.h"
00005 #include "Core/Array/WriteRaw.h"
00006 #include "Core/Array/WriteJpg.h"
00007 #include "Core/Array/WritePng.h"
00008
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Array
00014 {
00015
00016
00017 template<class ArrayT>
00018 inline bool
00019 WriteFile(ArrayT* src, Persistency::File file)
00020 {
00021 ILOG_VAR(Impala.Core.Array.WriteFile);
00022 String nameExt = FileNameExt(file.GetPath(), true);
00023 if (nameExt == "raw")
00024 {
00025 WriteRaw(src, file, true);
00026 return true;
00027 }
00028 if (nameExt == "jpg")
00029 return WriteJpg(src, file);
00030 if (nameExt == "png")
00031 return WritePng(src, file);
00032 ILOG_ERROR("Don't know how to write " << file.GetPath());
00033 return false;
00034 }
00035
00036 }
00037 }
00038 }
00039
00040 #endif