ISTable Class Reference

#include <ISTable.h>

Inherits STable.

Inheritance diagram for ISTable:

Inheritance graph
[legend]
Collaboration diagram for ISTable:

Collaboration graph
[legend]
List of all members.

Public Types

enum  eTableDiff {
  eNONE = 0, eCASE_SENSE, eMORE_ROWS, eLESS_ROWS,
  eMORE_COLS, eLESS_COLS, eCOL_NAMES, eCELLS,
  eMISSING, eEXTRA
}
enum  eSearchType {
  eEQUAL = 0, eLESS_THAN, eLESS_THAN_OR_EQUAL, eGREATER_THAN,
  eGREATER_THAN_OR_EQUAL
}
enum  eSearchDir { eFORWARD = 0, eBACKWARD }

Public Member Functions

 ISTable (const StringCompare::eCompareType colCaseSense=StringCompare::eCASE_SENSITIVE)
 ISTable (const string &name, const StringCompare::eCompareType colCaseSense=StringCompare::eCASE_SENSITIVE)
 ISTable (const ISTable &inTable)
 ~ISTable ()
ISTableoperator= (const ISTable &inTable)
eTableDiff operator== (ISTable &inTable)
void AddColumn (const string &colName, const unsigned char opts=DEFAULT_OPTIONS, const vector< string > &col=vector< string >(0))
void InsertColumn (const string &colName, const string &afterColName, const unsigned char opts=DEFAULT_OPTIONS, const vector< string > &col=vector< string >(0))
void FillColumn (const string &colName, const vector< string > &col)
void AppendToColumn (const string &colName, const vector< string > &col)
void AppendToColumn (const string &colName, const string &cell)
void ClearColumn (const string &colName)
void DeleteColumn (const string &colName)
void GetColumn (vector< string > &col, const string &colName)
void GetColumn (vector< string > &col, const string &colName, const string &indexName)
void GetColumn (vector< string > &subCol, const string &colName, const unsigned int fromRowIndex, unsigned int toRowIndex)
void GetColumn (vector< string > &subCol, const string &colName, const vector< unsigned int > &rowIndex)
unsigned int AddRow ()
unsigned int InsertRow (const unsigned int rowIndex, const vector< string > &row=vector< string >(0))
void FillRow (const unsigned int rowIndex, const vector< string > &row)
void ClearRow (const unsigned int rowIndex)
void DeleteRow (const unsigned int rowIndex)
void DeleteRows (const vector< unsigned int > &rows)
unsigned int GetNumRows () const
unsigned int GetLastRowIndex ()
void GetRow (vector< string > &subRow, const unsigned int rowIndex, const string &fromColName=String::Empty, const string &toColName=String::Empty)
void FindRedundantRows (const vector< string > &colNames, vector< pair< unsigned int, unsigned int > > &duplRows, const unsigned int keep, const eSearchDir searchDir=eFORWARD)
void UpdateCell (const unsigned int rowIndex, const string &colName, const string &cell)
const string & operator() (const unsigned int rowIndex, const string &colName) const
bool IndexExists (const string &indexName)
void CreateIndex (const string &indexName, const vector< string > &colNames, const unsigned int unique=0)
void UpdateIndex (const string &indexName, const unsigned int rowIndex)
void RebuildIndex (const string &indexName)
void RebuildIndices ()
void DeleteIndex (const string &indexName)
unsigned int GetNumIndices ()
void CreateKey (const vector< string > &colNames)
void SetFlags (const string &colName, const unsigned char newOpts)
unsigned char GetDataType (const string &colName)
unsigned int FindFirst (const vector< string > &targets, const vector< string > &colNames=vector< string >(0), const string &indexName=String::Empty)
void Search (vector< unsigned int > &res, const string &target, const string &colName)
void Search (vector< unsigned int > &res, const vector< string > &targets, const vector< string > &colNames=vector< string >(0), const eSearchType searchType=eEQUAL, const string &indexName=String::Empty)
void SetModified (const bool modified)
bool GetModified ()
void SetFileNavigator (FileNavigator *fileNavigator)
int WriteObject (FileNavigator *, int &size)
int GetObject (Word index, FileNavigator *, int &size)
void Read (unsigned int indexInFile)
int Write ()
void Merge (ISTable &inTable, unsigned int typeOfMerge=0)
bool PrintDiff (ISTable &inTable)
void Print (const string &indexName)

