Class SBCReferenceIndexer#
ClassList > SBCReferenceIndexer
Inherits the following classes: SBCContainerIndexer
Public Functions inherited from SBCContainerIndexer#
| Type | Name |
|---|---|
| SBCContainerIndexer () Creates an indexer. |
|
| SBCContainerIndexer (unsigned int initialSize) Creates an indexer with a default pre-allocated size. |
|
| SBCContainerIndexer (std::set< ObjectType > & objectSet) Constructs an indexer using the set of objects. |
|
| SBCContainerIndexer (std::vector< ObjectType > & objectVector) Constructs an indexer using the vector of objects. |
|
| SBCContainerIndexer (std::initializer_list< ObjectType > objectList) Constructs an indexer using the initializer list. |
|
| SBCContainerIndexer (const SBCContainerIndexer & indexer) Copy constructor. |
|
| SBCContainerIndexer (SBCContainerIndexer && indexer) noexcept Move constructor. |
|
| iterator | begin () Returns an iterator that points to the beginning of the indexer. |
| const_iterator | begin () const Returns an iterator that points to the beginning of the indexer. |
| void | clear () Clears the indexer. |
| bool | empty () const Returns true if and only if the indexer is empty. |
| iterator | end () Returns an iterator that points to the end of the indexer. |
| const_iterator | end () const Returns an iterator that points to the end of the indexer. |
| unsigned int | eraseIndex (unsigned int objectIndex) Erases object objectIndex from the indexer. |
| unsigned int | eraseObject (const ObjectType & object) Erases the object from the indexer. |
| unsigned int | getIndex (const ObjectType & object) const Returns the index associated to the object . |
| bool | getIndex (const ObjectType & object, unsigned int & index) const Returns the index associated to the object . |
| ObjectType | getObject (unsigned int index) const Returns the object associated to the index . |
| bool | hasIndex (const ObjectType & object) const Returns true if the__object has an index. |
| unsigned int | insert (unsigned int i, const ObjectType & object) Inserts an object in the indexer at position i if possible, and returns the index of the object. |
| SBCContainerIndexer & | operator= (const SBCContainerIndexer & indexer) Copy assignment. |
| SBCContainerIndexer & | operator= (SBCContainerIndexer && indexer) noexcept Move assignment. |
| ObjectType | operator[] (unsigned int index) const Returns the object associated to the index . |
| unsigned int | pop_back () Adds an object in the indexer and returns the index of the object. |
| void | print (std::ostream & os) const Prints some debugging information. |
| void | print () const Prints some debugging information. |
| unsigned int | push_back (const ObjectType & object) Adds an object in the indexer if possible, and returns the index of the object. |
| reverse_iterator | rbegin () Returns a reverse iterator that points to the reverse beginning of the indexer. |
| const_reverse_iterator | rbegin () const Returns a reverse iterator that points to the reverse beginning of the indexer. |
| reverse_iterator | rend () Returns a reverse iterator that points to the reverse end of the indexer. |
| const_reverse_iterator | rend () const Returns a reverse iterator that points to the reverse end of the indexer. |
| unsigned int | size () const Returns the number of indexed objects. |
| virtual | ~SBCContainerIndexer () Destructs the indexer. |
Protected Attributes inherited from SBCContainerIndexer#
| Type | Name |
|---|---|
| HashMap * | indexMap The hash map. |
| Vector * | objectVector The object vector. |
Protected Functions#
| Type | Name |
|---|---|
| SBCReferenceIndexer () Creates a reference indexer. |
|
| SBCReferenceIndexer (unsigned int initialSize) Creates a reference indexer. |
|
| SBCReferenceIndexer (std::vector< SBCReferenceToTarget * > & referenceToTargetVector) Constructs an indexer from the vector of references. |
|
| SBCReferenceIndexer (std::set< SBCReferenceToTarget * > & referenceToTargetSet) Constructs an indexer from the set of references. |
|
| SBCReferenceIndexer (std::initializer_list< SBCReferenceToTarget * > nodeList) Constructs a reference indexer using the initializer list. |
|
| SBCReferenceIndexer (const SBCReferenceIndexer & referenceIndex) Copy constructor. |
|
| unsigned int | eraseReferenceTarget (SBCReferenceTarget * referenceTarget) Erases the reference from the indexer. |
| unsigned int | eraseReferenceTarget (unsigned int referenceTargetIndex) Erases reference referenceIndex from the indexer. |
| unsigned int | eraseReferenceToTarget (SBCReferenceToTarget * referenceToTarget) Erases the reference from the indexer. |
| unsigned int | eraseReferenceToTarget (unsigned int referenceToTargetIndex) Erases reference referenceIndex from the indexer. |
| unsigned int | getIndex (SBCReferenceToTarget * referenceToTarget) const Returns the index associated to the reference . |
| bool | getIndex (SBCReferenceToTarget * referenceToTarget, unsigned int & index) const Returns the index associated to the reference . |
| unsigned int | getIndex (SBCReferenceTarget * referenceTarget) const Returns the index associated to the reference . |
| bool | getIndex (SBCReferenceTarget * referenceTarget, unsigned int & index) const Returns the index associated to the reference . |
| SBCReferenceTarget * | getReferenceTarget (unsigned int index) const Returns the reference associated to the index . |
| SBCReferenceToTarget * | getReferenceToTarget (unsigned int index) const Returns the reference associated to the index . |
| SBCReferenceToTarget * | getReferenceToTarget (SBCReferenceTarget * referenceTarget) const Returns the reference associated to the index . |
| bool | hasIndex (SBCReferenceToTarget * referenceToTarget) const Returns true if the__reference has an index. |
| bool | hasIndex (SBCReferenceTarget * referenceTarget) const Returns true if the__reference has an index. |
| virtual | ~SBCReferenceIndexer () Destructs the reference indexer. |
Protected Functions Documentation#
function SBCReferenceIndexer [1/6]#
Creates a reference indexer.
Constructs an empty reference indexer.
function SBCReferenceIndexer [2/6]#
Creates a reference indexer.
Constructs a reference indexer with a preallocated capacity.
Parameters:
initialSizeThe initial number of references to reserve space for.
function SBCReferenceIndexer [3/6]#
Constructs an indexer from the vector of references.
explicit SBCReferenceIndexer::SBCReferenceIndexer (
std::vector< SBCReferenceToTarget * > & referenceToTargetVector
)
Constructs a reference indexer from a vector of references.
Parameters:
referencesA vector containing the references to be indexed.
function SBCReferenceIndexer [4/6]#
Constructs an indexer from the set of references.
explicit SBCReferenceIndexer::SBCReferenceIndexer (
std::set< SBCReferenceToTarget * > & referenceToTargetSet
)
Constructs a reference indexer from a set of references.
Parameters:
referencesA set containing the references to be indexed.
function SBCReferenceIndexer [5/6]#
Constructs a reference indexer using the initializer list.
SBCReferenceIndexer::SBCReferenceIndexer (
std::initializer_list< SBCReferenceToTarget * > nodeList
)
Constructs a reference indexer from an initializer list of references.
Parameters:
referencesAn initializer list containing the references to be indexed.
function SBCReferenceIndexer [6/6]#
Copy constructor.
Parameters:
referenceIndexThe reference indexer to copy.
function eraseReferenceTarget [1/2]#
Erases the reference from the indexer.
Erases a reference from the indexer using a target pointer.
Parameters:
targetThe target whose reference should be erased.
The function returns an unsigned int with the following meaning:
- if the target was not present in the index, the returned value is the number of indexed references.
- else, the returned value is the index of the reference that was removed, in [0, size-1].
Note that these two returned values coincide when the client (unsuccessfully) attempts to erase reference with index size.
Returns:
The number of indexed references if the target was not present, otherwise the index of the removed reference.
function eraseReferenceTarget [2/2]#
Erases reference referenceIndex from the indexer.
Erases a reference from the indexer using its index.
Parameters:
referenceIndexThe index of the reference to erase.
The function returns an unsigned int with the following meaning:
- if the reference was not present in the index, the returned value is the number of indexed references.
- else, the returned value is the index of the reference that was removed, in [0, size-1].
Note that these two returned values coincide when the client (unsuccessfully) attempts to erase reference with index size.
Returns:
The number of indexed references if the reference was not present, otherwise the index of the removed reference.
function eraseReferenceToTarget [1/2]#
Erases the reference from the indexer.
unsigned int SBCReferenceIndexer::eraseReferenceToTarget (
SBCReferenceToTarget * referenceToTarget
)
Erases a reference from the indexer using a reference pointer.
Parameters:
referenceThe reference to erase.
The function returns an unsigned int with the following meaning:
- if the reference was not present in the index, the returned value is the number of indexed references.
- else, the returned value is the index of the reference that was removed, in [0, size-1].
Note that these two returned values coincide when the client (unsuccessfully) attempts to erase reference with index size.
Returns:
The number of indexed references if the reference was not present, otherwise the index of the removed reference.
function eraseReferenceToTarget [2/2]#
Erases reference referenceIndex from the indexer.
Erases a reference from the indexer using its index.
Parameters:
referenceIndexThe index of the reference to erase.
The function returns an unsigned int with the following meaning:
- if the reference was not present in the index, the returned value is the number of indexed references.
- else, the returned value is the index of the reference that was removed, in [0, size-1].
Note that these two returned values coincide when the client (unsuccessfully) attempts to erase reference with index size.
Returns:
The number of indexed references if the reference was not present, otherwise the index of the removed reference.
function getIndex [1/4]#
Returns the index associated to the reference .
Retrieves the index associated with a reference.
Parameters:
referenceThe reference whose index is requested.
Returns:
The index of the reference.
function getIndex [2/4]#
Returns the index associated to the reference .
bool SBCReferenceIndexer::getIndex (
SBCReferenceToTarget * referenceToTarget,
unsigned int & index
) const
Retrieves the index associated with a reference, if present.
Parameters:
referenceThe reference whose index is requested.indexOutput parameter that receives the index if the reference is found.
Returns:
true if the reference was found and the index was set, false otherwise.
function getIndex [3/4]#
Returns the index associated to the reference .
Retrieves the index associated with a target.
Parameters:
referenceTargetThe target whose index is requested.
Returns:
The index of the target.
function getIndex [4/4]#
Returns the index associated to the reference .
bool SBCReferenceIndexer::getIndex (
SBCReferenceTarget * referenceTarget,
unsigned int & index
) const
Retrieves the index associated with a target, if present.
Parameters:
referenceTargetThe target whose index is requested.indexOutput parameter that receives the index if the target is found.
Returns:
true if the target was found and the index was set, false otherwise.
function getReferenceTarget#
Returns the reference associated to the index .
Retrieves the target associated with a given reference index.
Parameters:
indexThe index of the reference.
Returns:
The target associated with the reference at the given index.
function getReferenceToTarget [1/2]#
Returns the reference associated to the index .
Retrieves the reference associated with a given index.
Parameters:
indexThe index of the desired reference.
Returns:
The reference at the specified index.
function getReferenceToTarget [2/2]#
Returns the reference associated to the index .
SBCReferenceToTarget * SBCReferenceIndexer::getReferenceToTarget (
SBCReferenceTarget * referenceTarget
) const
Retrieves the reference associated with a target.
Retrieves the reference that corresponds to the supplied target. If the target is not indexed, the function returns nullptr.
Parameters:
referenceTargetThe target whose reference is requested.
Returns:
The reference associated with the target, or nullptr if the target is not indexed.
function hasIndex [1/2]#
Returns true if the__reference has an index.
Checks whether the given reference has an associated index.
Parameters:
referenceThe reference to check.
Returns:
true if the reference has an index, false otherwise.
function hasIndex [2/2]#
Returns true if the__reference has an index.
Checks whether the given target has an associated index.
Parameters:
referenceTargetThe target to check.
Returns:
true if the target has an index, false otherwise.
function ~SBCReferenceIndexer#
Destructs the reference indexer.
Destroys the reference indexer and releases any allocated resources.