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

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

Definition at line 303 of file ReadRaw.h.

References Endian(), Impala::Util::IOBuffer::GetPosition(), ILOG_ERROR, and ILOG_VAR.

Referenced by ReadRawList().

00304 {
00305     typedef typename ArrayT::StorType StorT;
00306     ILOG_VAR(Impala.Core.Array.ReadRawList);
00307 
00308     Int64 version;
00309     Int64 binary;
00310     Int64 elemSize;
00311     Int64 width;
00312     Int64 height;
00313     Int64 nrA;
00314     String compressor;
00315     Int64 linesPerCompressedBlock;
00316     Util::IOBuffer::PositionType startPos = buffer->GetPosition();
00317     if (! ReadRawHeader<ArrayT>(buffer, &version, &binary, &elemSize, &width,
00318                                 &height, &nrA, compressor,
00319                                 &linesPerCompressedBlock))
00320     {
00321         return;
00322     }
00323 
00324     for (Int64 n=0 ; n<nrA ; n++)
00325         if (n+1 > list.size())
00326             list.push_back(ArrayCreate<ArrayT>(width, height));
00327     if (binary)
00328     {
00329         Int64 lineSize = sizeof(StorT) * width * elemSize;
00330         buffer->SetPosition(startPos + 200);
00331         for (Int64 n=0 ; n<nrA ; n++)
00332         {
00333             if (linesPerCompressedBlock > 0)
00334             {
00335                 int y = 0;
00336                 while (y < height)
00337                 {
00338                     int end = y + linesPerCompressedBlock;
00339                     if (end > height)
00340                         end = height;
00341                     int dY = end - y;
00342                     StorT* dstPtr = list[n]->CPB(0, y);
00343                     size_t nrBytes = lineSize * dY;
00344                     size_t nrRead = 0;
00345                     if(compressor == "bzip")
00346                     {
00347                         nrRead = buffer->ReadBzip(dstPtr, nrBytes);
00348                     }
00349                     else if(compressor == "zlib")
00350                     {
00351                         nrRead = buffer->ReadZlib(dstPtr, nrBytes);
00352                     }
00353                     else
00354                     {
00355                         ILOG_ERROR("Unknown compressor: " << compressor);
00356                     }
00357                     if (nrRead != nrBytes)
00358                     {
00359                         ILOG_ERROR("read " << nrRead << " bytes instead of "
00360                                    << nrBytes);
00361                     }
00362                     y += dY;
00363                 }
00364             }
00365             else
00366             {
00367                 StorT* dstPtr = list[n]->CPB(0, 0);
00368                 size_t nrBytes = lineSize * height;
00369                 size_t nrRead = buffer->Read(dstPtr, nrBytes);
00370                 if (nrRead != nrBytes)
00371                 {
00372                     ILOG_ERROR("read " << nrRead << " bytes instead of "
00373                                << nrBytes);
00374                 }
00375             }
00376             Endian(list[n], list[n]);
00377         }
00378     }
00379     else
00380     {
00381         for (Int64 n=0 ; n<nrA ; n++)
00382         {
00383             for (Int64 i=0 ; i<height ; i++)
00384             {
00385                 StorT* dstPtr = list[n]->CPB(0, i);
00386                 for (Int64 j=0 ; j<width ; j++)
00387                 {
00388                     for (Int64 k=0 ; k<elemSize ; k++)
00389                     {
00390                         buffer->NativeTypeRead(dstPtr);
00391                         dstPtr++;
00392                     }
00393                 }
00394             }
00395         }
00396     }
00397 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:17:08 2011 for ImpalaSrc by  doxygen 1.5.1