Static Public Member Functions

static void SetUnion (const vector< unsigned int > &a, const vector< unsigned int > &b, vector< unsigned int > &ret)
static void SetIntersect (const vector< unsigned int > &a, const vector< unsigned int > &b, vector< unsigned int > &ret)

Static Public Attributes

static const unsigned char CASE_SENSE = 0x00
static const unsigned char CASE_INSENSE = 0x01
static const unsigned char W_SPACE_SENSE = 0x00
static const unsigned char W_SPACE_INSENSE = 0x02
static const unsigned char DT_STRING = DT_STRING_VAL << 4
static const unsigned char DT_INTEGER = DT_INTEGER_VAL << 4
static const unsigned char DT_DOUBLE = DT_DOUBLE_VAL << 4

Protected Member Functions

void Init ()
void Clear ()
unsigned int IntRowIndex (const unsigned int rowIndex) const
void ClearRowMap ()
void EnlargeRowMap (const unsigned int numRows)
void ReduceRowMap (const unsigned int numRows)
void MarkRowDeleted (const unsigned int rowIndex)
void UnMarkRowDeleted (const unsigned int rowIndex)
bool IsDelete (const unsigned int rowIndex)
StringCompare::eCompareType GetCompareType (const vector< unsigned int > &colIndices)
string CellValue (const unsigned int colIndex, const unsigned int rowIndex)
string ConvertString (const string &value, const unsigned int colIndex)
string MultiStringsValue (const vector< string > &values, const vector< unsigned int > &colIndices)
string SubRowValue (const vector< unsigned int > &colIndices, const unsigned int rowIndex)
string AggregateRow (const vector< unsigned int > &colIndices, const unsigned int rowIndex)
void AppendToAndDelimit (string &to, const string &appending)
void ValidateOptions (unsigned int colIndex)
string CreateInternalIndexName (const unsigned int indexIndex)
void UpdateIndex (const unsigned int indexIndex, const unsigned int rowIndex)
void RebuildIndex (const unsigned int indexIndex)
void ClearIndex (const unsigned int indexIndex)
void DeleteIndex (const unsigned int indexIndex)
int FindIndex (const string &indexName)
int FindIndex (const vector< unsigned int > &colIndices)
void UpdateIndices (const unsigned int rowIndex)
void ClearIndices ()
bool IsColumnInIndex (const unsigned int indexIndex, const unsigned int colIndex)
int FindKeyIndex ()
void UpdateColListOnColInsert (const unsigned int colIndex)
void UpdateColListOnColDelete (const unsigned int colIndex)
void UpdateColListOnCellUpdate (const unsigned int rowIndex, const unsigned int colIndex)
unsigned int FindFirst (const vector< string > &targets, const vector< unsigned int > &colIndices, const unsigned int indexIndex)
void Search (vector< unsigned int > &res, const vector< string > &targets, const vector< unsigned int > &colIndices, const unsigned int indexIndex, const eSearchType searchType=eEQUAL)
void Search (vector< unsigned int > &res, const vector< string > &targets, const vector< string > &colNames, const unsigned int indexIndex, const eSearchType searchType=eEQUAL)
int GetObjectV6 (Word index, FileNavigator *, int &size)
int GetObjectV3 (Word index, FileNavigator *, int &size)
int GetObjectV2 (Word index, FileNavigator *, int &size)
int GetObjectV1 (Word index, FileNavigator *, int &size)
int GetObjectV1_1 (Word index, FileNavigator *, int &size)
void MakeTableRectangular ()
void Print (unsigned int indexIndex)
void ConvertToInt (const string &a, string &ret)
void ConvertDouble (const string &a, string &ret)
void ConvertToLowerNoWhiteSpace (const string &a, string &ret)

Protected Attributes

bool _modified
vector< unsigned int > _rowMap
unsigned int _numDels
vector< unsigned int > _precision
vector< unsigned char > _compare_opts
vector< string > _indexNames
vector< vector< unsigned int > > _listsOfColumns
vector< tIndex_indices
vector< unsigned int > _unique

Static Protected Attributes

