Regina Calculation Engine
Public Member Functions | Friends
regina::NMarkedElement Class Reference

A base class for elements of NMarkedVector. More...

#include <utilities/nmarkedvector.h>

Inheritance diagram for regina::NMarkedElement:
regina::NBoundaryComponent regina::NComponent regina::NEdge regina::NFace regina::NTetrahedron regina::NVertex

List of all members.

Public Member Functions

long markedIndex () const
 Returns the index at which this object is stored in an NMarkedVector.

Friends

class NMarkedVector
 Allow only NMarkedVector to edit the array index.

Detailed Description

A base class for elements of NMarkedVector.

NMarkedVector is a vector class that provides fast, space-efficient reverse lookup of array indices (i.e., given an object, find the index at which it is stored). The way it does this is to store the array indices in the object themselves.

As a result, any type to be stored in an NMarkedVector must be derived from this class. This class provides a space to store the corresponding array index, and looks after access control so that only NMarkedVector can edit this index.

Since indices are stored with the objects, it is possible to perform this reverse lookup by querying the object alone, without any reference to the actual vector. This can be done through the public routine markedIndex().

The trade-off of course is that any object may not belong to more than one NMarkedVector at a time. Any attempt to do this will result in undefined behaviour.

See NMarkedVector for further information.

Python:
Not present.

Member Function Documentation

long regina::NMarkedElement::markedIndex ( ) const [inline]

Returns the index at which this object is stored in an NMarkedVector.

If this object does not belong to an NMarkedVector, the return value is undefined.

Returns:
the index at which this object is stored.

Friends And Related Function Documentation

friend class NMarkedVector [friend]

Allow only NMarkedVector to edit the array index.


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

Copyright © 1999-2011, The Regina development team
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).