librcsb-core-wrapper  1.000
Public Types | Public Member Functions | Static Public Attributes | List of all members
ITTable Class Reference

Private class that respresents a two-dimensional table of strings. More...

#include <ITTable.h>

Collaboration diagram for ITTable:
Collaboration graph

Public Types

enum  eOrientation { eCOLUMN_WISE = 0, eROW_WISE }
 
enum  eSearchType {
  eEQUAL = 0, eLESS_THAN, eLESS_THAN_OR_EQUAL, eGREATER_THAN,
  eGREATER_THAN_OR_EQUAL
}
 
enum  eSearchDir { eFORWARD = 0, eBACKWARD }
 

Public Member Functions

 ITTable ()
 
 ITTable (eOrientation orient)
 
 ITTable (const ITTable &inTable)
 
 ~ITTable ()
 
ITTableoperator= (const ITTable &inTable)
 
unsigned int GetNumColumns () const
 
void AddColumn (const std::string &colName, const std::vector< std::string > &col=std::vector< std::string >())
 
void InsertColumn (const std::string &colName, const std::string &atColName, const std::vector< std::string > &col=std::vector< std::string >())
 
void FillColumn (const std::string &colName, const std::vector< std::string > &col)
 
void AppendToColumn (const std::string &colName, const std::string &cell)
 
void AppendToColumn (const std::string &colName, const std::vector< std::string > &col)
 
void GetColumn (std::vector< std::string > &col, const std::string &colName)
 
void GetColumn (std::vector< std::string > &col, const std::string &colName, const unsigned int fromRowIndex, unsigned int toRowIndex)
 
void GetColumn (std::vector< std::string > &col, const std::string &colName, const std::vector< unsigned int > &rowIndex)
 
void ClearColumn (const std::string &colName)
 
void DeleteColumn (const std::string &colName)
 
unsigned int GetNumRows () const
 
unsigned int AddRow (const std::vector< std::string > &row=std::vector< std::string >())
 
unsigned int InsertRow (const unsigned int atRowIndex, const std::vector< std::string > &row=std::vector< std::string >())
 
void FillRow (const unsigned int rowIndex, const std::vector< std::string > &row)
 
void GetRow (std::vector< std::string > &row, const unsigned int rowIndex, const std::string &fromColName=std::string(), const std::string &toColName=std::string())
 
void ClearRow (const unsigned int rowIndex)
 
void DeleteRow (const unsigned int rowIndex)
 
void DeleteRows (const std::vector< unsigned int > &rows)
 
unsigned int GetLastRowIndex ()
 
void UpdateCell (const unsigned int rowIndex, const std::string &colName, const std::string &value)
 
const std::string & operator() (const unsigned int rowIndex, const std::string &colName) const
 
void SetFlags (const std::string &colName, const unsigned char flags)
 
unsigned char GetDataType (const std::string &colName)
 
void FindDuplicateRows (std::vector< std::pair< unsigned int, unsigned int > > &duplRows, const std::vector< std::string > &colNames, const bool keepDuplRows, const eSearchDir searchDir=eFORWARD)
 
void ValidateOptions (unsigned int colIndex)
 
void UpdateIndex (const unsigned int indexIndex, const unsigned int rowIndex)
 
void InsertIndexEntry (const unsigned int indexIndex, const unsigned int rowIndex)
 
void DeleteIndexEntry (const unsigned int indexIndex, const unsigned int rowIndex)
 
void VerifyColumnsIndices (const std::vector< unsigned int > &colIndices)
 
int FindIndex (const std::vector< unsigned int > &colIndices)
 
int SetFlags (const unsigned char newOpts, const unsigned int colIndex)
 
unsigned int FindFirst (const std::vector< std::string > &targets, const std::vector< unsigned int > &colIndices, const unsigned int indexIndex)
 
void Search (std::vector< unsigned int > &res, const std::vector< std::string > &targets, const std::vector< unsigned int > &colIndices, const unsigned int indexIndex, const eSearchType searchType=eEQUAL)
 
void DeleteIndex (const unsigned int indexIndex)
 
