#include <ISTable.h>
Collaboration diagram for ISTable:
Public Types | |
enum | eOrientation { eCOLUMN_WISE = 0, eROW_WISE } |
enum | eTableDiff { eNONE = 0, eCASE_SENSE, eMORE_COLS, eLESS_COLS, eCOL_NAMES, eMORE_ROWS, eLESS_ROWS, 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 (eOrientation orient, const StringCompare::eCompareType colCaseSense=StringCompare::eCASE_SENSITIVE) | |
ISTable (const string &name, const StringCompare::eCompareType colCaseSense=StringCompare::eCASE_SENSITIVE) | |
ISTable (const string &name, eOrientation orient, const StringCompare::eCompareType colCaseSense=StringCompare::eCASE_SENSITIVE) | |
ISTable (const ISTable &inTable) | |
~ISTable () | |
ISTable & | operator= (const ISTable &inTable) |
eTableDiff | operator== (ISTable &inTable) |
const string | GetName () const |
void | Rename (const string &name) |
unsigned int | GetNumColumns () const |
void | GetColumnNames (vector< string > &colNames) const |
bool | IsColumnPresent (const string &colName) |
void | AddColumn (const string &colName, const vector< string > &col=vector< string >(0)) |
void | InsertColumn (const string &colName, const string &afColName, const vector< string > &col=vector< string >(0)) |
void | FillColumn (const string &colName, const vector< string > &col) |
void | AppendToColumn (const string &colName, const string &cell) |
void | AppendToColumn (const string &colName, const vector< string > &col) |
void | GetColumn (vector< string > &col, const string &colName) |
void | GetColumn (vector< string > &col, const string &colName, const unsigned int fromRowIndex, unsigned int toRowIndex) |
void | GetColumn (vector< string > &col, const string &colName, const vector< unsigned int > &rowIndex) |
void | RenameColumn (const string &oldColName, const string &newColName) |
void | ClearColumn (const string &colName) |
void | DeleteColumn (const string &colName) |
unsigned int | GetNumRows () const |
unsigned int | AddRow (const vector< string > &row=vector< string >(0)) |
unsigned int | InsertRow (const unsigned int atRowIndex, const vector< string > &row=vector< string >(0)) |
void | FillRow (const unsigned int rowIndex, const vector< string > &row) |
void | GetRow (vector< string > &row, const unsigned int rowIndex, const string &fromColName=String::Empty, const string &toColName=String::Empty) |
void | ClearRow (const unsigned int rowIndex) |
void | DeleteRow (const unsigned int rowIndex) |
void | DeleteRows (const vector< unsigned int > &rows) |
unsigned int | GetLastRowIndex () |
void | UpdateCell (const unsigned int rowIndex, const string &colName, const string &value) |
const string & | operator() (const unsigned int rowIndex, const string &colName) const |
void | SetFlags (const string &colName, const unsigned char flags) |
unsigned char | GetDataType (const string &colName) |
unsigned int | FindFirst (const vector< string > &targets, const vector< string > &colNames, const string &indexName=String::Empty) |
void | Search (vector< unsigned int > &res, const string &target, const string &colName, const eSearchType searchType=eEQUAL) |
void | Search (vector< unsigned int > &res, const vector< string > &targets, const vector< string > &colNames, const eSearchType searchType=eEQUAL, const string &indexName=String::Empty) |
void | FindDuplicateRows (vector< pair< unsigned int, unsigned int > > &duplRows, const vector< string > &colNames, const bool keepDuplRows, const eSearchDir searchDir=eFORWARD) |
void | SetModified (const bool modified) |
bool | GetModified () |
void | SetFileNavigator (FileNavigator *fileNavigator) |
int | WriteObject (FileNavigator *fileNav, int &size) |
int | GetObject (Word index, FileNavigator *fileNav) |
void | Read (unsigned int indexInFile) |
int | Write () |
void | Merge (ISTable &inTable, unsigned int typeOfMerge=0) |
bool | PrintDiff (ISTable &inTable) |
void | Print (const string &indexName) |
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) |
unsigned int | GetColumnIndex (const string &colName) const |
void | GetColumnsIndices (vector< unsigned int > &colIndices, const vector< string > &colNames=vector< string >(0)) |
void | _GetColumnsIndices (vector< unsigned int > &colIndices, const vector< string > &colNames) |
void | GetColumn (vector< string > &col, const string &colName, 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 | 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 |
Private Member Functions | |
void | InsertColumn (const string &colName, const unsigned int colIndex, const vector< string > &col=vector< string >(0)) |
void | CreateColumn (const string &colName, const unsigned int colIndex, const vector< string > &col=vector< string >(0)) |
void | FillColumn (const vector< string > &col, const unsigned int colIndex) |
void | AppendToColumn (const unsigned int colIndex, const vector< string > &col) |
int | UpdateCell (const string &cell, const unsigned int colIndex, const unsigned int rowIndex) |
const string & | operator() (const unsigned int rowIndex, const unsigned int colIndex) const |
int | SetFlags (const unsigned char newOpts, const unsigned int colIndex) |
void | FindDuplicateRows (const vector< unsigned int > &colIndices, vector< pair< unsigned int, unsigned int > > &duplRows, const unsigned int keep, const eSearchDir searchDir=eFORWARD) |
void | VerifyColumnsIndices (const vector< unsigned int > &colIndices) |
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, const eSearchType searchType=eEQUAL) |
void | Search (vector< unsigned int > &res, const vector< string > &targets, const vector< unsigned int > &colIndices, const eSearchType searchType=eEQUAL, const string &indexName=String::Empty) |
void | Init () |
void | Clear () |
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 | WriteObjectV7 (FileNavigator *, int &size) |
int | GetObjectV7 (Word index, FileNavigator *) |
int | GetObjectV6 (Word index, FileNavigator *) |
int | GetObjectV3 (Word index, FileNavigator *) |
int | GetObjectV2 (Word index, FileNavigator *) |
int | GetObjectV1 (Word index, FileNavigator *) |
int | GetObjectV1_1 (Word index, FileNavigator *) |
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) |
Private Attributes | |
string | _name |
TTable | _ttable |
eOrientation | _orient |
StringCompare::eCompareType | _colCaseSense |
vector< string > | _colNames |
vector< unsigned int > | _precision |
vector< unsigned char > | _compare_opts |
vector< string > | _indexNames |
vector< vector< unsigned int > > | _listsOfColumns |
vector< unsigned int > | _unique |
FileNavigator * | _fnav |
bool | _modified |
vector< tIndex > | _indices |
Static Private 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_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 |
static const string | _version |
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).
enum ISTable::eTableDiff |
enum ISTable::eSearchType |
enum ISTable::eSearchDir |
ISTable::ISTable | ( | const StringCompare::eCompareType | colCaseSense = StringCompare::eCASE_SENSITIVE |
) |
Constructs a table.
[in] | colCaseSense | - optional parameter that indicates case sensitivity of column names. Possible values are case sensitive and case in-sensitive. If not specified, a table with case sensitive column names is constructed. |
Constructed table is nameless (its name is an empty string).
None |
ISTable::ISTable | ( | eOrientation | orient, | |
const StringCompare::eCompareType | colCaseSense = StringCompare::eCASE_SENSITIVE | |||
) |
Constructs a table.
[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) |
[in] | colCaseSense | - optional parameter that indicates case sensitivity of column names. Possible values are case sensitive and case in-sensitive. If not specified, a table with case sensitive column names is constructed. |
Constructed table is nameless (its name is an empty string).
None |
ISTable::ISTable | ( | const string & | name, | |
const StringCompare::eCompareType | colCaseSense = StringCompare::eCASE_SENSITIVE | |||
) |
Constructs a table.
[in] | name | - the name of the table to be constructed |
[in] | colCaseSense | - optional parameter that indicates case sensitivity of column names. Possible values are case sensitive and case in-sensitive. If not specified, a table with case sensitive column names is constructed. |
None |
ISTable::ISTable | ( | const string & | name, | |
eOrientation | orient, | |||
const StringCompare::eCompareType | colCaseSense = StringCompare::eCASE_SENSITIVE | |||
) |
Constructs a table.
[in] | name | - the name of the table to be constructed |
[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) |
[in] | colCaseSense | - optional parameter that indicates case sensitivity of column names. Possible values are case sensitive and case in-sensitive. If not specified, a table with case sensitive column names is constructed. |
None |
ISTable::ISTable | ( | const ISTable & | inTable | ) |
Constructs a table by copying from another table (copy constructor).
[in] | inTable | - reference to a table that will be copied to the newly constructed table |
None |
ISTable::~ISTable | ( | ) |
Destructs a table, by releasing all the used resources.
Not applicable |
None |
Copies a table to another table (assignment operator).
[in] | inTable | - reference to the source table |
None |
ISTable::eTableDiff ISTable::operator== | ( | ISTable & | inTable | ) |
Compares a table to another table, ignoring the table name.
[in] | inTable | - reference to input table |
eCASE_SENSE - if tables have different column name case sensitivity
eMORE_COLS - if this table has more columns than input table
eLESS_COLS - if this table has less columns than input table
eCOL_NAMES - if tables have different column names
eMORE_ROWS - if this table has more rows than input table
eLESS_ROWS - if this table has less rows than input table
eCELLS - if tables have different content
None |
const string ISTable::GetName | ( | ) | const [inline] |
Retrieves table name.
None |
None |
void ISTable::Rename | ( | const string & | name | ) |
Changes the table name.
[in] | name | - the new name of the table |
None |
unsigned int ISTable::GetNumColumns | ( | ) | const [inline] |
Retrieves the number of columns in the table.
None |
None |
void ISTable::GetColumnNames | ( | vector< string > & | colNames | ) | const |
Retrieves column names.
[out] | colNames | - retrieved column names |
None |
bool ISTable::IsColumnPresent | ( | const string & | colName | ) |
Checks for column existence.
[in] | colName | - the name of the column |
false - if column does not exist
EmptyValueException | - if colName is empty |
void ISTable::AddColumn | ( | const string & | colName, | |
const vector< string > & | col = vector< string >(0) | |||
) |
Adds a column to the end of the table.
[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". |
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.
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 |
void ISTable::InsertColumn | ( | const string & | colName, | |
const string & | afColName, | |||
const vector< string > & | col = vector< string >(0) | |||
) |
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.
[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". |
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.
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 ISTable::FillColumn | ( | const string & | colName, | |
const vector< string > & | col | |||
) |
Fills a column with values.
[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. |
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.
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 ISTable::AppendToColumn | ( | const string & | colName, | |
const string & | cell | |||
) |
Appends one cell to the specified column.
[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 |
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.
Cells in other columns of the, newly appended row, are set to empty values.
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 ISTable::AppendToColumn | ( | const string & | colName, | |
const vector< string > & | col | |||
) |
Appends cells to the specified column.
[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. |
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.
Cells in other columns of the, newly appended rows, are set to empty values.
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 ISTable::GetColumn | ( | vector< string > & | col, | |
const string & | colName | |||
) |
Retrieves column values.
[out] | col | - retrieved column values |
[in] | colName | - the name of the column which content is to be retrieved. |
Column with name colName must be present
EmptyValueException | - if colName is empty | |
NotFoundException | - if column with name colName does not exist |
void ISTable::GetColumn | ( | vector< string > & | col, | |
const string & | colName, | |||
const unsigned int | fromRowIndex, | |||
unsigned int | toRowIndex | |||
) |
Retrieves column values in the specified row range.
[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. |
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
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 ISTable::GetColumn | ( | vector< string > & | col, | |
const string & | colName, | |||
const vector< unsigned int > & | rowIndex | |||
) |
Retrieves column values in the specified rows.
[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 |
Column with name colName must be present
Row indices in rowIndices must be less than or equal to the column length
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 ISTable::RenameColumn | ( | const string & | oldColName, | |
const string & | newColName | |||
) |
Changes the column name.
[in] | oldColName | - the name of the column which is to be renamed |
[in] | newColName | - the new column name |
Column with name oldColName must be present
newColName must be non-empty
Column with name newColName must not be present
EmptyValueException | - if oldColName is empty | |
NotFoundException | - if column with name oldColName does not exist | |
EmptyValueException | - if newColName is empty | |
AlreadyExistsException | - if column with name newColName already exists |
void ISTable::ClearColumn | ( | const string & | colName | ) |
Sets all cells in the column to empty string.
[in] | colName | - the name of the column |
Column with name colName must be present
EmptyValueException | - if colName is empty | |
NotFoundException | - if column with name colName does not exist |
void ISTable::DeleteColumn | ( | const string & | colName | ) |
Deletes a column from the table.
[in] | colName | - the name of the column |
Column with name colName must be present
EmptyValueException | - if colName is empty | |
NotFoundException | - if column with name colName does not exist |
unsigned int ISTable::GetNumRows | ( | ) | const [inline] |
Retrieves the number of rows in the table.
None |
None |
unsigned int ISTable::AddRow | ( | const vector< string > & | row = vector< string >(0) |
) |
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.
[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. |
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.
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. |
unsigned int ISTable::InsertRow | ( | const unsigned int | atRowIndex, | |
const vector< string > & | row = vector< string >(0) | |||
) |
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.
[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. |
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.
Row indices, of the rows below the inserted row, are invalidated by being increased by one.
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. |
void ISTable::FillRow | ( | const unsigned int | rowIndex, | |
const vector< string > & | row | |||
) |
Fills, with values, a row at the specified row index, starting at the the first column.
[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. |
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.
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 ISTable::GetRow | ( | vector< string > & | row, | |
const unsigned int | rowIndex, | |||
const string & | fromColName = String::Empty , |
|||
const string & | toColName = String::Empty | |||
) |
Retrieves row values.
[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. |
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.
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 ISTable::ClearRow | ( | const unsigned int | rowIndex | ) |
Sets all cells in the row to empty string.
[in] | rowIndex | - index of the row that is to be cleared. |
out_of_range | - if rowIndex is greater than or equal to the number of table rows. |
void ISTable::DeleteRow | ( | const unsigned int | rowIndex | ) |
Deletes a row with the specified index and shifts, up by one, all other rows below it.
[in] | rowIndex | - index of the row that is to be deleted. |
Row indices of the rows which are below the deleted row are invalidated by being reduced by one.
out_of_range | - if rowIndex is greater than or equal to the number of table rows. |
void ISTable::DeleteRows | ( | const vector< unsigned int > & | rows | ) |
Deletes rows with specified indices.
[in] | rows | - indices of rows that are to be deleted. |
Row indices of the remaining rows are invalidated by being appropriatelly adjusted.
out_of_range | - if any row index in rows is greater than or equal to the number of table rows. |
unsigned int ISTable::GetLastRowIndex | ( | ) | [inline] |
Retrieves the row index of the last row in the table.
None |
None |
void ISTable::UpdateCell | ( | const unsigned int | rowIndex, | |
const string & | colName, | |||
const string & | value | |||
) |
Updates a cell in the table.
[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 |
colName must be non-empty
Column with name colName must be present
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 string & ISTable::operator() | ( | const unsigned int | rowIndex, | |
const string & | colName | |||
) | const |
Retrieves a reference to the cell in the table.
[in] | rowIndex | - row index of the cell |
[in] | colName | - the name of the column of the cell |
colName must be non-empty
Column with name colName must be present
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 |
void ISTable::SetFlags | ( | const 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.
[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. |
Column with name colName must be present
EmptyValueException | - if colName is empty | |
NotFoundException | - if column with name colName does not exist |
unsigned char ISTable::GetDataType | ( | const string & | colName | ) |
Retrieves data type flag of a column.
[in] | colName | - the name of the column |
DT_INTEGER_VAL - if data type of a column is integer.
Column with name colName must be present
EmptyValueException | - if colName is empty | |
NotFoundException | - if column with name colName does not exist |
unsigned int ISTable::FindFirst | ( | const vector< string > & | targets, | |
const vector< string > & | colNames, | |||
const string & | indexName = String::Empty | |||
) |
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.
[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 |
the number of rows, if the match was not found
Each column name in colNames must be present
colNames and targets must have the same size
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 |
void ISTable::Search | ( | vector< unsigned int > & | res, | |
const string & | target, | |||
const string & | colName, | |||
const eSearchType | searchType = eEQUAL | |||
) |
Searches one column for all occurrences of target value and returns row indices, where the match was found.
[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. |
Column with name colName must be present
EmptyValueException | - if colName is empty | |
NotFoundException | - if column with name colName does not exist |
void ISTable::Search | ( | vector< unsigned int > & | res, | |
const vector< string > & | targets, | |||
const vector< string > & | colNames, | |||
const eSearchType | searchType = eEQUAL , |
|||
const string & | indexName = String::Empty | |||
) |
Searches the columns for all occurrences of target values and returns row indices, where the match was found.
[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. |
Each column name in colNames must be present
colNames and targets must have the same size
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 |
void ISTable::FindDuplicateRows | ( | vector< pair< unsigned int, unsigned int > > & | duplRows, | |
const vector< string > & | colNames, | |||
const bool | keepDuplRows, | |||
const eSearchDir | searchDir = eFORWARD | |||
) |
Finds duplicate rows and, optionally, deletes them.
[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. |
Each column name in colNames must be present
EmptyValueException | - if one or more column names in colNames is empty | |
NotFoundException | - if one or more column names in colNames does not exist |
void ISTable::SetModified | ( | const bool | modified | ) | [inline] |
Utility method, not part of users public API.
bool ISTable::GetModified | ( | ) | [inline] |
Utility method, not part of users public API.
void ISTable::SetFileNavigator | ( | FileNavigator * | fileNavigator | ) |
Utility method, not part of users public API.
int ISTable::WriteObject | ( | FileNavigator * | fileNav, | |
int & | size | |||
) |
Utility method, not part of users public API.
int ISTable::GetObject | ( | Word | index, | |
FileNavigator * | fileNav | |||
) |
Utility method, not part of users public API.
void ISTable::Read | ( | unsigned int | indexInFile | ) |
Utility method, not part of users public API.
int ISTable::Write | ( | ) |
Utility method, not part of users public API.
void ISTable::Merge | ( | ISTable & | inTable, | |
unsigned int | typeOfMerge = 0 | |||
) |
Utility method, not part of users public API.
bool ISTable::PrintDiff | ( | ISTable & | inTable | ) |
Utility method, not part of users public API.
void ISTable::Print | ( | const string & | indexName | ) |
Utility method, not part of users public API.
bool ISTable::IndexExists | ( | const string & | indexName | ) | [inline] |
Utility method, not part of users public API.
void ISTable::CreateIndex | ( | const string & | indexName, | |
const vector< string > & | colNames, | |||
const unsigned int | unique = 0 | |||
) |
Utility method, not part of users public API.
void ISTable::UpdateIndex | ( | const string & | indexName, | |
const unsigned int | rowIndex | |||
) |
Utility method, not part of users public API.
void ISTable::RebuildIndex | ( | const string & | indexName | ) |
Utility method, not part of users public API.
void ISTable::RebuildIndices | ( | ) |
Utility method, not part of users public API.
void ISTable::DeleteIndex | ( | const string & | indexName | ) |
Utility method, not part of users public API.
unsigned int ISTable::GetNumIndices | ( | ) | [inline] |
Utility method, not part of users public API.
void ISTable::CreateKey | ( | const vector< string > & | colNames | ) |
Utility method, not part of users public API.
void ISTable::SetUnion | ( | const vector< unsigned int > & | a, | |
const vector< unsigned int > & | b, | |||
vector< unsigned int > & | ret | |||
) | [static] |
Utility method, not part of users public API.
void ISTable::SetIntersect | ( | const vector< unsigned int > & | a, | |
const vector< unsigned int > & | b, | |||
vector< unsigned int > & | ret | |||
) | [static] |
Utility method, not part of users public API.
unsigned int ISTable::GetColumnIndex | ( | const string & | colName | ) | const |
Utility method, not part of users public API.
void ISTable::GetColumnsIndices | ( | vector< unsigned int > & | colIndices, | |
const vector< string > & | colNames = vector< string >(0) | |||
) |
Utility method, not part of users public API.
void ISTable::_GetColumnsIndices | ( | vector< unsigned int > & | colIndices, | |
const vector< string > & | colNames | |||
) |
Utility method, not part of users public API.
void ISTable::GetColumn | ( | vector< string > & | col, | |
const string & | colName, | |||
const string & | indexName | |||
) |
Utility method, not part of users public API.
void ISTable::InsertColumn | ( | const string & | colName, | |
const unsigned int | colIndex, | |||
const vector< string > & | col = vector< string >(0) | |||
) | [private] |
void ISTable::CreateColumn | ( | const string & | colName, | |
const unsigned int | colIndex, | |||
const vector< string > & | col = vector< string >(0) | |||
) | [private] |
void ISTable::FillColumn | ( | const vector< string > & | col, | |
const unsigned int | colIndex | |||
) | [private] |
void ISTable::AppendToColumn | ( | const unsigned int | colIndex, | |
const vector< string > & | col | |||
) | [private] |
int ISTable::UpdateCell | ( | const string & | cell, | |
const unsigned int | colIndex, | |||
const unsigned int | rowIndex | |||
) | [private] |
const string & ISTable::operator() | ( | const unsigned int | rowIndex, | |
const unsigned int | colIndex | |||
) | const [private] |
int ISTable::SetFlags | ( | const unsigned char | newOpts, | |
const unsigned int | colIndex | |||
) | [private] |
void ISTable::FindDuplicateRows | ( | const vector< unsigned int > & | colIndices, | |
vector< pair< unsigned int, unsigned int > > & | duplRows, | |||
const unsigned int | keep, | |||
const eSearchDir | searchDir = eFORWARD | |||
) | [private] |
void ISTable::VerifyColumnsIndices | ( | const vector< unsigned int > & | colIndices | ) | [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, | |||
const eSearchType | searchType = eEQUAL | |||
) | [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 | ( | ) | [private] |
void ISTable::Clear | ( | ) | [private] |
StringCompare::eCompareType ISTable::GetCompareType | ( | const vector< unsigned int > & | colIndices | ) | [private] |
string ISTable::CellValue | ( | const unsigned int | colIndex, | |
const unsigned int | rowIndex | |||
) | [private] |
string ISTable::ConvertString | ( | const string & | value, | |
const unsigned int | colIndex | |||
) | [private] |
string ISTable::MultiStringsValue | ( | const vector< string > & | values, | |
const vector< unsigned int > & | colIndices | |||
) | [private] |
string ISTable::SubRowValue | ( | const vector< unsigned int > & | colIndices, | |
const unsigned int | rowIndex | |||
) | [private] |
string ISTable::AggregateRow | ( | const vector< unsigned int > & | colIndices, | |
const unsigned int | rowIndex | |||
) | [private] |
void ISTable::AppendToAndDelimit | ( | string & | to, | |
const string & | appending | |||
) | [inline, private] |
void ISTable::ValidateOptions | ( | unsigned int | colIndex | ) | [private] |
string ISTable::CreateInternalIndexName | ( | const unsigned int | indexIndex | ) | [private] |
void ISTable::UpdateIndex | ( | const unsigned int | indexIndex, | |
const unsigned int | rowIndex | |||
) | [private] |
void ISTable::RebuildIndex | ( | const unsigned int | indexIndex | ) | [private] |
void ISTable::ClearIndex | ( | const unsigned int | indexIndex | ) | [private] |
void ISTable::DeleteIndex | ( | const unsigned int | indexIndex | ) | [private] |
int ISTable::FindIndex | ( | const string & | indexName | ) | [private] |
int ISTable::FindIndex | ( | const vector< unsigned int > & | colIndices | ) | [private] |
void ISTable::UpdateIndices | ( | const unsigned int | rowIndex | ) | [private] |
void ISTable::ClearIndices | ( | ) | [private] |
bool ISTable::IsColumnInIndex | ( | const unsigned int | indexIndex, | |
const unsigned int | colIndex | |||
) | [private] |
int ISTable::FindKeyIndex | ( | ) | [private] |
void ISTable::UpdateColListOnColInsert | ( | const unsigned int | colIndex | ) | [private] |
void ISTable::UpdateColListOnColDelete | ( | const unsigned int | colIndex | ) | [private] |
void ISTable::UpdateColListOnCellUpdate | ( | const unsigned int | rowIndex, | |
const unsigned int | colIndex | |||
) | [private] |
unsigned int ISTable::FindFirst | ( | const vector< string > & | targets, | |
const vector< unsigned int > & | colIndices, | |||
const unsigned int | indexIndex | |||
) | [private] |
void ISTable::Search | ( | vector< unsigned int > & | res, | |
const vector< string > & | targets, | |||
const vector< unsigned int > & | colIndices, | |||
const unsigned int | indexIndex, | |||
const eSearchType | searchType = eEQUAL | |||
) | [private] |
void ISTable::Search | ( | vector< unsigned int > & | res, | |
const vector< string > & | targets, | |||
const vector< string > & | colNames, | |||
const unsigned int | indexIndex, | |||
const eSearchType | searchType = eEQUAL | |||
) | [private] |
int ISTable::WriteObjectV7 | ( | FileNavigator * | , | |
int & | size | |||
) | [private] |
int ISTable::GetObjectV7 | ( | Word | index, | |
FileNavigator * | ||||
) | [private] |
int ISTable::GetObjectV6 | ( | Word | index, | |
FileNavigator * | ||||
) | [private] |
int ISTable::GetObjectV3 | ( | Word | index, | |
FileNavigator * | ||||
) | [private] |
int ISTable::GetObjectV2 | ( | Word | index, | |
FileNavigator * | ||||
) | [private] |
int ISTable::GetObjectV1 | ( | Word | index, | |
FileNavigator * | ||||
) | [private] |
int ISTable::GetObjectV1_1 | ( | Word | index, | |
FileNavigator * | ||||
) | [private] |
void ISTable::Print | ( | unsigned int | indexIndex | ) | [private] |
void ISTable::ConvertToInt | ( | const string & | a, | |
string & | ret | |||
) | [private] |
void ISTable::ConvertDouble | ( | const string & | a, | |
string & | ret | |||
) | [private] |
void ISTable::ConvertToLowerNoWhiteSpace | ( | const string & | a, | |
string & | ret | |||
) | [private] |
const unsigned char ISTable::DT_STRING_VAL = 1 [static] |
const unsigned char ISTable::DT_INTEGER_VAL = 2 [static] |
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 int ISTable::EXPONENT = 4 [static, private] |
const unsigned int ISTable::MAX_PRECISION = DBL_DIG [static, private] |
const unsigned int ISTable::MANTISSA = MAX_PRECISION + 2 [static, private] |
const unsigned int ISTable::INT_LIMIT = 11 [static, private] |
const unsigned char ISTable::DT_MASK = 15 << 4 [static, private] |
const unsigned char ISTable::SC_MASK = 0x01 [static, private] |
const unsigned char ISTable::WS_MASK = 0x02 [static, private] |
const unsigned char ISTable::LAST_DT_VALUE = 3 [static, private] |
const unsigned int ISTable::DEFAULT_PRECISION = MAX_PRECISION [static, private] |
const unsigned char ISTable::DEFAULT_OPTIONS [static, private] |
const string ISTable::_version [static, private] |
string ISTable::_name [private] |
TTable ISTable::_ttable [private] |
eOrientation ISTable::_orient [private] |
StringCompare::eCompareType ISTable::_colCaseSense [private] |
vector<string> ISTable::_colNames [private] |
vector<unsigned int> ISTable::_precision [private] |
vector<unsigned char> ISTable::_compare_opts [private] |
vector<string> ISTable::_indexNames [private] |
vector<vector<unsigned int> > ISTable::_listsOfColumns [private] |
vector<unsigned int> ISTable::_unique [private] |
FileNavigator* ISTable::_fnav [private] |
bool ISTable::_modified [private] |
vector<tIndex> ISTable::_indices [private] |