maliput
UniqueIndexer< T, Hash, KeyEqual > Class Template Reference

Detailed Description

template<class T, class Hash, class KeyEqual>
class maliput::utility::mesh::UniqueIndexer< T, Hash, KeyEqual >

A container for a set of unique objects which keeps track of the original insertion order.

Its primary purpose is to assign a stable unique index to each element at time of insertion.

Template Parameters
Tthe inserted element type
Hasha hasher suitable for std::unordered_map (e.g., std::hash)
KeyEqualan equivalence relation suitable for std::unordered_map (e.g., std::equal_to)

#include <include/maliput/utility/mesh.h>

Public Member Functions

 UniqueIndexer ()=default
 Creates an empty UniqueIndexer. More...
 
int push_back (const T &thing)
 Pushes thing onto the back of this container, and returns the unique index for thing. More...
 
const std::vector< const T * > & vector () const
 Returns a vector of all elements added to this container. More...
 

Constructor & Destructor Documentation

◆ UniqueIndexer()

UniqueIndexer ( )
default

Creates an empty UniqueIndexer.

Member Function Documentation

◆ push_back()

int push_back ( const T &  thing)

Pushes thing onto the back of this container, and returns the unique index for thing.

If thing has already been added to the container, then this simply returns the original index for thing.

◆ vector()

const std::vector<const T*>& vector ( ) const

Returns a vector of all elements added to this container.

The index of any element in the vector equals the index generated when the element was added to the container.


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