00001 #ifndef Impala_Core_Array_MakeFromValue_h
00002 #define Impala_Core_Array_MakeFromValue_h
00003
00004 #include "Core/Array/Trait/InOutSetVal.h"
00005 #include "Core/Array/Pattern/PatInOutOp.h"
00006
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013
00014
00015 template<class ArrayT>
00016 inline ArrayT*
00017 MakeFromValue(typename ArrayT::ArithType value, int cw, int ch, int bw = 0,
00018 int bh = 0)
00019 {
00020 ArrayT* dst = ArrayCreate<ArrayT>(cw, ch, bw, bh);
00021 Trait::InOutSetVal<ArrayT> inout(value);
00022 Pattern::PatInOutOp(dst, inout);
00023 return dst;
00024 }
00025
00026 template<class ArrayT>
00027 inline void
00028 MakeFromValue2(ArrayT*& dst, typename ArrayT::ArithType value)
00029 {
00030 Trait::InOutSetVal<ArrayT> inout(value);
00031 Pattern::PatInOutOp(dst, inout);
00032 }
00033
00034 }
00035 }
00036 }
00037
00038 #endif