00001 #ifndef Impala_Core_Array_MakeFromData_h
00002 #define Impala_Core_Array_MakeFromData_h
00003
00004 #include "Core/Array/Pattern/PatSet.h"
00005
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012
00013
00014 template<class ArrayT>
00015 inline ArrayT*
00016 MakeFromData(typename ArrayT::StorType* data, int cw, int ch,
00017 int bw = 0, int bh = 0, bool isPartial = false)
00018 {
00019 ArrayT* wrapper = new ArrayT(cw, ch, 0, 0, data, true, isPartial);
00020 ArrayT* dst = 0;
00021 Pattern::PatSet(dst, wrapper, bw, bh);
00022 delete wrapper;
00023 return dst;
00024 }
00025
00026 template<class DstArrayT, class SrcArrayT>
00027 inline void
00028 MakeFromData2(DstArrayT*& dst, SrcArrayT* src,
00029 int bw = 0, int bh = 0, bool isPartial = false)
00030 {
00031 SrcArrayT* wrapper = new SrcArrayT(src->CW(), src->CH(), 0, 0, src->CPB(), true, isPartial);
00032 Pattern::PatSet(dst, wrapper, bw, bh);
00033 delete wrapper;
00034 }
00035
00036
00037 template<class DstArrayT, class SrcArrayT>
00038 inline void
00039 MakeFromData2(DstArrayT*& dst, typename SrcArrayT::StorType* data,
00040 bool isPartial = false)
00041 {
00042 int cw = dst->CW();
00043 int ch = dst->CH();
00044 SrcArrayT* wrapper = new SrcArrayT(cw, ch, 0, 0, data, true, isPartial);
00045 Pattern::PatSet(dst, wrapper, dst->BW(), dst->BH());
00046 delete wrapper;
00047 }
00048
00049 }
00050 }
00051 }
00052
00053 #endif