void Search (std::vector< unsigned int > &res, const std::string &target, const unsigned int colIndex, const eSearchType searchType=eEQUAL)
 
void FindDuplicateRows (const std::vector< unsigned int > &colIndices, std::vector< std::pair< unsigned int, unsigned int > > &duplRows, const bool keep, const eSearchDir searchDir=eFORWARD)
 
void RebuildIndex (const unsigned int indexIndex)
 
void InsertColumn (const unsigned int colIndex, const std::vector< std::string > &col=std::vector< std::string >())
 
void InsertColumn (const unsigned int colIndex, std::vector< std::string >::const_iterator colBeg, std::vector< std::string >::const_iterator colEnd)
 
void Clear ()
 
const std::string & operator() (const unsigned int rowIndex, const unsigned int colIndex) const
 
int UpdateCell (const std::string &cell, const unsigned int colIndex, const unsigned int rowIndex)
 
void FillColumn (const std::vector< std::string > &col, const unsigned int colIndex)
 
void FillColumn (const unsigned int colIndex, std::vector< std::string >::const_iterator colBeg, std::vector< std::string >::const_iterator colEnd)
 
void AppendToColumn (const unsigned int colIndex, const std::vector< std::string > &col)
 
void AppendToColumn (const unsigned int colIndex, const std::string &cell)
 
void CreateColumn (const unsigned int atColIndex, const std::vector< std::string > &col=std::vector< std::string >())
 
void CreateColumn (const unsigned int atColIndex, std::vector< std::string >::const_iterator colBeg, std::vector< std::string >::const_iterator colEnd)
 
void GetColumn (std::vector< std::string > &col, const unsigned int colIndex, const unsigned int fromRowIndex, unsigned int toRowIndex)
 
void GetColumn (std::vector< std::string > &col, const unsigned int colIndex, const std::vector< unsigned int > &rowIndex)
 
void ClearColumn (const unsigned int colIndex)
 
void DeleteColumn (const unsigned int colIndex)
 
void GetColumn (std::vector< std::string > &col, const unsigned int colIndex)
 
void GetRow (std::vector< std::string > &row, const unsigned int rowIndex, const unsigned int fromColIndex, unsigned int toColIndex)
 
const std::vector< std::string > & GetRow (const unsigned int rowIndex)
 
eOrientation GetOrientation ()
 
void CreateIndex (const std::vector< unsigned int > &colIndices, const unsigned int unique=0)
 
void SetSerializer (Serializer *ser)
 
int WriteObject (Serializer *ser, int &size)
 
int GetObject (UInt32 index, Serializer *ser)
 
int Read (unsigned int indexInFile, Serializer *ser)
 
int Write (Serializer *ser, int &size)
 
void RebuildIndices ()
 
void InsertEntry (const unsigned int rowIndex)
 
void DeleteEntry (const unsigned int rowIndex)
 
unsigned int GetNumIndices ()
 
void GetColumn (std::vector< std::string > &col, const unsigned int colIndex, const unsigned int indexIndex)
 

Static Public Attributes

static const unsigned char DT_STRING_VAL = 1
 
static const unsigned char DT_INTEGER_VAL = 2
 
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
 

Detailed Description

Private class that respresents a two-dimensional table of strings.

This class represents a two-dimensional table of cells. Each cell holds a text string. The table is identified by its name. Rows are horizontal table entities identified by row indices, which are unsigned integers ranging from zero to the number of rows minus one. Columns are vertical table entities identified by (non-empty) column names. Column names can be case-sensitive (by default) or case-insensitive (customizable during construction). The class provides methods for table construction and destruction, assignment operator, equal operator, column and row based methods for addition, insertion, retrieval, update, deletion, cell based methods for update and retrieval, column search methods and table printing. Table cells are internally stored as vectors of text strings, where vectors can represent either columns (by default) or rows (customizable during construction).

Member Enumeration Documentation

Enumerator
eCOLUMN_WISE 
eROW_WISE 
Enumerator
eFORWARD 
eBACKWARD 
Enumerator
eEQUAL 
eLESS_THAN 
eLESS_THAN_OR_EQUAL 
eGREATER_THAN 
eGREATER_THAN_OR_EQUAL 

