Graphite  Version 3
An experimental 3D geometry processing program
GEOGen::small_set< T, DIM > Class Template Reference

Small_set is similar to std::set, but with fixed maximum size (and no dynamic memory allocation). More...

#include <geogram/voronoi/generic_RVD_vertex.h>

Public Types

typedef T * iterator
 A random access iterator to elements

 
typedef const T * const_iterator
 A random access iterator to const elements.
 
typedef T & reference
 Reference to element.
 
typedef T value_type
 Type of the elements.
 

Public Member Functions

 small_set ()
 Constructs an empty small_set.
 
index_t size () const
 Gets the number of element in this small_set.
 
index_t capacity () const
 Gets the maximum number of elements that can be stored in this small_set.
 
iterator begin ()
 Gets an iterator to the first element.
 
iterator end ()
 Gets an iterator one position past the last element.
 
iterator end_of_storage ()
 Gets an iterator one position past the last element that can be stored.
 
const_iterator begin () const
 Gets a const iterator to the first element..
 
const_iterator end () const
 Gets a const iterator one position past the last element.
 
const_iterator end_of_storage () const
 Gets a const iterator one position past the last element that can be stored.
 
iterator insert (const T &x)
 Insert a new element. More...
 
iterator insert (const T &x, iterator where)
 Inserts a new element at a specified location.. More...
 
void clear ()
 Clears this small_set.
 
iterator find (const T &x)
 Finds an element by value. More...
 
const_iterator find (const T &x) const
 Finds an element by value. More...
 
void push_back (const T &x)
 Appends an element to the end of the list. More...
 
void print (std::ostream &out) const
 Displays the stored elements.
 
T & operator[] (signed_index_t i)
 Direct access to an element. More...
 
const T & operator[] (signed_index_t i) const
 Direct access to an element. More...
 

Protected Member Functions

void grow ()
 Increases the size of this small_set. More...
 
iterator find_i (const T &x)
 Finds where an element is or where it should be inserted from its value. More...
 
const_iterator find_i (const T &x) const
 Finds where an element should be located from its value. More...
 

Protected Attributes

data_ [DIM]
 
index_t size_
 

Detailed Description

template<class T, index_t DIM>
class GEOGen::small_set< T, DIM >

Small_set is similar to std::set, but with fixed maximum size (and no dynamic memory allocation).

Used by GenericVoronoiDiagram to store vertices equations (represented as plane indices triplets).

Note
This is an internal implementation class, not meant to be used by client code.

Definition at line 79 of file generic_RVD_vertex.h.

Member Function Documentation

◆ find() [1/2]

template<class T , index_t DIM>
iterator GEOGen::small_set< T, DIM >::find ( const T &  x)
inline

Finds an element by value.

Parameters
[in]xa const reference to the value of the element
Returns
an iterator to the element or end() if not found

Definition at line 220 of file generic_RVD_vertex.h.

◆ find() [2/2]

template<class T , index_t DIM>
const_iterator GEOGen::small_set< T, DIM >::find ( const T &  x) const
inline

Finds an element by value.

Parameters
[in]xa const reference to the value of the element
Returns
a const iterator to the element or end() if not found

Definition at line 233 of file generic_RVD_vertex.h.

◆ find_i() [1/2]

template<class T , index_t DIM>
iterator GEOGen::small_set< T, DIM >::find_i ( const T &  x)
inlineprotected

Finds where an element is or where it should be inserted from its value.

Parameters
[in]xa const reference to the value of the element
Returns
an iterator to the location where the element should be found or inserted

Definition at line 309 of file generic_RVD_vertex.h.

◆ find_i() [2/2]

template<class T , index_t DIM>
const_iterator GEOGen::small_set< T, DIM >::find_i ( const T &  x) const
inlineprotected

Finds where an element should be located from its value.

Parameters
[in]xa const reference to the value of the element
Returns
a const iterator to the location where the element should be found.

Definition at line 323 of file generic_RVD_vertex.h.

◆ grow()

template<class T , index_t DIM>
void GEOGen::small_set< T, DIM >::grow ( )
inlineprotected

Increases the size of this small_set.

Cannot grow past the maximum size.

Definition at line 294 of file generic_RVD_vertex.h.

◆ insert() [1/2]

template<class T , index_t DIM>
iterator GEOGen::small_set< T, DIM >::insert ( const T &  x)
inline

Insert a new element.

Parameters
[in]xa const reference to the element to be inserted
Returns
an iterator to the inserted element
Note
Throws an assertion failure if maximum capacity is reached

Definition at line 169 of file generic_RVD_vertex.h.

◆ insert() [2/2]

template<class T , index_t DIM>
iterator GEOGen::small_set< T, DIM >::insert ( const T &  x,
iterator  where 
)
inline

Inserts a new element at a specified location..

Parameters
[in]xa const reference to the element to be inserted
[in]wherean iterator to the location where x should be inserted
Returns
an iterator to the inserted element (= where)
Note
Throws an assertion failure if maximum capacity is reached

Definition at line 181 of file generic_RVD_vertex.h.

◆ operator[]() [1/2]

template<class T , index_t DIM>
T& GEOGen::small_set< T, DIM >::operator[] ( signed_index_t  i)
inline

Direct access to an element.

Parameters
[in]iindex of the element
Returns
a reference to the element

Definition at line 272 of file generic_RVD_vertex.h.

◆ operator[]() [2/2]

template<class T , index_t DIM>
const T& GEOGen::small_set< T, DIM >::operator[] ( signed_index_t  i) const
inline

Direct access to an element.

Parameters
[in]iindex of the element
Returns
a const reference to the element

Definition at line 283 of file generic_RVD_vertex.h.

◆ push_back()

template<class T , index_t DIM>
void GEOGen::small_set< T, DIM >::push_back ( const T &  x)
inline

Appends an element to the end of the list.

Parameters
[in]xa const reference to the value of the element
Precondition
x is greater than all the stored elements

Definition at line 246 of file generic_RVD_vertex.h.


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