LLVM  6.0.0svn
Public Types | Public Member Functions | List of all members
llvm::UniqueVector< T > Class Template Reference

UniqueVector - This class produces a sequential ID number (base 1) for each unique entry that is added. More...

#include "llvm/ADT/UniqueVector.h"

Inheritance diagram for llvm::UniqueVector< T >:
Inheritance graph
[legend]

Public Types

using VectorType = typename std::vector< T >
 
using iterator = typename VectorType::iterator
 
using const_iterator = typename VectorType::const_iterator
 

Public Member Functions

unsigned insert (const T &Entry)
 insert - Append entry to the vector if it doesn't already exist. More...
 
unsigned idFor (const T &Entry) const
 idFor - return the ID for an existing entry. More...
 
const Toperator[] (unsigned ID) const
 operator[] - Returns a reference to the entry with the specified ID. More...
 
iterator begin ()
 Return an iterator to the start of the vector. More...
 
const_iterator begin () const
 Return an iterator to the start of the vector. More...
 
iterator end ()
 Return an iterator to the end of the vector. More...
 
const_iterator end () const
 Return an iterator to the end of the vector. More...
 
size_t size () const
 size - Returns the number of entries in the vector. More...
 
bool empty () const
 empty - Returns true if the vector is empty. More...
 
void reset ()
 reset - Clears all the entries. More...
 

Detailed Description

template<class T>
class llvm::UniqueVector< T >

UniqueVector - This class produces a sequential ID number (base 1) for each unique entry that is added.

T is the type of entries in the vector. This class should have an implementation of operator== and of operator<. Entries can be fetched using operator[] with the entry ID.

Definition at line 25 of file UniqueVector.h.

Member Typedef Documentation

◆ const_iterator

template<class T>
using llvm::UniqueVector< T >::const_iterator = typename VectorType::const_iterator

Definition at line 29 of file UniqueVector.h.

◆ iterator

template<class T>
using llvm::UniqueVector< T >::iterator = typename VectorType::iterator

Definition at line 28 of file UniqueVector.h.

◆ VectorType

template<class T>
using llvm::UniqueVector< T >::VectorType = typename std::vector<T>

Definition at line 27 of file UniqueVector.h.

Member Function Documentation

◆ begin() [1/2]

template<class T>
iterator llvm::UniqueVector< T >::begin ( )
inline

Return an iterator to the start of the vector.

Definition at line 76 of file UniqueVector.h.

Referenced by llvm::DebugCounter::begin().

◆ begin() [2/2]

template<class T>
const_iterator llvm::UniqueVector< T >::begin ( ) const
inline

Return an iterator to the start of the vector.

Definition at line 79 of file UniqueVector.h.

◆ empty()

template<class T>
bool llvm::UniqueVector< T >::empty ( ) const
inline

empty - Returns true if the vector is empty.

Definition at line 91 of file UniqueVector.h.

Referenced by shouldKeepInEntry().

◆ end() [1/2]

template<class T>
iterator llvm::UniqueVector< T >::end ( )
inline

Return an iterator to the end of the vector.

Definition at line 82 of file UniqueVector.h.

Referenced by llvm::DebugCounter::end().

◆ end() [2/2]

template<class T>
const_iterator llvm::UniqueVector< T >::end ( ) const
inline

Return an iterator to the end of the vector.

Definition at line 85 of file UniqueVector.h.

◆ idFor()

template<class T>
unsigned llvm::UniqueVector< T >::idFor ( const T Entry) const
inline

idFor - return the ID for an existing entry.

Returns 0 if the entry is not found.

Definition at line 58 of file UniqueVector.h.

Referenced by llvm::ValueEnumerator::getComdatID(), llvm::DebugCounter::getCounterId(), and shouldKeepInEntry().

◆ insert()

template<class T>
unsigned llvm::UniqueVector< T >::insert ( const T Entry)
inline

insert - Append entry to the vector if it doesn't already exist.

Returns the entry's index + 1 to be used as a unique ID.

Definition at line 41 of file UniqueVector.h.

Referenced by llvm::DebugCounter::end(), getMetadataTypeOrder(), and shouldKeepInEntry().

◆ operator[]()

template<class T>
const T& llvm::UniqueVector< T >::operator[] ( unsigned  ID) const
inline

operator[] - Returns a reference to the entry with the specified ID.

Definition at line 70 of file UniqueVector.h.

◆ reset()

template<class T>
void llvm::UniqueVector< T >::reset ( )
inline

reset - Clears all the entries.

Definition at line 94 of file UniqueVector.h.

◆ size()

template<class T>
size_t llvm::UniqueVector< T >::size ( ) const
inline

size - Returns the number of entries in the vector.

Definition at line 88 of file UniqueVector.h.

Referenced by llvm::DebugCounter::getNumCounters(), llvm::UniqueVector< std::string >::operator[](), and shouldKeepInEntry().


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