Constructor & Destructor Documentation

ITTable::ITTable ( )

Constructs a table.

Returns
Not applicable
Precondition
None
Postcondition
Constructed table has 0 rows and 0 columns.
Constructed table is nameless (its name is an empty string).
Exceptions
None
ITTable::ITTable ( eOrientation  orient)

Constructs a table.

Parameters
[in]orient- table orientation. Possible values are row-wise orientation (vectors of strings represent table rows) and column-wise orientation (vectors of strings represent table columns)
Returns
Not applicable
Precondition
None
Postcondition
Constructed table has 0 rows and 0 columns.
Constructed table is nameless (its name is an empty string).
Exceptions
None
ITTable::ITTable ( const ITTable inTable)

Constructs a table by copying from another table (copy constructor).

Parameters
[in]inTable- reference to a table that will be copied to the newly constructed table
Returns
Not applicable
Precondition
None
Postcondition
Constructed table is a clone (has the same name, internal cells orientation, case sensitivity, column names, content) as the table referenced by inTable.
Exceptions
None
ITTable::~ITTable ( )

Destructs a table, by releasing all the used resources.

Parameters
Not applicable
Returns
Not applicable
Precondition
None
Postcondition
None
Exceptions
None

Member Function Documentation

void ITTable::AddColumn ( const std::string &  colName,
const std::vector< std::string > &  col = std::vector< std::string >() 
)

Adds a column to the end of the table.

Parameters
[in]colName- the name of the column to be added
[in]col- optional parameter that contains the values which are to be used to fill in the newly added column. If col is specified, filling starts at row index 0 and continues until size of col. If col is not specified, the newly added column is filled with empty values, where filling starts at row index 0 and ends at row index "number of rows - 1".
Returns
None
Precondition
colName must be non-empty
Column with name colName must not be present
If col is specified, the size of col must be less than or equal to the number of rows.
Postcondition
If table is empty (0 rows) and col is specified, the number of rows is set to the size of col. Otherwise, the number of rows is unchanged.
Exceptions
EmptyValueException- if colName is empty
AlreadyExistsException- if column with name colName already exists
out_of_range- if size of col is greater than the number of rows
unsigned int ITTable::AddRow ( const std::vector< std::string > &  row = std::vector< std::string >())

Adds a row to the end of the table. For an empty table (0 rows), 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 added row is, optionally, filled with values, starting at the first column.

Parameters
[in]row- optional parameter that contains the values which are to be used to fill in the newly added row. If row is specified, filling starts at the first column and continues until size of row is reached. If row is not specified and table is empty, the newly inserted row is filled with empty values, where filling starts at the first column and continues until the number of columns is reached. If row is not specified and table is not empty, the newly inserted row is filled with empty values, where filling starts at the first column and continues until the number of non-empty columns is reached.
Returns
The new number of rows after the row addition.
Precondition
Table must have at least one column, which can be empty.
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.
Exceptions
EmptyContainerException- if table has no columns.
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.
void ITTable::AppendToColumn ( const std::string &  colName,
const std::string &  cell 
)

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.
void ITTable::AppendToColumn ( const std::string &  colName,
const std::vector< std::string > &  col 
)

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.
void ITTable::AppendToColumn ( const unsigned int  colIndex,
const std::vector< std::string > &  col 
)
void ITTable::AppendToColumn ( const unsigned int  colIndex,
const std::string &  cell 
)
void ITTable::Clear ( )
void ITTable::ClearColumn ( const std::string &  colName)

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
void ITTable::ClearColumn ( const unsigned int  colIndex)
void ITTable::ClearRow ( const unsigned int  rowIndex)

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 or equal to 0 and less than the number of table rows.
Postcondition
Number of table rows is unchanged.
Exceptions
out_of_range- if rowIndex is greater than or equal to the number of table rows.
void ITTable::CreateColumn ( const unsigned int  atColIndex,
const std::vector< std::string > &  col = std::vector< std::string >() 
)
void ITTable::CreateColumn ( const unsigned int  atColIndex,
std::vector< std::string >::const_iterator  colBeg,
std::vector< std::string >::const_iterator  colEnd 
)
void ITTable::CreateIndex ( const std::vector< unsigned int > &  colIndices,
const unsigned int  unique = 0 
)
void ITTable::DeleteColumn ( const std::string &  colName)

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
void ITTable::DeleteColumn ( const unsigned int  colIndex)
void ITTable::DeleteEntry ( const unsigned int  rowIndex)
void ITTable::DeleteIndex ( const unsigned int  indexIndex)
void ITTable::DeleteIndexEntry ( const unsigned int  indexIndex,
const unsigned int  rowIndex 
)
void ITTable::DeleteRow ( const unsigned int  rowIndex)

