Documentation 6b54b78464
Loading...
Searching...
No Matches
helpers::IndexAccumulator< N_, Nd_t_, Check > Class Template Reference

Data structure holding an offset for the NdFlattener, to provide a []...[]-interface. More...

#include <ndflattener.hpp>

Inheritance diagram for helpers::IndexAccumulator< N_, Nd_t_, Check >:
[legend]

Public Types

using Base = IndexAccumulator_Base< N_, Nd_t_, Check >
 
using Nd_t = Nd_t_
 
using Index_t = typename Nd_t::Index_t
 
using Nd_Base_t = su2conditional_t< std::is_const< Nd_t >::value, const typename Nd_t::Base, typename Nd_t::Base >
 
using LookupType = IndexAccumulator< N - 1, Nd_Base_t >
 
using LookupType_const = IndexAccumulator< N - 1, const typename Nd_t::Base >
 
- Public Types inherited from helpers::IndexAccumulator_Base< N_, Nd_t_, Check >
using Nd_t = Nd_t_
 
using Index_t = typename Nd_t::Index_t
 

Public Member Functions

 IndexAccumulator (Nd_t &nd, Index_t offset, Index_t size)
 
LookupType operator[] (Index_t i)
 Read one more index, checking whether it is in the range dictated by the NdFlattener and previous indices. Non-const version.
 
LookupType_const operator[] (Index_t i) const
 Read one more index, const version.
 
void CheckBound (Index_t i) const
 
Index_t size () const
 Return exclusive upper bound for next index.
 
- Public Member Functions inherited from helpers::IndexAccumulator_Base< N_, Nd_t_, Check >
Index_t size () const
 Return exclusive upper bound for next index.
 

Public Attributes

Nd_t & nd
 The accessed NdFlattener.
 
const Index_t offset
 Index in the currently accessed layer.
 

Static Public Attributes

static constexpr size_t N = N_
 
- Static Public Attributes inherited from helpers::IndexAccumulator_Base< N_, Nd_t_, Check >
static constexpr size_t N = N_
 

Additional Inherited Members

- Protected Member Functions inherited from helpers::IndexAccumulator_Base< N_, Nd_t_, Check >
 IndexAccumulator_Base (Nd_t &nd, Index_t offset, Index_t size)
 
void CheckBound (Index_t i) const
 
- Protected Attributes inherited from helpers::IndexAccumulator_Base< N_, Nd_t_, Check >
Nd_t & nd
 The accessed NdFlattener.
 
const Index_t offset
 Index in the currently accessed layer.
 
const Index_t size_
 Exclusive upper bound for the next index.
 

Detailed Description

template<size_t N_, typename Nd_t_, bool Check = false>
class helpers::IndexAccumulator< N_, Nd_t_, Check >

Data structure holding an offset for the NdFlattener, to provide a []...[]-interface.

Derived from IndexAccumulator_Base, specifying the operator[] method:

  • For N==1, the structure has already read all indices but one. So after this method has read the last index, return a (possibly const) reference to the data. An additional function data() should be provided.
  • For N>1, more indices have to be read, return an IndexAccumulator<N-1,Nd_t_lower>. Nd_t_lower is the NdFlattener type with one index less. Nd_t_lower is const-qualified if Nd_t is const-qualified, or if the index look-up is performed in a const IndexAccumulator.
    Template Parameters
    N- Number of missing parameters
    Nd_t- Type of the accessed NdFlattener, should be NdFlattener<N,...>
    Check- if true, raise error if index to operator[] is not in range

Member Typedef Documentation

◆ Base

template<size_t N_, typename Nd_t_ , bool Check = false>
using helpers::IndexAccumulator< N_, Nd_t_, Check >::Base = IndexAccumulator_Base<N_, Nd_t_, Check>

◆ Index_t

template<size_t N_, typename Nd_t_ , bool Check = false>
using helpers::IndexAccumulator< N_, Nd_t_, Check >::Index_t = typename Nd_t::Index_t

◆ LookupType

template<size_t N_, typename Nd_t_ , bool Check = false>
using helpers::IndexAccumulator< N_, Nd_t_, Check >::LookupType = IndexAccumulator<N - 1, Nd_Base_t>

Return type of operator[].

◆ LookupType_const

template<size_t N_, typename Nd_t_ , bool Check = false>
using helpers::IndexAccumulator< N_, Nd_t_, Check >::LookupType_const = IndexAccumulator<N - 1, const typename Nd_t::Base>

Return type of operator[] const.

◆ Nd_Base_t

template<size_t N_, typename Nd_t_ , bool Check = false>
using helpers::IndexAccumulator< N_, Nd_t_, Check >::Nd_Base_t = su2conditional_t<std::is_const<Nd_t>::value, const typename Nd_t::Base, typename Nd_t::Base>

The Base of NdFlattener<K> is NdFlattener<K-1>, but do also preserve constness.

◆ Nd_t

template<size_t N_, typename Nd_t_ , bool Check = false>
using helpers::IndexAccumulator< N_, Nd_t_, Check >::Nd_t = Nd_t_

Constructor & Destructor Documentation

◆ IndexAccumulator()

template<size_t N_, typename Nd_t_ , bool Check = false>
helpers::IndexAccumulator< N_, Nd_t_, Check >::IndexAccumulator ( Nd_t &  nd,
Index_t  offset,
Index_t  size 
)
inline

Member Function Documentation

◆ CheckBound()

template<size_t N_, typename Nd_t_ , bool Check = false>
void helpers::IndexAccumulator_Base< N_, Nd_t_, Check >::CheckBound ( Index_t  i) const
inline

◆ operator[]() [1/2]

template<size_t N_, typename Nd_t_ , bool Check = false>
LookupType helpers::IndexAccumulator< N_, Nd_t_, Check >::operator[] ( Index_t  i)
inline

Read one more index, checking whether it is in the range dictated by the NdFlattener and previous indices. Non-const version.

Parameters
[in]i- Index.

◆ operator[]() [2/2]

template<size_t N_, typename Nd_t_ , bool Check = false>
LookupType_const helpers::IndexAccumulator< N_, Nd_t_, Check >::operator[] ( Index_t  i) const
inline

Read one more index, const version.

Parameters
[in]i- Index.

◆ size()

template<size_t N_, typename Nd_t_ , bool Check = false>
Index_t helpers::IndexAccumulator_Base< N_, Nd_t_, Check >::size ( ) const
inline

Return exclusive upper bound for next index.

Member Data Documentation

◆ N

template<size_t N_, typename Nd_t_ , bool Check = false>
constexpr size_t helpers::IndexAccumulator< N_, Nd_t_, Check >::N = N_
staticconstexpr

◆ nd

template<size_t N_, typename Nd_t_ , bool Check = false>
Nd_t& helpers::IndexAccumulator_Base< N_, Nd_t_, Check >::nd

The accessed NdFlattener.

◆ offset

template<size_t N_, typename Nd_t_ , bool Check = false>
const Index_t helpers::IndexAccumulator_Base< N_, Nd_t_, Check >::offset

Index in the currently accessed layer.


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