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

void Impala::Core::Feature::FeatureTable::ImportAscii ( Util::IOBuffer buf  )  [inline]

Definition at line 291 of file FeatureTable.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Util::IOBuffer::Available(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::GetColumn2(), Impala::Util::StringParser::GetDouble(), ILOG_ERROR, Impala::Util::IOBuffer::ReadLine(), Impala::Util::IOBuffer::Size(), Impala::Util::StringParser::TheEnd(), and Impala::Util::IOBuffer::Valid().

Referenced by ReadPlainAsciiFile().

00292     {
00293         if (! (buf && buf->Valid()))
00294             return;
00295 
00296         Quid quid = 0; // invalid
00297         int nrElem = -1;
00298         while (buf->Available())
00299         {
00300             String line = buf->ReadLine();
00301             Util::StringParser p(line);
00302             if (nrElem == -1)
00303             {
00304                 Real64* data = new Real64[line.size() / 2];
00305                 int i = 0;
00306                 while (!p.TheEnd())
00307                 {
00308                     Real64 a = p.GetDouble(' ', false, true);
00309                     data[i++] = a;
00310                 }
00311                 nrElem = i;
00312                 int nrLines = buf->Size() / line.size() + 1; // estimate
00313                 Array::Array2dScalarReal64* storage =
00314                     new Array::Array2dScalarReal64(nrElem, nrLines, 0, 0);
00315                 GetColumn2()->SetStorage(storage);
00316                 VectorReal64 vec(nrElem, data, false);
00317                 Add(quid, vec);
00318                 delete data;
00319             }
00320             else
00321             {
00322                 VectorReal64 vec(nrElem);
00323                 int i = 0;
00324                 while (!p.TheEnd())
00325                 {
00326                     Real64 a = p.GetDouble(' ', false, true);
00327                     vec[i++] = a;
00328                     if (i > nrElem)
00329                     {
00330                         ILOG_ERROR("ImportAscii: too many elements in vector");
00331                         break;
00332                     }
00333                 }
00334                 Add(quid, vec);
00335             }
00336         }
00337     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:19:10 2011 for ImpalaSrc by  doxygen 1.5.1