static const unsigned int EXPONENT = 4
static const unsigned int MAX_PRECISION = DBL_DIG
static const unsigned int MANTISSA = MAX_PRECISION + 2
static const unsigned int INT_LIMIT = 11
static const unsigned char DT_STRING_VAL = 1
static const unsigned char DT_INTEGER_VAL = 2
static const unsigned char DT_DOUBLE_VAL = 3
static const unsigned char DT_MASK = 15 << 4
static const unsigned char SC_MASK = 0x01
static const unsigned char WS_MASK = 0x02
static const unsigned char LAST_DT_VALUE = 3
static const unsigned int DEFAULT_PRECISION = MAX_PRECISION
static const unsigned char DEFAULT_OPTIONS = DT_STRING_VAL << 4

Private Member Functions

void InsertColumn (const string &colName, const unsigned int colIndex, const unsigned char opts=DEFAULT_OPTIONS, const vector< string > &col=vector< string >(0))
void FillColumn (const vector< string > &col, const unsigned int colIndex)
int AppendToColumn (const vector< string > &col, const unsigned int colIndex)
int UpdateCell (const string &cell, const unsigned int colIndex, const unsigned int rowIndex)
int GetCell (string &cell, const unsigned int colIndex, const unsigned int rowIndex)
int SetFlags (const unsigned char newOpts, const unsigned int colIndex)
void FindRedundantRows (const vector< unsigned int > &colIndices, vector< pair< unsigned int, unsigned int > > &duplRows, const unsigned int keep, const eSearchDir searchDir=eFORWARD)
bool AreListsOfColumnsValid (const vector< unsigned int > &colIndices)
void CreateIndex (const string &indexName, const vector< unsigned int > &colIndices, const unsigned int unique=0)
void CreateKey (const vector< unsigned int > &colIndices)
unsigned int FindFirst (const vector< string > &targets, const vector< unsigned int > &colIndices, const string &indexName=String::Empty)
void Search (vector< unsigned int > &res, const string &target, const unsigned int colIndex)
void Search (vector< unsigned int > &res, const vector< string > &targets, const vector< unsigned int > &colIndices, const eSearchType searchType=eEQUAL, const string &indexName=String::Empty)

Private Attributes

FileNavigator * _fnav

Static Private Attributes

static const string _version

Member Enumeration Documentation

enum ISTable::eTableDiff

Enumerator:
eNONE 
eCASE_SENSE 
eMORE_ROWS 
eLESS_ROWS 
eMORE_COLS 
eLESS_COLS 
eCOL_NAMES 
eCELLS 
eMISSING 
eEXTRA 

enum ISTable::eSearchType

Enumerator:
eEQUAL 
eLESS_THAN 
eLESS_THAN_OR_EQUAL 
eGREATER_THAN 
eGREATER_THAN_OR_EQUAL 

enum ISTable::eSearchDir

Enumerator:
eFORWARD 
eBACKWARD 


Constructor & Destructor Documentation

ISTable::ISTable ( const StringCompare::eCompareType  colCaseSense = StringCompare::eCASE_SENSITIVE  ) 

ISTable::ISTable ( const string &  name,
const StringCompare::eCompareType  colCaseSense = StringCompare::eCASE_SENSITIVE 
)

ISTable::ISTable ( const ISTable inTable  ) 

ISTable::~ISTable (  ) 


Member Function Documentation

void ISTable::InsertColumn ( const string &  colName,
const unsigned int  colIndex,
const unsigned char  opts = DEFAULT_OPTIONS,
const vector< string > &  col = vector< string >(0) 
) [private]

void ISTable::FillColumn ( const vector< string > &  col,
const unsigned int  colIndex 
) [private]

Reimplemented from STable.

int ISTable::AppendToColumn ( const vector< string > &  col,
const unsigned int  colIndex 
) [private]

Reimplemented from STable.

int ISTable::UpdateCell ( const string &  cell,
const unsigned int  colIndex,
const unsigned int  rowIndex 
) [private]

Reimplemented from STable.

int ISTable::GetCell ( string &  cell,
const unsigned int  colIndex,
const unsigned int  rowIndex 
) [private]

Reimplemented from STable.

int ISTable::SetFlags ( const unsigned char  newOpts,
const unsigned int  colIndex 
) [private]

void ISTable::FindRedundantRows ( const vector< unsigned int > &  colIndices,
vector< pair< unsigned int, unsigned int > > &  duplRows,
const unsigned int  keep,
const eSearchDir  searchDir = eFORWARD 
) [private]

