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

void Impala::Application::MediaTable::SelectionCollection::LoadCollectionEvent ( int  id  )  [inline, virtual]

Reimplemented from Impala::Application::MediaTable::SelectionCollectionListener.

Definition at line 191 of file SelectionCollection.h.

References Impala::atoi(), ILOG_DEBUG, ILOG_ERROR, ILOG_SYSTEM, mSource, Impala::Application::MediaTable::TableDataView::SetMarkById(), and UpdateItemCounts().

00192     {
00193         ILOG_SYSTEM("SaveCollectionEvent");
00194 
00195         std::string filename = "marks.csv";
00196         std::ifstream is(filename.c_str());
00197 
00198         if(!is.good())
00199         {
00200                 ILOG_ERROR("Can not read from " << filename);
00201                 return;
00202         }
00203 
00204                 std::string line, cell;
00205                 int row, mark;
00206                 int marks = 0;
00207                 bool first = true;
00208         while(is.good()) {
00209                 std::getline(is, line);
00210                 if(line.length() == 0) continue;
00211                 std::stringstream lineStream(line);
00212 
00213                 if(first) {
00214                         first = false;
00215                         if(!std::getline(lineStream,cell,',')) first = true;
00216                         if(cell != "row") first = true;
00217                         if(!std::getline(lineStream,cell,',')) first = true;
00218                         if(cell != "mark") first = true;
00219 
00220                         if(first)
00221                         {
00222                                 ILOG_ERROR(filename << " does not have correct column header.");
00223                                 break;
00224                         }
00225                 } else {
00226                         if(!std::getline(lineStream,cell,',')) continue;
00227                         row = atoi(cell.c_str());
00228                         if(!std::getline(lineStream,cell,',')) continue;
00229                         mark = atoi(cell.c_str());
00230 
00231                         mSource->SetMarkById(row, mark);
00232                                 marks++;
00233                 }
00234         }
00235         UpdateItemCounts();
00236         ILOG_DEBUG("Read " << marks << " from " << filename);
00237     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:15:25 2011 for ImpalaSrc by  doxygen 1.5.1