DataColumnBase* DataSet::getCellValue( const unsigned int row, const string& columnName ) { DataRow* myRow = NULL; if ( row >= this->size() ) throw invalid_argument( "Row index out of bounds" ); myRow = ( *this )[ row ]; if ( myRow == NULL ) throw runtime_error( "Unable to access row" ); DataColumnBase* result = NULL; try { result = ( *myRow )[ columnName ]; if ( result == NULL ) { DEBUG( "Warning : cell empty for request : " << row << ", [" << columnName << "]" ); myRow->DumpHeader(); } } catch( ... ) { TRACE( "Invalid name for column : [" << columnName << "]" ); throw invalid_argument( "columnName" ); } return result; }
DataColumnBase* DataSet::getCellValue( const unsigned int row, const unsigned int columnIndex ) { DataRow* myRow = NULL; if ( row >= this->size() ) throw invalid_argument( "Row index out of bounds" ); myRow = ( *this )[ row ]; if ( myRow == NULL ) throw runtime_error( "Unable to access row" ); if ( columnIndex > myRow->size() ) throw invalid_argument( "Column index out of bounds" ); string columnName = ""; map< std::string, DataColumnBase* >::iterator myIterator = myRow->begin(); for ( unsigned int j = 0; j<=columnIndex; myIterator++, j++ ) { columnName = myIterator->first; } DataColumnBase* result = NULL; try { result = ( *myRow )[ columnName ]; if ( result == NULL ) { DEBUG( "Warning : cell empty for request : " << row << ", " << columnIndex << " (" << columnName << ")" ); myRow->DumpHeader(); } } catch( ... ) { throw invalid_argument( "columnIndex" ); } return result; }