bool ISTable::AreListsOfColumnsValid ( const vector< unsigned int > &  colIndices  )  [private]

void ISTable::CreateIndex ( const string &  indexName,
const vector< unsigned int > &  colIndices,
const unsigned int  unique = 0 
) [private]

void ISTable::CreateKey ( const vector< unsigned int > &  colIndices  )  [private]

unsigned int ISTable::FindFirst ( const vector< string > &  targets,
const vector< unsigned int > &  colIndices,
const string &  indexName = String::Empty 
) [private]

void ISTable::Search ( vector< unsigned int > &  res,
const string &  target,
const unsigned int  colIndex 
) [private]

void ISTable::Search ( vector< unsigned int > &  res,
const vector< string > &  targets,
const vector< unsigned int > &  colIndices,
const eSearchType  searchType = eEQUAL,
const string &  indexName = String::Empty 
) [private]

void ISTable::Init (  )  [protected]

void ISTable::Clear (  )  [protected, virtual]

Deletes all the content from the table.

Precondition:
None
Postcondition:
Table has 0 rows and 0 columns.

Table name is not affected by this method.

Exceptions: None

Reimplemented from STable.

unsigned int ISTable::IntRowIndex ( const unsigned int  rowIndex  )  const [inline, protected]

void ISTable::ClearRowMap (  )  [inline, protected]

void ISTable::EnlargeRowMap ( const unsigned int  numRows  )  [protected]

void ISTable::ReduceRowMap ( const unsigned int  numRows  )  [protected]

void ISTable::MarkRowDeleted ( const unsigned int  rowIndex  )  [protected]

void ISTable::UnMarkRowDeleted ( const unsigned int  rowIndex  )  [protected]

bool ISTable::IsDelete ( const unsigned int  rowIndex  )  [protected]

StringCompare::eCompareType ISTable::GetCompareType ( const vector< unsigned int > &  colIndices  )  [protected]

string ISTable::CellValue ( const unsigned int  colIndex,
const unsigned int  rowIndex 
) [protected]

string ISTable::ConvertString ( const string &  value,
const unsigned int  colIndex 
) [protected]

string ISTable::MultiStringsValue ( const vector< string > &  values,
const vector< unsigned int > &  colIndices 
) [protected]

string ISTable::SubRowValue ( const vector< unsigned int > &  colIndices,
const unsigned int  rowIndex 
) [protected]

string ISTable::AggregateRow ( const vector< unsigned int > &  colIndices,
const unsigned int  rowIndex 
) [protected]

void ISTable::AppendToAndDelimit ( string &  to,
const string &  appending 
) [inline, protected]

void ISTable::ValidateOptions ( unsigned int  colIndex  )  [protected]

string ISTable::CreateInternalIndexName ( const unsigned int  indexIndex  )  [protected]

void ISTable::UpdateIndex ( const unsigned int  indexIndex,
const unsigned int  rowIndex 
) [protected]

void ISTable::RebuildIndex ( const unsigned int  indexIndex  )  [protected]

void ISTable::ClearIndex ( const unsigned int  indexIndex  )  [protected]

void ISTable::DeleteIndex ( const unsigned int  indexIndex  )  [protected]

int ISTable::FindIndex ( const string &  indexName  )  [protected]

int ISTable::FindIndex ( const vector< unsigned int > &  colIndices  )  [protected]

void ISTable::UpdateIndices ( const unsigned int  rowIndex  )  [protected]

void ISTable::ClearIndices (  )  [protected]

bool ISTable::IsColumnInIndex ( const unsigned int  indexIndex,
const unsigned int  colIndex 
) [protected]

int ISTable::FindKeyIndex (  )  [protected]

void ISTable::UpdateColListOnColInsert ( const unsigned int  colIndex  )  [protected]

void ISTable::UpdateColListOnColDelete ( const unsigned int  colIndex  )  [protected]

void ISTable::UpdateColListOnCellUpdate ( const unsigned int  rowIndex,
const unsigned int  colIndex 
) [protected]

unsigned int ISTable::FindFirst ( const vector< string > &  targets,
const vector< unsigned int > &  colIndices,
const unsigned int  indexIndex 
) [protected]

void ISTable::Search ( vector< unsigned int > &  res,
const vector< string > &  targets,
const vector< unsigned int > &  colIndices,
const unsigned int  indexIndex,
const eSearchType  searchType = eEQUAL 
) [protected]

