Manages the individual string indices of a class. If this is a unique index, the ObjStrIdTuple are in a map, otherwise in a MultiMap. Then indexes in a MultiMap can be inserted as reserved, this is taken into account when inserting further.
More...
#include <GloIndexPool.h>
|
| ObjectStrIndex (const ObjectStrIndex &rT) |
|
| ObjectStrIndex (const std::string &rsPathName, unsigned long ulClassID, const std::string &rsIndexName, bool bUnique) |
|
virtual | ~ObjectStrIndex () |
|
void | deleteAllIndexValues () |
|
unsigned long | getClassID () const |
|
const std::string & | getIndexName () const |
|
const std::multimap< std::string, IndexPool::ObjStrIdTuple *, std::less< std::string > > & | getNonUniqueIndexMapRef () const |
|
const std::map< ObjID, IndexPool::ObjStrIdTuple *, std::less< ObjID > > & | getObjIdIndexMapRef () const |
|
const std::string & | getPathName () const |
|
const std::map< std::string, IndexPool::ObjStrIdTuple *, std::less< std::string > > & | getUniqueIndexMapRef () const |
|
int | insertObjStrIdTuple (const ObjStrIdTuple &rIndexTuple) |
|
bool | isIndexFree (const std::string &rsIndex, const ObjID &rObjID) const |
|
bool | isObjIdAlreadyAvailable (const ObjID &rObjID) const |
|
bool | isUnique () const |
|
IndexPool::ObjectStrIndex & | operator= (const ObjectStrIndex &rT) |
|
void | releaseObjStrIdTuple (const NUM_PTR ipReservingComunicatorTrx) |
|
int | removeObjStrIdTuple (const ObjID &rObjID, NUM_PTR ipReservingComunicatorTrx=0) |
|
void | reserveObjStrIdTuple (const ObjStrIdTuple &rIndexTuple) |
|
|
bool | m_bUnique |
|
std::multimap< std::string, ObjStrIdTuple *, std::less< std::string > > | m_NonUniqueIndexMultiMap |
|
std::multimap< std::string, ObjStrIdTuple * >::iterator | m_NonUniqueIndexMultiMapIterator |
|
std::map< ObjID, ObjStrIdTuple *, std::less< ObjID > > | m_ObjIdIndexMap |
|
std::multimap< std::string, ObjStrIdTuple *, std::less< std::string > > | m_ReservedIndexMultiMap |
|
std::string | m_sIndexName |
|
std::string | m_strPathName |
|
unsigned long | m_ulClassID |
|
std::map< std::string, ObjStrIdTuple *, std::less< std::string > > | m_UniqueIndexMap |
|
std::map< std::string, ObjStrIdTuple * >::iterator | m_UniqueIndexMapIterator |
|
Manages the individual string indices of a class. If this is a unique index, the ObjStrIdTuple are in a map, otherwise in a MultiMap. Then indexes in a MultiMap can be inserted as reserved, this is taken into account when inserting further.
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ ObjectStrIndex() [1/3]
glo::IndexPool::ObjectStrIndex::ObjectStrIndex |
( |
| ) |
|
|
protected |
The default constructor is not available.
◆ ObjectStrIndex() [2/3]
glo::IndexPool::ObjectStrIndex::ObjectStrIndex |
( |
const std::string & | rsPathName, |
|
|
unsigned long | ulClassID, |
|
|
const std::string & | rsIndexName, |
|
|
bool | bUnique ) |
Constructor with parameter passing.
- Parameters
-
[in] | rsPathName | The complete directory name where the tables can be found such as "C:/Path/Data/". |
[in] | ulClassID | The class ID of the managed indexes. |
[in] | rsIndexName | The index name. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
[in] | bUnique | If true, then this is a unique index (each entry can only exist once), otherwise several identical entries are possible. |
◆ ObjectStrIndex() [3/3]
glo::IndexPool::ObjectStrIndex::ObjectStrIndex |
( |
const ObjectStrIndex & | rT | ) |
|
Copy constructor.
- Parameters
-
[in] | rT | The data is copied from this object. |
- Exceptions
-
◆ ~ObjectStrIndex()
virtual glo::IndexPool::ObjectStrIndex::~ObjectStrIndex |
( |
| ) |
|
|
virtual |
◆ copyMapsFrom()
void glo::IndexPool::ObjectStrIndex::copyMapsFrom |
( |
const ObjectStrIndex & | rT | ) |
|
|
protected |
Removes all elements from the maps. Then all elements of the same maps of the passed Object-StringIndex are copied.
- Parameters
-
[in] | rT | The Object StringIndex whose elements are to be copied from the maps. |
- Exceptions
-
◆ deleteAllIndexValues()
void glo::IndexPool::ObjectStrIndex::deleteAllIndexValues |
( |
| ) |
|
◆ getClassID()
unsigned long glo::IndexPool::ObjectStrIndex::getClassID |
( |
| ) |
const |
Returns the class ID of the managed object StringIndex.
- Returns
- The class ID.
◆ getIndexName()
const std::string & glo::IndexPool::ObjectStrIndex::getIndexName |
( |
| ) |
const |
Returns the index name. For example, if in the schema "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName".
- Returns
- The index name.
◆ getNonUniqueIndexMapRef()
const std::multimap< std::string, IndexPool::ObjStrIdTuple *, std::less< std::string > > & glo::IndexPool::ObjectStrIndex::getNonUniqueIndexMapRef |
( |
| ) |
const |
◆ getObjIdIndexMapRef()
◆ getObjStrIdTuple() [1/2]
Returns a pointer to an ObjStrIdTuple from m_UniqueIndexMap with the passed object ID.
- Parameters
-
- Returns
- The object found, if any.
- Attention
- The calling instance must not modify or remove the returned object from memory. It only lives as long as this object.
◆ getObjStrIdTuple() [2/2]
Returns a pointer to an ObjStrIdTuple depending on m_bUnique from m_UniqueIndexMap or m_NonUniqueIndexMultiMap in relation to eMode
- Parameters
-
Parameter examples:
- Returns
- The objects found, if any.
- Attention
- The calling instance must NOT change or remove the delivered object from memory. It only lives as long as this object.
◆ getPathName()
const std::string & glo::IndexPool::ObjectStrIndex::getPathName |
( |
| ) |
const |
Returns the complete directory name in which the tables can be found.
- Returns
- The complete directory name such as "C:/Path/Data/".
◆ getUniqueIndexMapRef()
const std::map< std::string, IndexPool::ObjStrIdTuple *, std::less< std::string > > & glo::IndexPool::ObjectStrIndex::getUniqueIndexMapRef |
( |
| ) |
const |
◆ insertObjStrIdTuple()
int glo::IndexPool::ObjectStrIndex::insertObjStrIdTuple |
( |
const ObjStrIdTuple & | rIndexTuple | ) |
|
◆ isIndexFree()
bool glo::IndexPool::ObjectStrIndex::isIndexFree |
( |
const std::string & | rsIndex, |
|
|
const ObjID & | rObjID ) const |
Checks if a string index for an object is still free. Only makes sense if m_bUnique is set to true.
- Parameters
-
[in] | rsIndex | The index to check. |
[in] | rObjID | The object ID to be checked. |
- Returns
- Returns true (always when m_bUnique == false) or false if rsIndex is already assigned.
◆ isObjIdAlreadyAvailable()
bool glo::IndexPool::ObjectStrIndex::isObjIdAlreadyAvailable |
( |
const ObjID & | rObjID | ) |
const |
Checks if an index with the object ID is included in m_ObjIdIndexMap.
- Parameters
-
[in] | rObjID | The object ID to be checked. |
- Returns
- Returns true if an index with the object ID is contained in m_ObjIdIndexMap.
◆ isUnique()
bool glo::IndexPool::ObjectStrIndex::isUnique |
( |
| ) |
const |
Returns whether this is a unique index or not.
- Returns
- If true, then this is a unique index (each entry can only exist once), otherwise several identical entries are possible.
◆ operator=()
Assignment operator.
- Parameters
-
[in] | rT | The data is transferred from this object. |
- Exceptions
-
◆ releaseObjStrIdTuple()
void glo::IndexPool::ObjectStrIndex::releaseObjStrIdTuple |
( |
const NUM_PTR | ipReservingComunicatorTrx | ) |
|
◆ removeObjStrIdTuple() [1/2]
int glo::IndexPool::ObjectStrIndex::removeObjStrIdTuple |
( |
const ObjID & | rObjID, |
|
|
bool | bDelete, |
|
|
NUM_PTR | ipReservingComunicatorTrx = 0 ) |
|
protected |
◆ removeObjStrIdTuple() [2/2]
int glo::IndexPool::ObjectStrIndex::removeObjStrIdTuple |
( |
const ObjID & | rObjID, |
|
|
NUM_PTR | ipReservingComunicatorTrx = 0 ) |
Removes a string index depending on m_bUnique from m_UniqueIndexMap or m_NonUniqueIndexMultiMap.
- Parameters
-
[in] | rObjID | The ObjId of the index to remove. |
[in] | ipReservingComunicatorTrx | The address of a Communicator casted to NUM_PTR in whose transaction the index was reserved, if applicable. If this is set, only a reserved index is deleted. |
- Returns
- A return value < 0 indicates an error.
◆ reserveObjStrIdTuple()
void glo::IndexPool::ObjectStrIndex::reserveObjStrIdTuple |
( |
const ObjStrIdTuple & | rIndexTuple | ) |
|
◆ RealIndexPool
◆ m_bUnique
bool glo::IndexPool::ObjectStrIndex::m_bUnique |
|
private |
If true, it is a unique index (each entry can only exist once), otherwise several identical entries are possible.
◆ m_NonUniqueIndexMultiMap
std::multimap< std::string, ObjStrIdTuple * , std::less< std::string > > glo::IndexPool::ObjectStrIndex::m_NonUniqueIndexMultiMap |
|
private |
◆ m_NonUniqueIndexMultiMapIterator
std::multimap<std::string,ObjStrIdTuple*>::iterator glo::IndexPool::ObjectStrIndex::m_NonUniqueIndexMultiMapIterator |
|
private |
◆ m_ObjIdIndexMap
◆ m_ReservedIndexMultiMap
std::multimap< std::string, ObjStrIdTuple * , std::less< std::string > > glo::IndexPool::ObjectStrIndex::m_ReservedIndexMultiMap |
|
private |
Unique indexes can be reserved e.g. in transactions that are inserted here.
This is e.g. necessary if an indexed object in a transaction with a unique index is "1" to store in a TransactionManager::TransactionStep.
If the same object in the transaction is stored again, with the unique index "2" for storage in a TransactionManager::TransactionStep, this one will be stored as reserved as well.
These reserved indices are only removed with a commit or abort and transferred to the m_UniqueIndexMap with a commit.
◆ m_sIndexName
std::string glo::IndexPool::ObjectStrIndex::m_sIndexName |
|
private |
The index name. For example, if in the schema "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName".
◆ m_strPathName
std::string glo::IndexPool::ObjectStrIndex::m_strPathName |
|
private |
The complete directory name where the tables can be found such as "C:/Path/Data/".
◆ m_ulClassID
unsigned long glo::IndexPool::ObjectStrIndex::m_ulClassID |
|
private |
The class ID of the managed object string index, is only valid for one class (not for tables).
◆ m_UniqueIndexMap
std::map< std::string, ObjStrIdTuple * , std::less< std::string > > glo::IndexPool::ObjectStrIndex::m_UniqueIndexMap |
|
private |
◆ m_UniqueIndexMapIterator
std::map<std::string,ObjStrIdTuple*>::iterator glo::IndexPool::ObjectStrIndex::m_UniqueIndexMapIterator |
|
private |
The documentation for this class was generated from the following file: