|
librcsb-core-wrapper
1.005
|
Public class that represents a file composed of blocks with tables. More...
#include <TableFile.h>


Public Types | |
| enum | eStatusInd { eCLEAR_STATUS = 0x0000, eDUPLICATE_BLOCKS = 0x0001, eUNNAMED_BLOCKS = 0x0002 } |
Public Member Functions | |
| TableFile (const Char::eCompareType caseSense=Char::eCASE_SENSITIVE) | |
| TableFile (const eFileMode fileMode, const string &fileName, const Char::eCompareType caseSense=Char::eCASE_SENSITIVE) | |
| virtual | ~TableFile () |
| string | GetFileName (void) |
| eFileMode | GetFileMode (void) |
| Char::eCompareType | GetCaseSensitivity (void) |
| unsigned int | GetStatusInd (void) |
| unsigned int | GetNumBlocks () |
| void | GetBlockNames (vector< string > &blockNames) |
| string | GetFirstBlockName () |
| bool | IsBlockPresent (const string &blockName) |
| string | AddBlock (const string &blockName) |
| Block & | GetBlock (const string &blockName) |
| string | RenameBlock (const string &oldBlockName, const string &newBlockName) |
| string | RenameFirstBlock (const string &newBlockName) |
| void | Flush () |
| void | Serialize (const string &fileName) |
| void | Close () |
Protected Member Functions | |
| void | _SetStatusInd (const string &blockName) |
| void | _AddBlock (const string &blockName, Serializer *serP) |
| void | _GetNumTablesInBlocks (vector< UInt32 > &numTablesInBlocks) |
| ISTable * | _GetTablePtr (const unsigned int blockIndex, const unsigned int tableIndex) |
| void | _GetAllTables () |
| unsigned int | GetTotalNumTables () |
| void | GetTableNames (vector< string > &tableNames) |
| void | GetTablesIndices (vector< unsigned int > &tablesIndices) |
| void | GetSortedTablesIndices (vector< unsigned int > &tablesIndices) |
| void | _ReadFileIndex () |
| void | _ReadFileIndexVersion0 () |
| void | _ReadFileIndexVersion1 () |
| void | _WriteFileIndex (Serializer *serP, const vector< unsigned int > &tableLocs) |
Protected Attributes | |
| string | _fileName |
| eFileMode | _fileMode |
| Char::eCompareType | _caseSense |
| unsigned int | _statusInd |
| mapped_ptr_vector< Block, StringLess > | _blocks |
| Serializer * | _f |
Public class that represents a file composed of blocks with tables.
This class represents an ordered container of data blocks. Data blocks can come from DDL, dictionary or CIF files, where each data block is a container of tables. This class provides methods for construction and destruction, data blocks manipulation (addition, retrieval, renaming.). The class does in-memory management of data blocks, as well as serialization and de-serialization to and from a file. The class supports the following file modes: read-only, create, update and virtual. In read-only mode, blocks and tables can only be read (from an existing table file that has been previously serialized to a file) and cannot be modified. Create mode is used to create a table file from scratch and add/update blocks and tables in it and serialize it to a file. Update mode is used to update an existing table file (that has been previously serialized to a file). Virtual mode only provides in-memory management of data blocks and is used when object persistency is not needed. Hence, all modes except virtual mode provide association between in-memory data blocks and persistent data blocks stored in a file.
| TableFile::TableFile | ( | const Char::eCompareType | caseSense = Char::eCASE_SENSITIVE | ) |
Constructs a table file.
| [in] | caseSense | - optional parameter that indicates case sensitivity of table names in blocks. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed. |
| TableFile::TableFile | ( | const eFileMode | fileMode, |
| const string & | fileName, | ||
| const Char::eCompareType | caseSense = Char::eCASE_SENSITIVE |
||
| ) |
Constructs a table file.
| [in] | fileMode | - table file mode. Possible values are read-only, create, update and virtual. |
| [in] | fileName | - relative or absolute name of the file where object persistency is maintained. If fileMode specifies virtual mode, this parameter is ignored. |
| [in] | caseSense | - optional parameter that indicates case sensitivity of table names in blocks. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed. |
|
virtual |
Destructs a table file, by first flushing all the modified tables in data blocks (for create mode or update mode) and then releasing all in-memory objects.
| Not applicable |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| string TableFile::AddBlock | ( | const string & | blockName | ) |
Adds a block to the table file. If a block with the specified name already exists, table file stores it under different internal name, that is obtained by appending a "#" symbol and the current block count. After writing blocks, with these kinds of block names, to an ASCII file, "#" symbol becomes a comment and the text after it is ignored. This enables the preservation of all duplicate blocks in the written file.
| [in] | blockName | - the name of the data block |
| void TableFile::Close | ( | ) |
Flushes the table file (if in create or update mode) and closes the associated persistent storage file.
| None |
| void TableFile::Flush | ( | ) |
Writes only the new or modified tables in data blocks to the associated persistent storage file (specified at table file construction time).
| None |
| FileModeException | - if table file is not in create or update mode |
| Block& TableFile::GetBlock | ( | const string & | blockName | ) |
Retrieves a reference to the data block in the table file.
| [in] | blockName | - the name of the data block |
| NotFoundException | - if data block with name blockName does not exist |
| void TableFile::GetBlockNames | ( | vector< string > & | blockNames | ) |
Retrieves data block names.
| [out] | blockNames | - retrieved data block names |
|
inline |
Retrieves case sensitivity of table names in blocks.
| None |
References _caseSense.
|
inline |
Retrieves table file mode.
| None |
References _fileMode.
|
inline |
| string TableFile::GetFirstBlockName | ( | ) |
Retrieves the name of the first data block.
| None |
Referenced by RenameFirstBlock().
|
inline |
Retrieves the number of data blocks in the table file.
| None |
References _blocks, and mapped_ptr_vector< T, StringCompareT >::size().
|
protected |
|
inline |
Retrieves table file status in form of one or more flags.
| None |
References _statusInd.
|
protected |
|
protected |
|
protected |
| bool TableFile::IsBlockPresent | ( | const string & | blockName | ) |
Checks for data block existence.
| [in] | blockName | - the name of the data block |
| string TableFile::RenameBlock | ( | const string & | oldBlockName, |
| const string & | newBlockName | ||
| ) |
Changes the data block name.
| [in] | oldBlockName | - the name of the data block which is to be renamed |
| [in] | newBlockName | - the new data block name |
| EmptyContainerException | - if table file has no data blocks |
| NotFoundException | - if data block with name oldBlockName does not exist |
Referenced by RenameFirstBlock().
|
inline |
Changes the name of the first data block in table file.
| [in] | newBlockName | - the new data block name |
| EmptyContainerException | - if table file has no data blocks |
References GetFirstBlockName(), and RenameBlock().
| void TableFile::Serialize | ( | const string & | fileName | ) |
Writes all the data blocks and their tables in the specified file. The inteded purpose of this method is to write to a file different than the one specified at construction time.
| [in] | fileName | - relative or absolute name of the file |
|
protected |
Referenced by GetNumBlocks().
|
protected |
Referenced by GetCaseSensitivity().
|
protected |
|
protected |
Referenced by GetFileMode().
|
protected |
Referenced by GetFileName().
|
protected |
Referenced by GetStatusInd().
1.8.16