Rumba C++ SDK
maquina::SpanSpan< TIndex, TValue > Class Template Reference

A view on a "vector of sub-vectors of values" container. More...

#include <SpanSpan.h>

Public Member Functions

 SpanSpan ()
 
 SpanSpan (const gsl::span< TIndex > &offsets, const gsl::span< TValue > &values)
 
size_t size () const
 Return the number of sub-vectors. More...
 
size_t length () const
 Return the total number of values. More...
 
const gsl::span< TValue > operator[] (size_t index) const
 Returns the i-th sub-vector. More...
 
const gsl::span< TIndex > & offsets () const
 Returns the offsets of each sub-vectors. More...
 
const gsl::span< TValue > & values () const
 Returns the concatenated values of all the sub-vectors. More...
 

Detailed Description

template<typename TIndex, typename TValue>
class maquina::SpanSpan< TIndex, TValue >

A view on a "vector of sub-vectors of values" container.

This view observes a container of type vector of sub-vectors of values. Those containers are composed of an offset vector and a value vector. The offset vector helds the offsets in the value vector of the first element of each sub-vector. The values vector contains the concatenated values of all the sub-vectors. Note that the offset vector must have a final additional entry needed to compute the size of the last sub-vector.

Constructor & Destructor Documentation

◆ SpanSpan() [1/2]

template<typename TIndex, typename TValue>
maquina::SpanSpan< TIndex, TValue >::SpanSpan ( )
inline

◆ SpanSpan() [2/2]

template<typename TIndex, typename TValue>
maquina::SpanSpan< TIndex, TValue >::SpanSpan ( const gsl::span< TIndex > &  offsets,
const gsl::span< TValue > &  values 
)
inline

Member Function Documentation

◆ length()

template<typename TIndex, typename TValue>
size_t maquina::SpanSpan< TIndex, TValue >::length ( ) const
inline

Return the total number of values.

◆ offsets()

template<typename TIndex, typename TValue>
const gsl::span<TIndex>& maquina::SpanSpan< TIndex, TValue >::offsets ( ) const
inline

Returns the offsets of each sub-vectors.

Note that this offset vector has one more extra entry. offsets.size() == size()+1.

◆ operator[]()

template<typename TIndex, typename TValue>
const gsl::span<TValue> maquina::SpanSpan< TIndex, TValue >::operator[] ( size_t  index) const
inline

Returns the i-th sub-vector.

◆ size()

template<typename TIndex, typename TValue>
size_t maquina::SpanSpan< TIndex, TValue >::size ( ) const
inline

Return the number of sub-vectors.

◆ values()

template<typename TIndex, typename TValue>
const gsl::span<TValue>& maquina::SpanSpan< TIndex, TValue >::values ( ) const
inline

Returns the concatenated values of all the sub-vectors.


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