GlobalObjects
Loading...
Searching...
No Matches
glo::IndexPool::TableObjIdIndex Class Reference

Manages the object IDs (used and released) with their position in the respective tables. More...

#include <GloIndexPool.h>

Public Member Functions

 TableObjIdIndex (const std::string &rsPathName, unsigned long ulClassID)
 
 TableObjIdIndex (const TableObjIdIndex &rT)
 
virtual ~TableObjIdIndex ()
 
void deleteAllIndexValues ()
 
unsigned long getClassID () const
 
int getFreeObjIDPos (std::streampos &rPos) const
 
const std::map< std::streampos, std::streampos, std::less< std::streampos > > & getFreeObjIDPosMapRef () const
 
const std::map< ObjID, IndexPool::ObjIdPosTuple *, std::less< ObjID > > & getObjIDIndexMapRef () const
 
int getObjIdPosTuple (ObjIdPosTuple *&prRetVal, const ObjID &rObjID) const
 
const std::string & getPathName () const
 
int insertFreeObjIDPos (std::streampos Pos)
 
int insertObjIdPosTuple (const ObjIdPosTuple &rIndexTuple)
 
bool isObjIdFree (const ObjID &rObjID) const
 
IndexPool::TableObjIdIndexoperator= (const TableObjIdIndex &rT)
 
void removeAllFreeObjIDPos ()
 
int removeFreeObjIDPos (std::streampos Pos)
 
int removeObjId (const ObjID &rObjID)
 

Protected Member Functions

void copyMapFrom (const TableObjIdIndex &rT)
 

Private Member Functions

 TableObjIdIndex ()
 

Private Attributes

std::map< std::streampos, std::streampos, std::less< std::streampos > > m_FreeObjIDPosMap
 
std::map< ObjID, ObjIdPosTuple *, std::less< ObjID > > m_ObjIDIndexMap
 
std::string m_strPathName
 
unsigned long m_ulClassID
 

Detailed Description

Manages the object IDs (used and released) with their position in the respective tables.

The object IDs of a class and its subclasses are managed.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ TableObjIdIndex() [1/3]

glo::IndexPool::TableObjIdIndex::TableObjIdIndex ( )
private

The default constructor is not available.

◆ TableObjIdIndex() [2/3]

glo::IndexPool::TableObjIdIndex::TableObjIdIndex ( const std::string & rsPathName,
unsigned long ulClassID )

Constructor with parameter passing.

Parameters
[in]rsPathNameThe complete directory name where the tables can be found such as "C:/Path/Data/".
[in]ulClassIDThe class ID of the managed ObjIdPosTuple

◆ TableObjIdIndex() [3/3]

glo::IndexPool::TableObjIdIndex::TableObjIdIndex ( const TableObjIdIndex & rT)

Copy constructor.

Parameters
[in]rTThe data is copied from this object.

◆ ~TableObjIdIndex()

virtual glo::IndexPool::TableObjIdIndex::~TableObjIdIndex ( )
virtual

Destructor.

Member Function Documentation

◆ copyMapFrom()

void glo::IndexPool::TableObjIdIndex::copyMapFrom ( const TableObjIdIndex & rT)
protected

Removes and deletes all elements from the map, which manages the stored object IDs and table position. Then all elements are transferred from the corresponding map of the rT.

Parameters
[in]rTThe table index whose elements are to be copied from the map, which manages the stored object IDs and the table position.

◆ deleteAllIndexValues()

void glo::IndexPool::TableObjIdIndex::deleteAllIndexValues ( )

Removes and deletes all elements from the map, which manages the stored object IDs with their table position.

◆ getClassID()

unsigned long glo::IndexPool::TableObjIdIndex::getClassID ( ) const

Returns the class ID of the managed ObjIdPosTuple and the index of table positions of deleted records.

◆ getFreeObjIDPos()

int glo::IndexPool::TableObjIdIndex::getFreeObjIDPos ( std::streampos & rPos) const

Returns a free table position from its map, which manages the free table position.

Parameters
[in,out]rPosThe free table position, if one was available.
Returns
A return value < 0 indicates an error.

◆ getFreeObjIDPosMapRef()

const std::map< std::streampos, std::streampos, std::less< std::streampos > > & glo::IndexPool::TableObjIdIndex::getFreeObjIDPosMapRef ( ) const