Deletes a row with the specified index and shifts, up by one, all other rows below it.

Parameters
[in]rowIndex- index of the row that is to be deleted.
Returns
None
Precondition
rowIndex must be greater than or equal to 0 and less than the number of table rows.
Postcondition
Number of table rows is reduced by one.
Row indices of the rows which are below the deleted row are invalidated by being reduced by one.
Exceptions
out_of_range- if rowIndex is greater than or equal to the number of table rows.
void ITTable::DeleteRows ( const std::vector< unsigned int > &  rows)

Deletes rows with specified indices.

Parameters
[in]rows- indices of rows that are to be deleted.
Returns
None
Precondition
indices in rows must be greater than or equal to 0 and less than the number of table rows.
Postcondition
Number of table rows is reduced by the size of rows.
Row indices of the remaining rows are invalidated by being appropriatelly adjusted.
Exceptions
out_of_range- if any row index in rows is greater than or equal to the number of table rows.
void ITTable::FillColumn ( const std::string &  colName,
const std::vector< std::string > &  col 
)

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.
void ITTable::FillColumn ( const std::vector< std::string > &  col,
const unsigned int  colIndex 
)
void ITTable::FillColumn ( const unsigned int  colIndex,
std::vector< std::string >::const_iterator  colBeg,
std::vector< std::string >::const_iterator  colEnd 
)
void ITTable::FillRow ( const unsigned int  rowIndex,
const std::vector< std::string > &  row 
)

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 is reached.
Returns
None
Precondition
rowIndex must be greater than or equal to 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.
void ITTable::FindDuplicateRows ( std::vector< std::pair< unsigned int, unsigned int > > &  duplRows,
const std::vector< std::string > &  colNames,
const bool  keepDuplRows,
const eSearchDir  searchDir = eFORWARD 
)

Searches the columns for the first occurrence of target values and returns the row index, where the match was found. The performed search is a forward search (starts at row index 0) and search criteria is value equality. If match was not found, the number of table rows is returned.

