Stride Reference Manual  - generated for commit 9643b11
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stride::util::SliceIndexer< T, Key > Class Template Reference

Datastructure to index a container (supporting RandomAccessIterators) with slices. More...

#include <SliceIndexer.h>

Collaboration diagram for stride::util::SliceIndexer< T, Key >:
Collaboration graph

Public Types

using range_type = boost::sliced_range< T >
 

Public Member Functions

 SliceIndexer (T &t)
 SliceIndexer holds a reference to the conatiner that it indexes. More...
 
range_typeGet (const Key &s)
 Retrieve reference to a range by its key. More...
 
const range_typeGet (const Key &s) const
 Retrieve const reference to a range by its Id. More...
 
const std::vector< range_type > & Get ()
 Retrieve all the ranges,. More...
 
range_typeSet (std::size_t ibegin, std::size_t iend, const Key &name)
 Set a range. Warning: range is [ibegin, iend) i.e. half-open, iend not included! More...
 
range_typeSet (std::size_t ibegin, const Key &name)
 Set a range, where the end is the end of the container. More...
 

Private Member Functions

void check (const Key &name)
 Check key map for duplicate; throw iff duplicate. More...
 

Private Attributes

std::map< Key, std::size_t > m_map
 Maps key values to subscripts. More...
 
std::vector< range_typem_slices
 Contains the slices. More...
 
T & m_t
 Refernec to container that gets sliced into ranges. More...
 

Detailed Description

template<typename T, typename Key = std::string>
class stride::util::SliceIndexer< T, Key >

Datastructure to index a container (supporting RandomAccessIterators) with slices.

We store those slices in order in a vector and expose the vector because processing effiency may dictate that we retrieve the in that order. They can also be retrieved by ket (key type defaults to std::string).

Template Parameters
TType of the container in whom the ranges are indexed.
KeyType of Id that can be useld to retrieve the ranges.

Definition at line 39 of file SliceIndexer.h.

Member Typedef Documentation

template<typename T , typename Key = std::string>
using stride::util::SliceIndexer< T, Key >::range_type = boost::sliced_range<T>

Definition at line 42 of file SliceIndexer.h.

Constructor & Destructor Documentation

template<typename T , typename Key = std::string>
stride::util::SliceIndexer< T, Key >::SliceIndexer ( T &  t)
inlineexplicit

SliceIndexer holds a reference to the conatiner that it indexes.

Definition at line 46 of file SliceIndexer.h.

Member Function Documentation

template<typename T , typename Key = std::string>
range_type& stride::util::SliceIndexer< T, Key >::Get ( const Key &  s)
inline

Retrieve reference to a range by its key.

Definition at line 49 of file SliceIndexer.h.

References stride::util::SliceIndexer< T, Key >::m_map, and stride::util::SliceIndexer< T, Key >::m_slices.

template<typename T , typename Key = std::string>
const range_type& stride::util::SliceIndexer< T, Key >::Get ( const Key &  s) const
inline

Retrieve const reference to a range by its Id.

Definition at line 52 of file SliceIndexer.h.

References stride::util::SliceIndexer< T, Key >::m_map, and stride::util::SliceIndexer< T, Key >::m_slices.

template<typename T , typename Key = std::string>
const std::vector<range_type>& stride::util::SliceIndexer< T, Key >::Get ( )
inline

Retrieve all the ranges,.

Definition at line 55 of file SliceIndexer.h.

References stride::util::SliceIndexer< T, Key >::m_slices.

template<typename T , typename Key = std::string>
range_type& stride::util::SliceIndexer< T, Key >::Set ( std::size_t  ibegin,
std::size_t  iend,
const Key &  name 
)
inline

Set a range. Warning: range is [ibegin, iend) i.e. half-open, iend not included!

Definition at line 58 of file SliceIndexer.h.

References stride::util::SliceIndexer< T, Key >::check(), stride::util::SliceIndexer< T, Key >::m_map, stride::util::SliceIndexer< T, Key >::m_slices, and stride::util::SliceIndexer< T, Key >::m_t.

Here is the call graph for this function:

template<typename T , typename Key = std::string>
range_type& stride::util::SliceIndexer< T, Key >::Set ( std::size_t  ibegin,
const Key &  name 
)
inline

Set a range, where the end is the end of the container.

Definition at line 68 of file SliceIndexer.h.

References stride::util::SliceIndexer< T, Key >::check(), stride::util::SliceIndexer< T, Key >::m_map, stride::util::SliceIndexer< T, Key >::m_slices, and stride::util::SliceIndexer< T, Key >::m_t.

Here is the call graph for this function:

template<typename T , typename Key = std::string>
void stride::util::SliceIndexer< T, Key >::check ( const Key &  name)
inlineprivate

Check key map for duplicate; throw iff duplicate.

Definition at line 79 of file SliceIndexer.h.

References stride::util::SliceIndexer< T, Key >::m_map.

Referenced by stride::util::SliceIndexer< T, Key >::Set().

Here is the caller graph for this function:

Member Data Documentation

template<typename T , typename Key = std::string>
std::map<Key, std::size_t> stride::util::SliceIndexer< T, Key >::m_map
private
template<typename T , typename Key = std::string>
std::vector<range_type> stride::util::SliceIndexer< T, Key >::m_slices
private

Contains the slices.

Definition at line 88 of file SliceIndexer.h.

Referenced by stride::util::SliceIndexer< T, Key >::Get(), and stride::util::SliceIndexer< T, Key >::Set().

template<typename T , typename Key = std::string>
T& stride::util::SliceIndexer< T, Key >::m_t
private

Refernec to container that gets sliced into ranges.

Definition at line 89 of file SliceIndexer.h.

Referenced by stride::util::SliceIndexer< T, Key >::Set().


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