Returns a reference to the map which manages the free lines (start position in the file where the object ID == 0.0.0)

Returns
The reference to the map.

◆ getObjIDIndexMapRef()

const std::map< ObjID, IndexPool::ObjIdPosTuple *, std::less< ObjID > > & glo::IndexPool::TableObjIdIndex::getObjIDIndexMapRef ( ) const

Returns a reference to the map, which manages the stored object IDs and their table position.

Returns
The reference to the map.

◆ getObjIdPosTuple()

int glo::IndexPool::TableObjIdIndex::getObjIdPosTuple ( ObjIdPosTuple *& prRetVal,
const ObjID & rObjID ) const

Returns an object ID with the table position, where the corresponding data set is stored, from its map, which manages the stored object IDs and the table position, with passed object ID.

Parameters
[in,out]prRetValIf present, a pointer to a copy of the object ID with the table position.
[in]rObjIDThe object ID of the entry to be returned.
Returns
A return value < 0 indicates an error.
Attention
The calling instance must remove the returned object from memory.

◆ getPathName()

const std::string & glo::IndexPool::TableObjIdIndex::getPathName ( ) const

Returns the complete directory name where the tables can be found such as "C:/Path/Data/".

◆ insertFreeObjIDPos()

int glo::IndexPool::TableObjIdIndex::insertFreeObjIDPos ( std::streampos Pos)

Inserts a free table position in its map, which manages the free table position.

Parameters
[in]PosThe table position to insert.
Returns
A return value < 0 indicates an error.

◆ insertObjIdPosTuple()

int glo::IndexPool::TableObjIdIndex::insertObjIdPosTuple ( const ObjIdPosTuple & rIndexTuple)

Inserts an object ID with the table position, where the corresponding data set is stored, into its map, which manages the stored object IDs and table position.

Parameters
[in]rIndexTupleThe object ID with the table position to be inserted.
Returns
A return value < 0 indicates an error.

◆ isObjIdFree()

bool glo::IndexPool::TableObjIdIndex::isObjIdFree ( const ObjID & rObjID) const

Checks an object ID whether it is already managed.

Parameters
[in]rObjIDThe object ID to be checked.
Returns
Returns true, if rObjID is not managed, otherwise false.

◆ operator=()

IndexPool::TableObjIdIndex & glo::IndexPool::TableObjIdIndex::operator= ( const TableObjIdIndex & rT)

Assignment operator.

Parameters
[in]rTThe data is transferred from this object.

◆ removeAllFreeObjIDPos()

void glo::IndexPool::TableObjIdIndex::removeAllFreeObjIDPos ( )

Removes all elements from the map, which manages the free lines (start position in the file, where the object ID == 0.0.0).

◆ removeFreeObjIDPos()

int glo::IndexPool::TableObjIdIndex::removeFreeObjIDPos ( std::streampos Pos)

Removes a free table position from its map, which manages the free table position.

Parameters
[in]PosThe removed table position.
Returns
A return value < 0 indicates an error.

◆ removeObjId()

int glo::IndexPool::TableObjIdIndex::removeObjId ( const ObjID & rObjID)

Removes an object ID with the table position, where the corresponding data set is stored, from its map, which manages the stored object IDs and table position.

Parameters
[in]rObjIDThe object ID of the entry to be removed.
Returns
A return value < 0 indicates an error.

Member Data Documentation

◆ m_FreeObjIDPosMap

std::map< std::streampos, std::streampos , std::less< std::streampos > > glo::IndexPool::TableObjIdIndex::m_FreeObjIDPosMap
private

A map that manages the free lines (start position in the file, where the object ID == 0.0.0).

◆ m_ObjIDIndexMap

std::map< ObjID, ObjIdPosTuple *, std::less< ObjID > > glo::IndexPool::TableObjIdIndex::m_ObjIDIndexMap
private

A map that manages the stored object IDs and their table positions.

◆ m_strPathName

std::string glo::IndexPool::TableObjIdIndex::m_strPathName
private

The complete directory name where the tables can be found such as "C:/Path/Data/".

◆ m_ulClassID

unsigned long glo::IndexPool::TableObjIdIndex::m_ulClassID
private

The class ID of the managed ObjIdPosTuple and the index of table positions of deleted records.


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