Parameters
[in]targets- values that are to be searched for
[in]colNames- column names that are to be searched
[in]indexName- optional parameter not used and will be soon be removed
Returns
the first row index, where the match was found
the number of rows, if the match was not found
Precondition
Each column name in colNames must be non-empty
Each column name in colNames must be present
colNames and targets must have the same size
Postcondition
None
Exceptions
EmptyValueException- if one or more column names in colNames is empty
NotFoundException- if one or more column names in colNames does not exist
out_of_range- if colNames and targets have different sizes Searches one column for all occurrences of target value and returns row indices, where the match was found.
Parameters
[out]res- vector of row indices, where the match was found
[in]target- value that is to be searched for
[in]colName- column name that is to be searched
[in]searchType- optional parameter that specifies search criteria: equality, less than, less than or equal, greater than, greater than or equal. These are the text strings search criteria. If not specified, the search criteria is equality.
Returns
None
Precondition
colName must be non-empty
Column with name colName must be present
Postcondition
None
Exceptions
EmptyValueException- if colName is empty
NotFoundException- if column with name colName does not exist Searches the columns for all occurrences of target values and returns row indices, where the match was found.
Parameters
[out]res- vector of row indices, where the match was found
[in]targets- values that are to be searched for
[in]colNames- column names that are to be searched
[in]searchType- optional parameter that specifies search criteria: equality, less than, less than or equal, greater than, greater than or equal. These are the text strings search criteria. If not specified, the search criteria is equality.
[in]indexName- optional parameter not used and will be soon be removed.
Returns
None
Precondition
Each column name in colNames must be non-empty
Each column name in colNames must be present
colNames and targets must have the same size
Postcondition
None
Exceptions
EmptyValueException- if one or more column names in colNames is empty
NotFoundException- if one or more column names in colNames does not exist
out_of_range- if colNames and targets have different sizes Finds duplicate rows and, optionally, deletes them.
Parameters
[out]duplRows- vector of pairs of indices, where each pair indicates a row and its duplicate row
[in]colNames- column names that are of inerest in determining duplicate rows. Note that determination of duplicate rows is not done based on all values in a row, but based on the cell values in the columns specified in this parameter.
[in]keepDuplRows- indicates whether duplicate rows should be kept in the table (if true) or deleted (if false).
[in]searchDir- optional parameter which specifies search direction. This parameter is only relevant when duplicate rows are deleted. If searchDir specifies forward search, the deleted duplicate rows will have bigger index than the original row. If searchDir specifies backward search, the deleted duplicate rows will have smaller index than the original row.
Returns
None
Precondition
Each column name in colNames must be non-empty
Each column name in colNames must be present
Postcondition
If deletion of duplicate rows is requested, the number of table rows will be reduced by the number of duplicate rows.
Exceptions
EmptyValueException- if one or more column names in colNames is empty
NotFoundException- if one or more column names in colNames does not exist
void ITTable::FindDuplicateRows ( const std::vector< unsigned int > &  colIndices,
std::vector< std::pair< unsigned int, unsigned int > > &  duplRows,
const bool  keep,
const eSearchDir  searchDir = eFORWARD 
)
unsigned int ITTable::FindFirst ( const std::vector< std::string > &  targets,
const std::vector< unsigned int > &  colIndices,
const unsigned int  indexIndex 
)
int ITTable::FindIndex ( const std::vector< unsigned int > &  colIndices)
void ITTable::GetColumn ( std::vector< std::string > &  col,
const std::string &  colName 
)

Retrieves column values.

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
Postcondition
None
Exceptions
EmptyValueException- if colName is empty
NotFoundException- if column with name colName does not exist
void ITTable::GetColumn ( std::vector< std::string > &  col,
const std::string &  colName,
const unsigned int  fromRowIndex,
unsigned int  toRowIndex 
)

Retrieves column values in the specified row 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
void ITTable::GetColumn ( std::vector< std::string > &  col,
const std::string &  colName,
const std::vector< unsigned int > &  rowIndex 
)

Retrieves column values in the specified rows.

Parameters
[out]col- retrieved values
[in]colName- the name of the column which content is to be retrieved
[in]rowIndices- row 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
void ITTable::GetColumn ( std::vector< std::string > &  col,
const unsigned int  colIndex,
const unsigned int  fromRowIndex,
unsigned int  toRowIndex 
)
void ITTable::GetColumn ( std::vector< std::string > &  col,
const unsigned int  colIndex,
const std::vector< unsigned int > &  rowIndex 
)
void ITTable::GetColumn ( std::vector< std::string > &  col,
const unsigned int  colIndex 
)
void ITTable::GetColumn ( std::vector< std::string > &  col,
const unsigned int  colIndex,
const unsigned int  indexIndex 
)

Utility method, not part of users public API.

unsigned char ITTable::GetDataType ( const std::string &  colName)

Retrieves data type flag of a column.

Parameters
[in]colName- the name of the column
Returns
DT_STRING_VAL - if data type of a column is string.
DT_INTEGER_VAL - if data type of a column is integer.
Precondition
colName must be non-empty
Column with name colName must be present
Postcondition
None
Exceptions
EmptyValueException- if colName is empty
NotFoundException- if column with name colName does not exist
unsigned int ITTable::GetLastRowIndex ( )
inline

Retrieves the row index of the last row in the table.

Parameters
None
Returns
The index of the last row in the table.
Precondition
None
Postcondition
None
Exceptions
None

