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

template<class TableT>
void Impala::Core::Table::Write ( TableT *  table,
Util::IOBuffer *  buffer,
bool  binary 
) [inline]

Definition at line 19 of file Write.h.

References Impala::Util::IOBuffer::GetPosition(), ILOG_ERROR, ILOG_VAR, IMPALA_VERSION_STR, Impala::Util::IOBuffer::Seek(), SVN_VERSION_STR, Write(), and Impala::Util::IOBuffer::Write().

Referenced by Impala::Core::ImageSet::ProtoSimilarityEval::HandleDoneDir(), Impala::Core::VideoSet::LbpEval::HandleDoneFile(), Impala::Core::VideoSet::KfrMotionExtractor::HandleDoneFile(), Impala::Core::VideoSet::HistogramExtractor::HandleDoneFile(), Impala::Core::VideoSet::Color64Extractor::HandleDoneFile(), Impala::Core::VideoSet::ProtoSimilarityEval::HandleDoneFile(), Impala::Core::VideoSet::SelectFrames::HandleDoneWalk(), Impala::Core::VideoSet::IndexFeaturesSubset::HandleDoneWalk(), Impala::Core::VideoSet::IndexAnnotation::HandleDoneWalk(), Impala::Core::VideoSet::IndexFeatures::HandleDoneWalk(), Impala::Core::ImageSet::IndexFeatures::HandleDoneWalk(), Impala::Core::Table::Bayes::SaveQuidTablePerGenre(), Impala::Core::Table::AnnotationTableSet::SaveTables(), and Write().

00020 {
00021     ILOG_VAR(Impala.Core.Table.Write);
00022     if (!table)
00023     {
00024         ILOG_ERROR("No table");
00025         return;
00026     }
00027     
00028     // count columns
00029     int columnCount = 0;
00030     if(table->GetColumn1()->Valid()) columnCount = 1;
00031     if(table->GetColumn2()->Valid()) columnCount = 2;
00032     if(table->GetColumn3()->Valid()) columnCount = 3;
00033     if(table->GetColumn4()->Valid()) columnCount = 4;
00034     if(table->GetColumn5()->Valid()) columnCount = 5;
00035     if(table->GetColumn6()->Valid()) columnCount = 6;
00036     if(table->GetColumn7()->Valid()) columnCount = 7;
00037     if(table->GetColumn8()->Valid()) columnCount = 8;
00038     if(table->GetColumn9()->Valid()) columnCount = 9;
00039 
00040     // construct table header
00041     const int TABLEHEADERSIZE = 1024;
00042     std::ostringstream oss;
00043     oss << "impalatableversion: 2, columns: " << columnCount << ", "
00044         << "size: " << table->Size() << "\n";
00045     for(int i = 1; i <= columnCount; i++)
00046         oss << "column" << i << ": " << table->GetColName(i) << "\n";
00047     
00048     oss << "info: " << table->GetInfo() << "\n";
00049     
00050     std::time_t rawtime;
00051     std::time ( &rawtime );
00052     oss << "computedon: " << std::ctime (&rawtime);  // ctime comes with \n
00053     oss << "computedby: Impala " << IMPALA_VERSION_STR
00054         << " (svnversion " << SVN_VERSION_STR << ") compiled "
00055         << __DATE__ << " " << __TIME__ << "\n";
00056     while(oss.tellp() < TABLEHEADERSIZE)
00057         oss << ' ';
00058     oss.seekp(TABLEHEADERSIZE - 1, std::ios::beg);
00059     oss << '\n';
00060 
00061     // write the table header
00062     buffer->Write(oss.str().c_str(), TABLEHEADERSIZE);
00063 
00064     // write footer placeholder
00065     Int64 footer[16];
00066     for(int i = 0; i < 16; i++)
00067         footer[i] = 0;
00068     Util::IOBuffer::PositionType footerStartPos = buffer->GetPosition();
00069     buffer->Write(footer, sizeof(Int64) * 16);
00070     
00071     // write all columns + collect footer information
00072     // "impalafooter" 0x01 0x00 0x00 0x00
00073     footer[0] = 0x6F66616C61706D69LL;
00074     footer[1] = 0x000000017265746FLL;
00075     footer[2] = columnCount;
00076     footer[3] = table->Size();
00077     footer[4] = buffer->GetPosition();
00078     Column::Write(table->GetColumn1(), table->Size(), buffer, binary);
00079     footer[5] = buffer->GetPosition();
00080     Column::Write(table->GetColumn2(), table->Size(), buffer, binary);
00081     footer[6] = buffer->GetPosition();
00082     Column::Write(table->GetColumn3(), table->Size(), buffer, binary);
00083     footer[7] = buffer->GetPosition();
00084     Column::Write(table->GetColumn4(), table->Size(), buffer, binary);
00085     footer[8] = buffer->GetPosition();
00086     Column::Write(table->GetColumn5(), table->Size(), buffer, binary);
00087     footer[9] = buffer->GetPosition();
00088     Column::Write(table->GetColumn6(), table->Size(), buffer, binary);
00089     footer[10] = buffer->GetPosition();
00090     Column::Write(table->GetColumn7(), table->Size(), buffer, binary);
00091     footer[11] = buffer->GetPosition();
00092     Column::Write(table->GetColumn8(), table->Size(), buffer, binary);
00093     footer[12] = buffer->GetPosition();
00094     Column::Write(table->GetColumn9(), table->Size(), buffer, binary);
00095     footer[13] = buffer->GetPosition();
00096     footer[14] = 0;
00097     footer[15] = 0;
00098     
00099     Util::IOBuffer::PositionType eofPos = buffer->GetPosition();
00100     // write footer
00101     buffer->Seek(footerStartPos, SEEK_SET);
00102     buffer->Write(footer, sizeof(Int64) * 16);
00103     buffer->Seek(eofPos, SEEK_SET); // get back to EOF
00104 }

Here is the call graph for this function:


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