SST  13.0.0
StructuralSimulationToolkit
SST::SparseVectorMap< keyT, keyT > Class Template Reference

Templated version of SparseVectorMap where the data and key are the same (actually more like a set than a map in this case). More...

#include <sparseVectorMap.h>

Public Types

typedef std::vector< keyT >::iterator iterator
 
typedef std::vector< keyT >::const_iterator const_iterator
 

Public Member Functions

 SparseVectorMap ()
 Default constructor for SparseVectorMap.
 
 SparseVectorMap (std::vector< keyT > &new_data, bool sorted=false)
 Constructor that allows you to pass an already filled in array with data. More...
 
keyT & insert (const keyT &val)
 Insert new value into SparseVectorMap. More...
 
iterator begin ()
 Returns the begin iterator to the underlying vector. More...
 
iterator end ()
 Returns the end iterator to the underlying vector. More...
 
const_iterator begin () const
 Returns the const begin iterator to the underlying vector. More...
 
const_iterator end () const
 Returns the const end iterator to the underlying vector. More...
 
bool contains (keyT id)
 Checks if the provided id is found in the SparseVectorMap. More...
 
keyT & operator[] (keyT id)
 Operator returns a reference to data with the specified id. More...
 
const keyT & operator[] (keyT id) const
 Operator returns a const reference to data with the specified id. More...
 
void clear ()
 Clears the contents of the SparseVectorMap.
 
size_t size ()
 Returns the number of items in the SparseVectorMap. More...
 

Friends

class SST::Core::Serialization::serialize< SparseVectorMap< keyT, keyT > >
 
class ConfigGraph
 

Detailed Description

template<typename keyT>
class SST::SparseVectorMap< keyT, keyT >

Templated version of SparseVectorMap where the data and key are the same (actually more like a set than a map in this case).

The type must implement the less than operator. This is primarily intended for use with native types.

Constructor & Destructor Documentation

◆ SparseVectorMap()

template<typename keyT >
SST::SparseVectorMap< keyT, keyT >::SparseVectorMap ( std::vector< keyT > &  new_data,
bool  sorted = false 
)
inline

Constructor that allows you to pass an already filled in array with data.

The data in the passed in vector will be swapped into the data vector of the SparseVectorMap and the passed in vector will be empty.

Parameters
new_dataVector of data to swap into the SparseVectorMap data
sortedSpecifies whether the vector is already sorted in ascending order. If not, it will be sorted after swapping the data in.

Member Function Documentation

◆ begin() [1/2]

template<typename keyT >
iterator SST::SparseVectorMap< keyT, keyT >::begin ( )
inline

Returns the begin iterator to the underlying vector.

Returns
begin iterator to data vector

◆ begin() [2/2]

template<typename keyT >
const_iterator SST::SparseVectorMap< keyT, keyT >::begin ( ) const
inline

Returns the const begin iterator to the underlying vector.

Returns
const begin iterator to data vector

◆ contains()

template<typename keyT >
bool SST::SparseVectorMap< keyT, keyT >::contains ( keyT  id)
inline

Checks if the provided id is found in the SparseVectorMap.

Parameters
idid to check for
Returns
true if id is found, false otherwise

◆ end() [1/2]

template<typename keyT >
iterator SST::SparseVectorMap< keyT, keyT >::end ( )
inline

Returns the end iterator to the underlying vector.

Returns
end iterator to data vector

◆ end() [2/2]

template<typename keyT >
const_iterator SST::SparseVectorMap< keyT, keyT >::end ( ) const
inline

Returns the const end iterator to the underlying vector.

Returns
const end iterator to data vector

◆ insert()

template<typename keyT >
keyT& SST::SparseVectorMap< keyT, keyT >::insert ( const keyT &  val)
inline

Insert new value into SparseVectorMap.

The inserted class must have a key() function with return type keyT.

Parameters
valvalue to add to SparseVectorMap
Returns
reference to the inserted item, or to the existing item if it was already present in the map.

◆ operator[]() [1/2]

template<typename keyT >
keyT& SST::SparseVectorMap< keyT, keyT >::operator[] ( keyT  id)
inline

Operator returns a reference to data with the specified id.

Value can be modified. This will only return references to existing values, you must use insert() for new values.

Parameters
idid of the value to return (value returned by key())
Returns
reference to the requested item.

◆ operator[]() [2/2]

template<typename keyT >
const keyT& SST::SparseVectorMap< keyT, keyT >::operator[] ( keyT  id) const
inline

Operator returns a const reference to data with the specified id.

Value cannot be modified. This will only return references to existing values, you must use insert() for new values.

Parameters
idid of the value to return (value returned by key())
Returns
const reference to the requested item.

◆ size()

template<typename keyT >
size_t SST::SparseVectorMap< keyT, keyT >::size ( )
inline

Returns the number of items in the SparseVectorMap.

Returns
number of items

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