void ISTable::Search ( vector< unsigned int > &  res,
const vector< string > &  targets,
const vector< string > &  colNames,
const unsigned int  indexIndex,
const eSearchType  searchType = eEQUAL 
) [protected]

int ISTable::GetObjectV6 ( Word  index,
FileNavigator *  ,
int &  size 
) [protected]

int ISTable::GetObjectV3 ( Word  index,
FileNavigator *  ,
int &  size 
) [protected]

int ISTable::GetObjectV2 ( Word  index,
FileNavigator *  ,
int &  size 
) [protected]

int ISTable::GetObjectV1 ( Word  index,
FileNavigator *  ,
int &  size 
) [protected]

int ISTable::GetObjectV1_1 ( Word  index,
FileNavigator *  ,
int &  size 
) [protected]

void ISTable::MakeTableRectangular (  )  [protected]

void ISTable::Print ( unsigned int  indexIndex  )  [protected]

void ISTable::ConvertToInt ( const string &  a,
string &  ret 
) [protected]

void ISTable::ConvertDouble ( const string &  a,
string &  ret 
) [protected]

void ISTable::ConvertToLowerNoWhiteSpace ( const string &  a,
string &  ret 
) [protected]

ISTable & ISTable::operator= ( const ISTable inTable  ) 

ISTable::eTableDiff ISTable::operator== ( ISTable inTable  ) 

void ISTable::AddColumn ( const string &  colName,
const unsigned char  opts = DEFAULT_OPTIONS,
const vector< string > &  col = vector< string >(0) 
)

void ISTable::InsertColumn ( const string &  colName,
const string &  afterColName,
const unsigned char  opts = DEFAULT_OPTIONS,
const vector< string > &  col = vector< string >(0) 
)

void ISTable::FillColumn ( const string &  colName,
const vector< string > &  col 
) [virtual]

Fills a column with values.

Parameters:
[in] colName - the name of the column to be filled
[in] col - contains the values which are to be used for filling. Filling starts at row index 0 and continues until size of col.
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

The size of col must be less than or equal to the number of rows.

The column which comes, in order, before the column with name colName, must be non-empty. This is to prevent creation of non-rectangular tables.

Postcondition:
If table is empty (0 rows), the number of rows is set to the size of col. Otherwise, the number of rows is unchanged.
Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist
out_of_range - if size of col is greater than the number of rows
out_of_range - if column, which comes, in order, before the column with name colName, is empty.

Reimplemented from STable.

void ISTable::AppendToColumn ( const string &  colName,
const vector< string > &  col 
) [virtual]

Appends cells to the specified column.

Parameters:
[in] colName - the name of the column to which the cells are to be appended
[in] col - contains the values which are to be appended.
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

The column, which comes, in order, before the column with name colName, must be non-empty. This is to prevent creation of non-rectangular tables.

Postcondition:
The number of rows is increased by the size of col.

Cells in other columns of the, newly appended rows, are set to empty values.

Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist
out_of_range - if column, which comes, in order, before the column with name colName, is empty.

Reimplemented from STable.

void ISTable::AppendToColumn ( const string &  colName,
const string &  cell 
) [virtual]

Appends one cell to the specified column.

Parameters:
[in] colName - the name of the column to which the cell is to be appended
[in] cell - contains the value that is to be appended
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

The column, which comes, in order, before the column with name colName, must be non-empty. This is to prevent creation of non-rectangular tables.

Postcondition:
The number of rows is increased by one.

Cells in other columns of the, newly appended row, are set to empty values.

Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist
out_of_range - if column, which comes, in order, before the column with name colName, is empty.

Reimplemented from STable.

void ISTable::ClearColumn ( const string &  colName  )  [virtual]

Sets all cells in the column to empty string.

Parameters:
[in] colName - the name of the column
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

Postcondition:
Column length is unchanged.
Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist

Reimplemented from STable.

void ISTable::DeleteColumn ( const string &  colName  )  [virtual]

Deletes a column from the table.

Parameters:
[in] colName - the name of the column
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

Postcondition:
The number of table columns is reduced by one.
Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist

Reimplemented from STable.

void ISTable::GetColumn ( vector< string > &  col,
const string &  colName 
) [virtual]

Retrieves the values in the specified column.

Parameters:
[out] col - retrieved column values
[in] colName - the name of the column which content is to be retrieved.
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist

