Ocean
Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex > Class Template Reference

This class implements an indexed-based constant accessor providing access to a subset of elements stored in a specified indexed-based child accessor. More...

Inheritance diagram for Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >:

Public Member Functions

 ConstIndexedAccessorSubsetAccessor (const ConstIndexedAccessor< T > &child, const TIndex *subsetIndices, const size_t subsetSize)
 Creates a new accessor which uses an accessor as base. More...
 
 ConstIndexedAccessorSubsetAccessor (const ConstIndexedAccessor< T > &child, const std::vector< TIndex > &subsetIndices)
 Creates a new accessor which uses an accessor as base. More...
 
virtual size_t size () const
 Returns the number of accessible elements of this accessor object. More...
 
virtual const T & operator[] (const size_t &index) const
 Returns one element of this accessor object. More...
 
- Public Member Functions inherited from Ocean::ConstIndexedAccessor< T >
virtual bool canAccess (const size_t &index) const
 Returns whether this accessor has a specific element. More...
 
virtual bool firstElement (T &element, size_t &index) const
 Returns the first element of this accessor. More...
 
virtual bool nextElement (const size_t &previousIndex, T &nextElement, size_t &nextIndex) const
 Returns the next element which follows a given key of the previous element. More...
 
- Public Member Functions inherited from Ocean::ConstAccessor< T, size_t >
virtual const T * data () const
 Returns a pointer to the elements of this accessor if the data exists within one memory block without gaps. More...
 
- Public Member Functions inherited from Ocean::Accessor
virtual ~Accessor ()=default
 Default destructor. More...
 
bool isEmpty () const
 Returns whether this accessor provides no elements. More...
 

Protected Attributes

const ConstIndexedAccessor< T > & child_
 
const TIndex * subsetIndices_ = nullptr
 The subset indices of this accessor. More...
 
size_t subsetSize_ = 0
 The number of elements that can be accessed. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::ConstAccessor< T, size_t >
typedef T Type
 Definition of the element type of this accessor. More...
 
typedef size_t KeyType
 Definition of the key (or e.g., index) type of this accessor. More...
 
- Static Public Member Functions inherited from Ocean::Accessor
template<typename TAccessor >
static std::vector< typename TAccessor::Type > accessor2elements (const TAccessor &accessor)
 Returns all elements of a given accessor (as a block). More...
 
template<typename TAccessor >
static std::unordered_map< typename TAccessor::KeyType, typename TAccessor::Type > accessor2map (const TAccessor &accessor)
 Returns all elements of a given accessor as a map with key and elements. More...
 
template<typename TAccessor , typename TIndex >
static std::vector< typename TAccessor::Type > accessor2subsetElements (const TAccessor &accessor, const std::vector< TIndex > &subset)
 Returns a subset of all elements of a given accessor (as a block). More...
 
- Protected Member Functions inherited from Ocean::ConstIndexedAccessor< T >
 ConstIndexedAccessor ()=default
 Creates a new indexed-based accessor object. More...
 
- Protected Member Functions inherited from Ocean::ConstAccessor< T, size_t >
 ConstAccessor ()=default
 Protected default constructor. More...
 
- Protected Member Functions inherited from Ocean::Accessor
 Accessor ()=default
 Protected default constructor. More...
 
 Accessor (const Accessor &accessor)=default
 Protected copy constructor. More...
 
Accessoroperator= (const Accessor &accessor)=delete
 Deleted assign operator. More...
 

Detailed Description

template<typename T, typename TIndex>
class Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >

This class implements an indexed-based constant accessor providing access to a subset of elements stored in a specified indexed-based child accessor.

Template Parameters
TThe data type of the elements of the accessor
TIndexThe data type of the indices defining the subset of elements

Constructor & Destructor Documentation

◆ ConstIndexedAccessorSubsetAccessor() [1/2]

template<typename T , typename TIndex >
Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::ConstIndexedAccessorSubsetAccessor ( const ConstIndexedAccessor< T > &  child,
const TIndex *  subsetIndices,
const size_t  subsetSize 
)
inline

Creates a new accessor which uses an accessor as base.

Parameters
childThe child accessor
subsetIndicesThe indices that define a subset of the elements to be accessed, the maximal index must be smaller than the number of elements in the child accessor
subsetSizeThe number of indices (not the number of elements) that define the subset, may be 0 if indices is nullptr

◆ ConstIndexedAccessorSubsetAccessor() [2/2]

template<typename T , typename TIndex >
Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::ConstIndexedAccessorSubsetAccessor ( const ConstIndexedAccessor< T > &  child,
const std::vector< TIndex > &  subsetIndices 
)
inline

Creates a new accessor which uses an accessor as base.

Parameters
childThe child accessor
subsetIndicesThe indices that define a subset of the elements to be accessed, the maximal index must be smaller than the number of elements in the child accessor

Member Function Documentation

◆ operator[]()

template<typename T , typename TIndex >
const T & Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::operator[] ( const size_t &  index) const
virtual

Returns one element of this accessor object.

Parameters
indexThe index of element to be accessed, with range [0, size())
Returns
The requested element

Implements Ocean::ConstIndexedAccessor< T >.

◆ size()

template<typename T , typename TIndex >
size_t Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::size
virtual

Returns the number of accessible elements of this accessor object.

See also
Accessor::size().

Implements Ocean::Accessor.

Field Documentation

◆ child_

template<typename T , typename TIndex >
const ConstIndexedAccessor<T>& Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::child_
protected

◆ subsetIndices_

template<typename T , typename TIndex >
const TIndex* Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::subsetIndices_ = nullptr
protected

The subset indices of this accessor.

◆ subsetSize_

template<typename T , typename TIndex >
size_t Ocean::ConstIndexedAccessorSubsetAccessor< T, TIndex >::subsetSize_ = 0
protected

The number of elements that can be accessed.


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