Web Analytics Made Easy - Statcounter
Skip to content

Class SBCReferenceIndexer#

ClassList > SBCReferenceIndexer

Inherits the following classes: SBCContainerIndexer

Public Functions inherited from SBCContainerIndexer#

See 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#

See 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.

SBCReferenceIndexer::SBCReferenceIndexer () 

Constructs an empty reference indexer.


function SBCReferenceIndexer [2/6]#

Creates a reference indexer.

explicit SBCReferenceIndexer::SBCReferenceIndexer (
    unsigned int initialSize
) 

Constructs a reference indexer with a preallocated capacity.

Parameters:

  • initialSize The 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:

  • references A 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:

  • references A 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:

  • references An initializer list containing the references to be indexed.

function SBCReferenceIndexer [6/6]#

Copy constructor.

SBCReferenceIndexer::SBCReferenceIndexer (
    const SBCReferenceIndexer & referenceIndex
) 

Parameters:

  • referenceIndex The reference indexer to copy.

function eraseReferenceTarget [1/2]#

Erases the reference from the indexer.

unsigned int SBCReferenceIndexer::eraseReferenceTarget (
    SBCReferenceTarget * referenceTarget
) 

Erases a reference from the indexer using a target pointer.

Parameters:

  • target The 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.

unsigned int SBCReferenceIndexer::eraseReferenceTarget (
    unsigned int referenceTargetIndex
) 

Erases a reference from the indexer using its index.

Parameters:

  • referenceIndex The 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:

  • reference 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 [2/2]#

Erases reference referenceIndex from the indexer.

unsigned int SBCReferenceIndexer::eraseReferenceToTarget (
    unsigned int referenceToTargetIndex
) 

Erases a reference from the indexer using its index.

Parameters:

  • referenceIndex The 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 .

unsigned int SBCReferenceIndexer::getIndex (
    SBCReferenceToTarget * referenceToTarget
) const

Retrieves the index associated with a reference.

Parameters:

  • reference The 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:

  • reference The reference whose index is requested.
  • index Output 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 .

unsigned int SBCReferenceIndexer::getIndex (
    SBCReferenceTarget * referenceTarget
) const

Retrieves the index associated with a target.

Parameters:

  • referenceTarget The 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:

  • referenceTarget The target whose index is requested.
  • index Output 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 .

SBCReferenceTarget * SBCReferenceIndexer::getReferenceTarget (
    unsigned int index
) const

Retrieves the target associated with a given reference index.

Parameters:

  • index The 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 .

SBCReferenceToTarget * SBCReferenceIndexer::getReferenceToTarget (
    unsigned int index
) const

Retrieves the reference associated with a given index.

Parameters:

  • index The 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:

  • referenceTarget The 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.

bool SBCReferenceIndexer::hasIndex (
    SBCReferenceToTarget * referenceToTarget
) const

Checks whether the given reference has an associated index.

Parameters:

  • reference The 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.

bool SBCReferenceIndexer::hasIndex (
    SBCReferenceTarget * referenceTarget
) const

Checks whether the given target has an associated index.

Parameters:

  • referenceTarget The target to check.

Returns:

true if the target has an index, false otherwise.


function ~SBCReferenceIndexer#

Destructs the reference indexer.

virtual SBCReferenceIndexer::~SBCReferenceIndexer () 

Destroys the reference indexer and releases any allocated resources.