Reimplemented from STable.

void ISTable::GetColumn ( vector< string > &  col,
const string &  colName,
const string &  indexName 
)

void ISTable::GetColumn ( vector< string > &  subCol,
const string &  colName,
const unsigned int  fromRowIndex,
unsigned int  toRowIndex 
) [virtual]

Retrieves values in the specified column range.

Parameters:
[out] col - retrieved values
[in] colName - the name of the column which content is to be retrieved.
[in] fromRowIndex - the row index of the first cell in the column to be retrieved.
[in] toRowIndex - the row index of the last cell in the column to be retrieved.
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

fromRowIndex must be less than or equal to the column length

toRowIndex must be less than or equal to the column length

fromRowIndex must be less than or equal to the toRowIndex

Postcondition:
None
Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist
out_of_range - if fromRowIndex is greater than the column length
out_of_range - if toRowIndex is greater than the column length
out_of_range - if fromRowIndex is greater than toRowIndex

Reimplemented from STable.

void ISTable::GetColumn ( vector< string > &  subCol,
const string &  colName,
const vector< unsigned int > &  rowIndex 
) [virtual]

Retrieves values in the specified column cells.

Parameters:
[out] col - retrieved values
[in] colName - the name of the column which content is to be retrieved
[in] rowIndices - indices of column cells to be retrieved
Returns:
None
Precondition:
colName must be non-empty

Column with name colName must be present

Row indices in rowIndices must be less than or equal to the column length

Postcondition:
None
Exceptions:
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist
out_of_range - if at least one row index in rowIndices is greater than the column length

Reimplemented from STable.

unsigned int ISTable::AddRow (  ) 

unsigned int ISTable::InsertRow ( const unsigned int  rowIndex,
const vector< string > &  row = vector< string >(0) 
) [virtual]

Inserts a new row at the specified row index and shifts, down by one, the old row with the specified row index and all other rows below it. For an empty table, the number of inserted cells is equal to the number of table columns. For a non-empty table, the number of inserted cells is equal to the number of non-empty columns (this is in order to prevent creation of non-rectangular tables). The newly inserted row is optionally filled with values, starting at the first column.

Parameters:
[in] atRowIndex - index of the row at which the new row is to be inserted. Note: If atRowIndex is equal to the number of rows, the operation of this method is equivalent to AddRow().
[in] row - optional parameter that contains the values which are to be used to fill in the newly inserted row. Filling starts at the first column and continues until size of row.
Returns:
The new number of rows after the row insertion.
Precondition:
Table must have at least one column, which can be empty.

atRowIndex must be less than or equal to the number of table rows.

If table is not empty and row is specified, the size of row must be less than or equal to the number of non-empty columns. This is in order to prevent creation of non-rectangular tables.

If table is empty and row is specified, the size of row must be less than or equal to the number of columns.

Postcondition:
The number of rows is increased by one.

Row indices of the rows which are below the inserted row are invalidated by being increased by 1.

Exceptions:
EmptyContainerException - if table has no columns.
out_of_range - if atRowIndex is greater than the number of table rows.
out_of_range - if table is not empty and size of row is greater than the number of non-empty columns.
out_of_range - if table is empty and size of row is greater than the number of columns.

Reimplemented from STable.

void ISTable::FillRow ( const unsigned int  rowIndex,
const vector< string > &  row 
) [virtual]

Fills, with values, a row at the specified row index, starting at the the first column.

Parameters:
[in] rowIndex - index of the row that is to be filled.
[in] row - values which are to be used to fill in the row. Filling starts at the first column and continues until size of row.
Returns:
None
Precondition:
rowIndex must be greater than 0 and less than the number of table rows.

The size of row must be less than or equal to the number of non-empty columns. This is in order to prevent creation of non-rectangular tables.

Postcondition:
None
Exceptions:
out_of_range - if rowIndex is greater than or equal to the number of table rows.
out_of_range - if size of row is greater than the number of non-empty columns.

Reimplemented from STable.

void ISTable::ClearRow ( const unsigned int  rowIndex  )  [virtual]

Sets all cells in the row to empty string.

Parameters:
[in] rowIndex - index of the row that is to be cleared.
Returns:
None
Precondition:
rowIndex must be greater than 0 and less than the number of table rows.
Postcondition:
None
Exceptions:
out_of_range - if rowIndex is less than 0 or greater than or equal to the number of table rows.

