Block Class Reference

Public class that represents a data block, that contains tables. More...

#include <TableFile.h>

List of all members.

Public Member Functions

 Block (const string &name, Serializer *serP, const eFileMode fileMode=READ_MODE, const StringCompare::eCompareType caseSense=StringCompare::eCASE_SENSITIVE)
 ~Block ()
vector< pair< string, ISTable::eTableDiff > > operator== (Block &inBlock)
void SetName (const string &name)
string GetName () const
void AddTable (const string &name, const int indexInFile=0, ISTable *isTableP=NULL)
void RenameTable (const string &oldName, const string &newName)
void GetTableNames (vector< string > &tableNames)
bool IsTablePresent (const string &tableName)
ISTableGetTablePtr (const string &tableName)
void DeleteTable (const string &tableName)
void WriteTable (ISTable *isTableP)
void Print ()

Public Attributes

mapped_ptr_vector< ISTable,
StringCompare > 
_tables

Private Member Functions

 Block (const Block &t)
Blockoperator= (const Block &inBlock)
ISTable_GetTablePtr (const unsigned int tableIndex)

Private Attributes

string _name
eFileMode _fileMode
Serializer * _ser


Detailed Description

Public class that represents a data block, that contains tables.

This class represents a data block, that can come from DDL, dictionary or CIF files. Data block is a container of tables. This class provides methods for construction and destruction, tables manipulation (addition, retrieval, deleting, writing), data blocks comparison.


Constructor & Destructor Documentation

Block::Block ( const string &  name,
Serializer *  serP,
const eFileMode  fileMode = READ_MODE,
const StringCompare::eCompareType  caseSense = StringCompare::eCASE_SENSITIVE 
)

Utility method, not part of users public API, and will soon be removed.

Constructs a data block.

Parameters:
[in] name - the name of the data block
[in] serP - pointer to the File Navigator object
[in] fileMode - optional parameter that indicates data block mode. Possible values are read-only, create, update and virtual.
[in] caseSense - optional parameter that indicates case sensitivity of table names. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed.
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None

Block::~Block (  ) 

Utility method, not part of users public API, and will soon be removed.

Destructs a data block.

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

Block::Block ( const Block t  )  [private]


Member Function Documentation

vector< pair< string, ISTable::eTableDiff > > Block::operator== ( Block inBlock  ) 

Compares a data block to another data block.

Parameters:
[in] inBlock - reference to input data block
Returns:
vector of pairs, where the first value in a pair is a table name and the second value in a pair is one of the following indicators of table differences:

eMISSING - table exists only in the input block and not in this block
eEXTRA - table exists only in this block and not in the input block
eCASE_SENSE - table exists in both blocks, but with different column name case sensitivity
eMORE_COLS - table exists in both blocks, but the table in this block has more columns than the table in the input block
eLESS_COLS - table exists in both blocks, but the table in this block has less columns than the table in the input block
eCOL_NAMES - table exists in both blocks, but tables have different column names
eMORE_ROWS - table exists in both blocks, but the table in this block has more rows than the table in the input block
eLESS_ROWS - table exists in both blocks, but the table in this block has less rows than the table in the input block
eCELLS - table exists in both blocks, but tables have different content
Precondition:
None
Postcondition:
None
Exceptions:
 None

void Block::SetName ( const string &  name  )  [inline]

Utility method, not part of users public API, and will soon be removed.

Sets the name of a data block.

Parameters:
[in] name - the name of the data block
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

string Block::GetName (  )  const [inline]

Retrieves data block name.

Parameters:
 None
Returns:
String that contains data block name.
Precondition:
None
Postcondition:
None
Exceptions:
 None

void Block::AddTable ( const string &  name,
const int  indexInFile = 0,
ISTable isTableP = NULL 
)

Utility method, not part of users public API, and will soon be removed.

void Block::RenameTable ( const string &  oldName,
const string &  newName 
)

Changes the name of a table in the data block.

Parameters:
[in] oldName - the name of the table which is to be renamed
[in] newName - the new table name
Returns:
None
Precondition:
oldName must be non-empty

Table with name oldName must be present

newName must be non-empty

Table with name newName must not be present

Block must be in create or update mode

Postcondition:
None
Exceptions:
EmptyValueException - if oldName is empty
NotFoundException - if table with name oldName does not exist
EmptyValueException - if newName is empty
AlreadyExistsException - if table with name newName already exists
FileModeException - if block is not in create or update mode

void Block::GetTableNames ( vector< string > &  tableNames  ) 

Retrieves names of all tables in a data block.

Parameters:
[out] tableNames - retrieved table names
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

bool Block::IsTablePresent ( const string &  tableName  ) 

Checks for table presence in the data block.

Parameters:
[in] tableName - table name
Returns:
true - if table exists

false - if table does not exist

Precondition:
None
Postcondition:
None
Exceptions:
 None

ISTable * Block::GetTablePtr ( const string &  tableName  ) 

Retrieves a pointer to the table.

Parameters:
[in] tableName - table name
Returns:
Pointer to the table, if table was found

NULL, if table was not found

Precondition:
None
Postcondition:
None
Exceptions:
 None

void Block::DeleteTable ( const string &  tableName  ) 

Deletes a table from a data block.

Parameters:
[in] tableName - table name
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void Block::WriteTable ( ISTable isTableP  ) 

Writes a table to the data block. In this context, writing means adding it (if it does not already exist) or updating it (if it already exists).

Parameters:
[in] isTableP - pointer to the table
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void Block::Print (  ) 

Utility method, not part of users public API, and will soon be removed.

Block& Block::operator= ( const Block inBlock  )  [private]

ISTable * Block::_GetTablePtr ( const unsigned int  tableIndex  )  [private]


Member Data Documentation

mapped_ptr_vector<ISTable, StringCompare> Block::_tables

string Block::_name [private]

eFileMode Block::_fileMode [private]

Serializer* Block::_ser [private]


The documentation for this class was generated from the following files:
Generated on Tue Feb 5 09:01:27 2008 for tables-v8.0 by  doxygen 1.5.1