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

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

Definition at line 239 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().

00240     {
00241         if (! (buf && buf->Valid()))
00242             return;
00243 
00244         Quid quid = 0; // invalid
00245         int nrElem = -1;
00246         while (buf->Available())
00247         {
00248             String line = buf->ReadLine();
00249             Util::StringParser p(line);
00250             if (nrElem == -1)
00251             {
00252                 Real64* data = new Real64[line.size() / 2];
00253                 int i = 0;
00254                 while (!p.TheEnd())
00255                 {
00256                     Real64 a = p.GetDouble(' ', false, true);
00257                     data[i++] = a;
00258                 }
00259                 nrElem = i;
00260                 int nrLines = buf->Size() / line.size() + 1; // estimate
00261                 Array::Array2dScalarReal64* storage =
00262                     new Array::Array2dScalarReal64(nrElem, nrLines, 0, 0);
00263                 GetColumn2()->SetStorage(storage);
00264                 VectorReal64 vec(nrElem, data, false);
00265                 Add(quid, vec);
00266                 delete data;
00267             }
00268             else
00269             {
00270                 VectorReal64 vec(nrElem);
00271                 int i = 0;
00272                 while (!p.TheEnd())
00273                 {
00274                     Real64 a = p.GetDouble(' ', false, true);
00275                     vec[i++] = a;
00276                     if (i > nrElem)
00277                     {
00278                         ILOG_ERROR("ImportAscii: too many elements in vector");
00279                         break;
00280                     }
00281                 }
00282                 Add(quid, vec);
00283             }
00284         }
00285     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:09:27 2010 for ImpalaSrc by  doxygen 1.5.1