Reimplemented from STable.

void ISTable::DeleteRow ( const unsigned int  rowIndex  )  [virtual]

Deletes a row with the specified row index.

Parameters:
[in] rowIndex - index of the row that is to be deleted.
Returns:
None
Precondition:
rowIndex must be greater than 0 and less than the number of table rows.
Postcondition:
Number of table rows is reduced by 1.

Row indices of the rows which are below the deleted row are invalidated by being reduced by 1.

Exceptions:
out_of_range - if rowIndex is less than 0 or greater than or equal to the number of table rows.

Reimplemented from STable.

void ISTable::DeleteRows ( const vector< unsigned int > &  rows  ) 

unsigned int ISTable::GetNumRows (  )  const [inline, virtual]

Retrieves the number of rows in the table.

Parameters: None

Returns:
The number of rows in the table.
Precondition:
None
Postcondition:
None

Reimplemented from STable.

unsigned int ISTable::GetLastRowIndex (  )  [inline]

void ISTable::GetRow ( vector< string > &  subRow,
const unsigned int  rowIndex,
const string &  fromColName = String::Empty,
const string &  toColName = String::Empty 
) [virtual]

Retrieves the values in the specified row.

Parameters:
[out] row - retrieved row values
[in] rowIndex - index of the row which values are to be retrieved.
[in] fromColName - optional parameter which specifies the row location of the first cell to be retrieved. If not specified the first column cell is used.
[in] toColName - optional parameter which specifies the row location of the last cell to be retrieved. If not specified the last non-empty-column cell is used.
Returns:
None
Precondition:
rowIndex must be greater than 0 and less than the number of table rows.

If fromColName is specified, the column with name fromColName must be present and must be non-empty

If toColName is specified, the column with name toColName must be present and must be non-empty

If fromColName is different than toColName, it must come prior to it in the column order.

Postcondition:
None
Exceptions:
out_of_range - if rowIndex is less than 0 or greater than or equal to the number of table rows.
NotFoundException - If fromColName is specified and column with name fromColName does not exist
NotFoundException - If toColName is specified and column with name toColName does not exist
out_of_range - If fromColName is specified and column with name fromColName exists but is empty
out_of_range - If toColName is specified and column with name toColName exists but is empty
out_of_range - if fromColName is different than toColName and it comes after it in the column order.

Reimplemented from STable.

void ISTable::FindRedundantRows ( const vector< string > &  colNames,
vector< pair< unsigned int, unsigned int > > &  duplRows,
const unsigned int  keep,
const eSearchDir  searchDir = eFORWARD 
)

void ISTable::UpdateCell ( const unsigned int  rowIndex,
const string &  colName,
const string &  cell 
) [virtual]

Updates a cell in the table.

Parameters:
[in] rowIndex - row index of the cell that is to be updated.
[in] colName - the name of the column
Returns:
None
Precondition:
rowIndex must be greater than 0 and less than the number of table rows.

colName must be non-empty

Column with name colName must be present

Postcondition:
None
Exceptions:
out_of_range - if rowIndex is less than 0 or greater than or equal to the number of table rows.
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist

Reimplemented from STable.

const string & ISTable::operator() ( const unsigned int  rowIndex,
const string &  colName 
) const [virtual]

Retrieves a reference to the cell in the table.

Parameters:
[in] rowIndex - row index of the cell that is to be updated.
[in] colName - the name of the column
Returns:
Constant reference to a cell in the table.
Precondition:
rowIndex must be greater than 0 and less than the number of table rows.

colName must be non-empty

Column with name colName must be present

Postcondition:
None
Exceptions:
out_of_range - if rowIndex is less than 0 or greater than or equal to the number of table rows.
EmptyValueException - if colName is empty
NotFoundException - if column with name colName does not exist

Reimplemented from STable.

bool ISTable::IndexExists ( const string &  indexName  )  [inline]

void ISTable::CreateIndex ( const string &  indexName,
const vector< string > &  colNames,
const unsigned int  unique = 0 
)

void ISTable::UpdateIndex ( const string &  indexName,
const unsigned int  rowIndex 
)

void ISTable::RebuildIndex ( const string &  indexName  ) 

void ISTable::RebuildIndices (  ) 

void ISTable::DeleteIndex ( const string &  indexName  ) 

