GlobalObjects
|
An object of this class or subclass accesses tables and reads or writes data records (Record) and binary files (eut::Blob). More...
#include <GloTableInterface.h>
Classes | |
class | TableInterfaceTable |
A file (std::fstream) and its name. More... | |
Public Member Functions | |
TableInterface (const SchemaInterface &rScheme, RealIndexPool *pRealIndexPool) | |
virtual | ~TableInterface () |
virtual int | closeTable (const std::string &sTable) |
std::string | getDataPath () const |
int | getObjIDRecordAttribute (ObjIDRecordAttribute *&prRetVal, const std::string &sTable, const ObjID &rObjID) |
SchemaInterface & | getSchemaInterface () |
std::string | getSchemaPath () const |
int | objIDInBase (bool &rPresent, const ObjID &rObjID) const |
virtual int | openTable (const std::string &sTableName)=0 |
Protected Member Functions | |
TableInterface () | |
int | openFile (std::fstream *&prFStream, const std::string &sFullFileName, std::ios_base::openmode OpenMode) |
Protected Attributes | |
std::unordered_map< std::string, TableInterfaceTable * > | m_OpenTableMap |
RealIndexPool * | m_pRealIndexPool |
SchemaInterface * | m_pSchema |
Private Member Functions | |
TableInterface (const TableInterface &) | |
void | closeAllTables () |
TableInterface::TableInterfaceTable * | getTable (const std::string &m_sTableName) |
TableInterface & | operator= (const TableInterface &) |
An object of this class or subclass accesses tables and reads or writes data records (Record) and binary files (eut::Blob).
An IndexPool is passed which has created the indexes (e.g. the ObjIDs) of all tables during instantiation. Accesses to the tables are realized via this IndexPool if possible.
If a table is closed or read, the index is not destroyed or read again. This requires that only a derived writer with the same RealIndexPool is allowed to write to the tables and maintain the indexes.
|
protected |
The default constructor is not available.
glo::TableInterface::TableInterface | ( | const SchemaInterface & | rScheme, |
RealIndexPool * | pRealIndexPool ) |
Constructor with parameter passing.
[in] | rScheme | Cannot be used without schema, will be copied. |
[in] | pRealIndexPool | Accelerates the access to records. |
eut::ErrorNException | An exception is thrown if an error occurs. |
|
virtual |
Destructor, all open table files are closed and the memory is cleaned up.
|
private |
The copy constructor is not available.
|
private |
Schliesst und entfernt alle Tabellen-Dateien aus der Liste der geöffneten Tabellen-Dateien.
|
virtual |
Closes a table file.
[in] | sTable | The table file name. |
std::string glo::TableInterface::getDataPath | ( | ) | const |
Returns the full directory name where the data can be found. The data is always located in a subdirectory of the directory where the schema file is located.
int glo::TableInterface::getObjIDRecordAttribute | ( | ObjIDRecordAttribute *& | prRetVal, |
const std::string & | sTable, | ||
const ObjID & | rObjID ) |
Returns the object ID attribute with passed object ID from the table file with the passed name.
[in,out] | prRetVal | The found object ID attribute. |
[in] | sTable | The table file name in which the object ID attribute is searched. |
[in] | rObjID | The object ID of the searched object ID attribute. |
SchemaInterface & glo::TableInterface::getSchemaInterface | ( | ) |
Returns a pointer to m_pSchema.
std::string glo::TableInterface::getSchemaPath | ( | ) | const |
Returns the file path where the schema file can be found.
|
private |
Returns a table file in an object of type TableInterfaceTable with the passed name from the list of opened table files.
[in] | m_sTableName | The file name. |
int glo::TableInterface::objIDInBase | ( | bool & | rPresent, |
const ObjID & | rObjID ) const |
Checks if an object with passed object ID is stored in the database.
[in,out] | rPresent | If true, there is an object with passed object ID in the database. |
[in] | rObjID | The object ID to be checked. |
|
protected |
Opens and returns the opened file. It is first looked up in the list of opened table files and returns them if available.
. Otherwise, the program tries to open a file with the specified name and, if successful, to insert it into the list of opened table files and deliver it.
Is used by both subclasses with different 'OpenMode'.
[in,out] | prFStream | The opened file (if successful). |
[in] | sFullFileName | The file name. |
[in] | OpenMode | The mode in which the file is opened. |
|
pure virtual |
Opens a table file in subclasses and adds it to the list of opened table files if successful.
[in] | sTableName | The table file name. |
Implemented in glo::TableReaderInterface, and glo::TableWriterInterface.
|
private |
The assignment operator is not available.
|
protected |
The container opened table files.
|
protected |
If available, the RealIndexPool is used to find a record faster.
|
protected |
The underlying scheme.