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

template<class ArrayT>
void Impala::Core::Array::ReadRawList ( std::vector< ArrayT * > &  list,
Util::IOBuffer *  buffer 
) [inline]

Definition at line 194 of file ReadRaw.h.

References Endian(), Impala::Util::IOBuffer::GetPosition(), Impala::Util::IOBuffer::Gets(), ILOG_ERROR, ILOG_VAR, Impala::Util::IOBuffer::NativeTypeRead(), Impala::Util::IOBuffer::Read(), and Impala::Util::IOBuffer::SetPosition().

Referenced by ReadRawList().

00195 {
00196     typedef typename ArrayT::StorType StorT;
00197   
00198     ILOG_VAR(Impala.Core.Array.ReadRawList);
00199     String typeStr = Element::TypeString<StorT>(0);
00200     String formatStr = "version: 1, binary: %lld, type: " + typeStr +
00201                        ", elemSize: %lld, width: %lld, height: %lld, nr: %lld";
00202 
00203     Int64 binary;
00204     Int64 elemSize;
00205     Int64 width;
00206     Int64 height;
00207     Int64 nrA;
00208     char buf[200];
00209     Util::IOBuffer::PositionType startPos = buffer->GetPosition();
00210     buffer->Gets(buf, 200);
00211     int res = sscanf(buf, formatStr.c_str(),
00212                      &binary, &elemSize, &width, &height, &nrA);
00213     if ((res != 5) || (elemSize != ArrayT::ElemSize()))
00214     {
00215         ILOG_ERROR("Header is not compatible");
00216         return;
00217     }
00218     size_t blockSize = width*height*elemSize;
00219     Int64 n;
00220     for (n=0 ; n<nrA ; n++)
00221         if (n+1 > list.size())
00222             list.push_back(ArrayCreate<ArrayT>(width, height));
00223     if (binary)
00224     {
00225         buffer->SetPosition(startPos + 200);
00226         for (Int64 n=0 ; n<nrA ; n++)
00227         {
00228             StorT* dstPtr = list[n]->CPB(0, 0);
00229             size_t nrRead = buffer->Read(dstPtr, sizeof(StorT) * blockSize);
00230             if (nrRead != sizeof(StorT) * blockSize)
00231                 ILOG_ERROR("read " << nrRead << " bytes instead of "
00232                            << sizeof(StorT) * blockSize);
00233             Endian(list[n], list[n]);
00234         }
00235     }
00236     else
00237     {
00238         for (Int64 n=0 ; n<nrA ; n++)
00239         {
00240             for(Int64 i=0 ; i<height ; i++)
00241             {
00242                 StorT* dstPtr = list[n]->CPB(0, i);
00243                 for(Int64 j=0 ; j<width ; j++)
00244                 {
00245                     for (Int64 k=0 ; k<elemSize ; k++)
00246                     {
00247                         buffer->NativeTypeRead(dstPtr);
00248                         dstPtr++;
00249                     }
00250                 }
00251             }
00252         }
00253     }
00254 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:58:19 2010 for ImpalaSrc by  doxygen 1.5.1