References GetNumRows().

unsigned int ITTable::GetNumColumns ( ) const
inline

Retrieves the number of columns in the table.

Parameters
None
Returns
The number of columns in the table.
Precondition
None
Postcondition
None
Exceptions
None

References eCOLUMN_WISE, TTable::GetNumColumns(), and TTable::GetNumTuples().

unsigned int ITTable::GetNumIndices ( )
inline

Utility method, not part of users public API.

unsigned int ITTable::GetNumRows ( ) const
inline

Retrieves the number of rows in the table.

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

References eCOLUMN_WISE, TTable::GetNumColumns(), and TTable::GetNumTuples().

Referenced by GetLastRowIndex().

int ITTable::GetObject ( UInt32  index,
Serializer ser 
)

Utility method, not part of users public API.

eOrientation ITTable::GetOrientation ( )
void ITTable::GetRow ( std::vector< std::string > &  row,
const unsigned int  rowIndex,
const std::string &  fromColName = std::string(),
const std::string &  toColName = std::string() 
)

Retrieves row values.

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 location of the first cell to be retrieved. If not specified the first column cell is used.
[in]toColName- optional parameter which specifies the 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 or equal to 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 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.
void ITTable::GetRow ( std::vector< std::string > &  row,
const unsigned int  rowIndex,
const unsigned int  fromColIndex,
unsigned int  toColIndex 
)
const std::vector<std::string>& ITTable::GetRow ( const unsigned int  rowIndex)
void ITTable::InsertColumn ( const std::string &  colName,
const std::string &  atColName,
const std::vector< std::string > &  col = std::vector< std::string >() 
)

Inserts a new column at the specified existing column and shifts, to the right by one, the specified existing column and all columns after it.

Parameters
[in]colName- the name of the column to be inserted
[in]atColName- the name of the column at which the new column is to be inserted
[in]col- optional parameter that contains the values which are to be used to fill in the newly inserted column. If col is specified, filling starts at row index 0 and continues until size of col. If col is not specified, the newly inserted column is filled with empty values, where filling starts at row index 0 and ends at row index "number of rows - 1".
Returns
None
Precondition
colName must be non-empty
Column with name colName must not be present
atColName must be non-empty
Column with name atColName must be present
If col is specified, 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 atColName, must be non-empty. This is to prevent creation of non-rectangular tables.
Postcondition
If table is empty (0 rows) and col is specified, the number of rows is set to the size of col. Otherwise, the number of rows is unchanged.
Exceptions
EmptyValueException- if colName is empty
AlreadyExistsException- if column with name colName already exists
EmptyValueException- if atColName is empty
NotFoundException- if column with name atColName 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 atColName, is empty.
void ITTable::InsertColumn ( const unsigned int  colIndex,
const std::vector< std::string > &  col = std::vector< std::string >() 
)
void ITTable::InsertColumn ( const unsigned int  colIndex,
std::vector< std::string >::const_iterator  colBeg,
std::vector< std::string >::const_iterator  colEnd 
)
void ITTable::InsertEntry ( const unsigned int  rowIndex)
void ITTable::InsertIndexEntry ( const unsigned int  indexIndex,
const unsigned int  rowIndex 
)
unsigned int ITTable::InsertRow ( const unsigned int  atRowIndex,
const std::vector< std::string > &  row = std::vector< std::string >() 
)

Inserts a row at the specified row index and shifts, down by one, the old row and all other rows below it. For an empty table (0 rows), 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. If row is specified, filling starts at the first column and continues until size of row is reached. If row is not specified and table is empty, the newly inserted row is filled with empty values, where filling starts at the first column and continues until the number of columns is reached. If row is not specified and table is not empty, the newly inserted row is filled with empty values, where filling starts at the first column and continues until the number of non-empty columns is reached.
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 greater than or equal to 0 and 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 below the inserted row, are invalidated by being increased by one.
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.
const std::string& ITTable::operator() ( const unsigned int  rowIndex,
const std::string &  colName 
) const

Retrieves a reference to the cell in the table.