unsigned int ISTable::GetNumIndices (  )  [inline]

void ISTable::CreateKey ( const vector< string > &  colNames  ) 

void ISTable::SetFlags ( const string &  colName,
const unsigned char  newOpts 
)

unsigned char ISTable::GetDataType ( const string &  colName  ) 

unsigned int ISTable::FindFirst ( const vector< string > &  targets,
const vector< string > &  colNames = vector< string >(0),
const string &  indexName = String::Empty 
)

void ISTable::Search ( vector< unsigned int > &  res,
const string &  target,
const string &  colName 
)

void ISTable::Search ( vector< unsigned int > &  res,
const vector< string > &  targets,
const vector< string > &  colNames = vector< string >(0),
const eSearchType  searchType = eEQUAL,
const string &  indexName = String::Empty 
)

void ISTable::SetModified ( const bool  modified  )  [inline]

bool ISTable::GetModified (  )  [inline]

void ISTable::SetFileNavigator ( FileNavigator *  fileNavigator  ) 

int ISTable::WriteObject ( FileNavigator *  ,
int &  size 
)

int ISTable::GetObject ( Word  index,
FileNavigator *  ,
int &  size 
)

void ISTable::Read ( unsigned int  indexInFile  ) 

int ISTable::Write (  ) 

void ISTable::Merge ( ISTable inTable,
unsigned int  typeOfMerge = 0 
)

bool ISTable::PrintDiff ( ISTable inTable  ) 

void ISTable::Print ( const string &  indexName  ) 

void ISTable::SetUnion ( const vector< unsigned int > &  a,
const vector< unsigned int > &  b,
vector< unsigned int > &  ret 
) [static]

void ISTable::SetIntersect ( const vector< unsigned int > &  a,
const vector< unsigned int > &  b,
vector< unsigned int > &  ret 
) [static]


Member Data Documentation

const string ISTable::_version [static, private]

FileNavigator* ISTable::_fnav [private]

const unsigned int ISTable::EXPONENT = 4 [static, protected]

const unsigned int ISTable::MAX_PRECISION = DBL_DIG [static, protected]

const unsigned int ISTable::MANTISSA = MAX_PRECISION + 2 [static, protected]

const unsigned int ISTable::INT_LIMIT = 11 [static, protected]

const unsigned char ISTable::DT_STRING_VAL = 1 [static, protected]

const unsigned char ISTable::DT_INTEGER_VAL = 2 [static, protected]

const unsigned char ISTable::DT_DOUBLE_VAL = 3 [static, protected]

const unsigned char ISTable::DT_MASK = 15 << 4 [static, protected]

const unsigned char ISTable::SC_MASK = 0x01 [static, protected]

const unsigned char ISTable::WS_MASK = 0x02 [static, protected]

const unsigned char ISTable::LAST_DT_VALUE = 3 [static, protected]

const unsigned int ISTable::DEFAULT_PRECISION = MAX_PRECISION [static, protected]

const unsigned char ISTable::DEFAULT_OPTIONS = DT_STRING_VAL << 4 [static, protected]

bool ISTable::_modified [protected]

vector<unsigned int> ISTable::_rowMap [protected]

unsigned int ISTable::_numDels [protected]

vector<unsigned int> ISTable::_precision [protected]

vector<unsigned char> ISTable::_compare_opts [protected]

vector<string> ISTable::_indexNames [protected]

vector<vector<unsigned int> > ISTable::_listsOfColumns [protected]

vector<tIndex> ISTable::_indices [protected]

vector<unsigned int> ISTable::_unique [protected]

const unsigned char ISTable::CASE_SENSE = 0x00 [static]

const unsigned char ISTable::CASE_INSENSE = 0x01 [static]

const unsigned char ISTable::W_SPACE_SENSE = 0x00 [static]

const unsigned char ISTable::W_SPACE_INSENSE = 0x02 [static]

const unsigned char ISTable::DT_STRING = DT_STRING_VAL << 4 [static]

const unsigned char ISTable::DT_INTEGER = DT_INTEGER_VAL << 4 [static]

const unsigned char ISTable::DT_DOUBLE = DT_DOUBLE_VAL << 4 [static]


The documentation for this class was generated from the following files:
Generated on Mon Apr 2 09:28:51 2007 for cif-table-obj-v7.0 by  doxygen 1.5.1