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

Concat.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Vector_Concat_h
00002 #define Impala_Core_Vector_Concat_h
00003 
00004 #include "Core/Vector/VectorSet.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Vector
00011 {
00012 
00013 template <class ElemT>
00014 inline VectorTem<ElemT>
00015 Concat(VectorTem<ElemT> v1, VectorTem<ElemT> v2)
00016 {
00017     VectorTem<ElemT> res(v1.Size() + v2.Size());
00018     int i = 0;
00019     for (int j=0 ; j<v1.Size() ; j++)
00020         res[i++] = v1[j];
00021     for (int j=0 ; j<v2.Size() ; j++)
00022         res[i++] = v2[j];
00023     return res;
00024 }
00025 
00026 template <class ArrayT>
00027 inline typename VectorSet<ArrayT>::VectorT
00028 //Concat(typename VectorSet<ArrayT>::VectorT* dst, VectorSet<ArrayT>* src)
00029 Concat(VectorSet<ArrayT>* src)
00030 {
00031     typedef typename VectorSet<ArrayT>::VectorT VectorT;
00032 
00033     int vSize = 0;
00034     for (int i=0 ; i<src->Size() ; i++)
00035         vSize += src->GetVector(i, true).Size();
00036     VectorT res(vSize);
00037     int i = 0;
00038     for (int v=0 ; v<src->Size() ; v++)
00039     {
00040         VectorT vec = src->GetVector(v, true);
00041         for (int j=0 ; j<vec.Size() ; j++)
00042             res[i++] = vec[j];
00043     }
00044     return res;
00045 }
00046 
00047 } // namespace Vector
00048 } // namespace Core
00049 } // namespace Impala
00050 
00051 #endif

Generated on Fri Mar 19 09:31:28 2010 for ImpalaSrc by  doxygen 1.5.1