Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

MakeFromStl.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_MakeFromStl_h
00002 #define Impala_Core_Array_MakeFromStl_h
00003 
00004 #include "Core/Container/Arrays.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012 
00013 
00014 // assume scalar values
00015 template <class ArrayT, class Iterator>
00016 inline void
00017 MakeFromStl(ArrayT*& dst, Iterator begin, Iterator end, int nrElem = 0)
00018 {
00019     if (dst == 0)
00020     {
00021         if (nrElem == 0)
00022         {
00023             CX_COUT << "MakeFromStl : need array or nrElem" << CX_ENDL;
00024             return;
00025         }
00026         dst = ArrayCreate<ArrayT>(nrElem, 1);
00027     }
00028 
00029     typedef typename ArrayT::ArithType ArithT;
00030     ArithT* dataPtr = dst->CPB(0, 0);
00031     for (Iterator it=begin ; it!=end ; it++)
00032         *dataPtr++ = Element::E1Cast(*it, ArithT());
00033 }
00034 
00035 } // namespace Array
00036 } // namespace Core
00037 } // namespace Impala
00038 
00039 #endif

Generated on Fri Mar 19 09:30:48 2010 for ImpalaSrc by  doxygen 1.5.1