Parameters
[in]rowIndex- row index of the cell
[in]colName- the name of the column of the cell
Returns
Constant reference to the cell in the table.
Precondition
rowIndex must be greater than or equal to 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 greater than or equal to the number of table rows.
EmptyValueException- if colName is empty
NotFoundException- if column with name colName does not exist
const std::string& ITTable::operator() ( const unsigned int  rowIndex,
const unsigned int  colIndex 
) const
ITTable& ITTable::operator= ( const ITTable inTable)

Copies a table to another table (assignment operator).

Parameters
[in]inTable- reference to the source table
Returns
Reference to the destination table
Precondition
None
Postcondition
Constructed table is a clone (has the same name, internal cells orientation, case sensitivity, column names, content) as the table referenced by inTable.
Exceptions
None
int ITTable::Read ( unsigned int  indexInFile,
Serializer ser 
)

Utility method, not part of users public API.

void ITTable::RebuildIndex ( const unsigned int  indexIndex)
void ITTable::RebuildIndices ( )

Utility method, not part of users public API.

void ITTable::Search ( std::vector< unsigned int > &  res,
const std::vector< std::string > &  targets,
const std::vector< unsigned int > &  colIndices,
const unsigned int  indexIndex,
const eSearchType  searchType = eEQUAL 
)
void ITTable::Search ( std::vector< unsigned int > &  res,
const std::string &  target,
const unsigned int  colIndex,
const eSearchType  searchType = eEQUAL 
)
void ITTable::SetFlags ( const std::string &  colName,
const unsigned char  flags 
)

Sets column flags that are only used in column search. These flags control how cell values in a column are interpreted at the time of search. They can be interpreted as strings or integers, as case-sensitive or case-insensitive strings, as space-ignoring or space-non-ignoring strings. Multiple flags can be specified using "|" operator when invoking this method.

Parameters
[in]colName- the name of the column
[in]flags- column search flags. It can have any or multiple "or"-ed values of: DT_STRING, DT_INTEGER, CASE_SENSE, CASE_INSENSE, W_SPACE_SENSE, W_SPACE_INSENSE.
Returns
None
Precondition
colName must be non-empty
Column with name colName must be present
Postcondition
None
Exceptions
EmptyValueException- if colName is empty
NotFoundException- if column with name colName does not exist
int ITTable::SetFlags ( const unsigned char  newOpts,
const unsigned int  colIndex 
)
void ITTable::SetSerializer ( Serializer ser)

Utility method, not part of users public API.

void ITTable::UpdateCell ( const unsigned int  rowIndex,
const std::string &  colName,
const std::string &  value 
)

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 of the cell that is to be updated
[in]value- the new value
Returns
None
Precondition
rowIndex must be greater than or equal to 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 greater than or equal to the number of table rows.
EmptyValueException- if colName is empty
NotFoundException- if column with name colName does not exist
int ITTable::UpdateCell ( const std::string &  cell,
const unsigned int  colIndex,
const unsigned int  rowIndex 
)
void ITTable::UpdateIndex ( const unsigned int  indexIndex,
const unsigned int  rowIndex 
)
void ITTable::ValidateOptions ( unsigned int  colIndex)
void ITTable::VerifyColumnsIndices ( const std::vector< unsigned int > &  colIndices)
int ITTable::Write ( Serializer ser,
int &  size 
)

Utility method, not part of users public API.

int ITTable::WriteObject ( Serializer ser,
int &  size 
)

Utility method, not part of users public API.

Member Data Documentation

const unsigned char ITTable::CASE_INSENSE = 0x01
static
const unsigned char ITTable::CASE_SENSE = 0x00
static
const unsigned char ITTable::DT_INTEGER = DT_INTEGER_VAL << 4
static
const unsigned char ITTable::DT_INTEGER_VAL = 2
static
const unsigned char ITTable::DT_STRING = DT_STRING_VAL << 4
static
const unsigned char ITTable::DT_STRING_VAL = 1
static
const unsigned char ITTable::W_SPACE_INSENSE = 0x02
static
const unsigned char ITTable::W_SPACE_SENSE = 0x00
static

The documentation for this class was generated from the following file: