helib::IndexMap< T > Class Template Reference

IndexMap<T> implements a generic map indexed by a dynamic index set. More...

#include <IndexMap.h>

Public Member Functions

 IndexMap ()
 The empty map. More...
 
 IndexMap (IndexMapInit< T > *_init)
 A map with an initialization object. This associates a method for initializing new elements in the map. When a new index j is added to the index set, an object t of type T is created using the default constructor for T, after which the function _init->init(t) is called (t is passed by reference). To use this feature, you need to derive a subclass of IndexMapInit<T> that defines the init function. This "helper object" should be created using operator new, and the pointer is "exclusively owned" by the map object. More...
 
const IndexSet & getIndexSet () const
 Get the underlying index set. More...
 
T & operator[] (long j)
 Access functions: will raise an error if j does not belong to the current index set. More...
 
const T & operator[] (long j) const
 
void insert (long j)
 Insert indexes to the IndexSet. Insertion will cause new T objects to be created, using the default constructor, and possibly initialized via the IndexMapInit<T> pointer. More...
 
void insert (const IndexSet &s)
 
void remove (long j)
 Delete indexes from IndexSet, may cause objects to be destroyed. More...
 
void remove (const IndexSet &s)
 
void clear ()
 

Detailed Description

template<typename T>
class helib::IndexMap< T >

IndexMap<T> implements a generic map indexed by a dynamic index set.

Additionally, it allows new elements of the map to be initialized in a flexible manner.

Constructor & Destructor Documentation

◆ IndexMap() [1/2]

template<typename T >
helib::IndexMap< T >::IndexMap ( )

The empty map.

◆ IndexMap() [2/2]

template<typename T >
helib::IndexMap< T >::IndexMap ( IndexMapInit< T > *  _init)
inlineexplicit

A map with an initialization object. This associates a method for initializing new elements in the map. When a new index j is added to the index set, an object t of type T is created using the default constructor for T, after which the function _init->init(t) is called (t is passed by reference). To use this feature, you need to derive a subclass of IndexMapInit<T> that defines the init function. This "helper object" should be created using operator new, and the pointer is "exclusively owned" by the map object.

Member Function Documentation

◆ clear()

template<typename T >
void helib::IndexMap< T >::clear ( )
inline

◆ getIndexSet()

template<typename T >
const IndexSet& helib::IndexMap< T >::getIndexSet ( ) const
inline

Get the underlying index set.

◆ insert() [1/2]

template<typename T >
void helib::IndexMap< T >::insert ( const IndexSet &  s)
inline

◆ insert() [2/2]

template<typename T >
void helib::IndexMap< T >::insert ( long  j)
inline

Insert indexes to the IndexSet. Insertion will cause new T objects to be created, using the default constructor, and possibly initialized via the IndexMapInit<T> pointer.

◆ operator[]() [1/2]

template<typename T >
T& helib::IndexMap< T >::operator[] ( long  j)
inline

Access functions: will raise an error if j does not belong to the current index set.

◆ operator[]() [2/2]

template<typename T >
const T& helib::IndexMap< T >::operator[] ( long  j) const
inline

◆ remove() [1/2]

template<typename T >
void helib::IndexMap< T >::remove ( const IndexSet &  s)
inline

◆ remove() [2/2]

template<typename T >
void helib::IndexMap< T >::remove ( long  j)
inline

Delete indexes from IndexSet, may cause objects to be destroyed.