Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
zserio::ArrayView< T, ARRAY_TRAITS > Class Template Reference

#include <ArrayView.h>

Classes

class  ConstIterator
 

Public Types

using ValueType = std::remove_cv_t< T >
 
using Traits = ARRAY_TRAITS
 
using ConstReverseIterator = std::reverse_iterator< ConstIterator >
 
using OwnerType = detail::array_owner_type_t< Traits >
 

Public Member Functions

template<typename OWNER_TYPE_ = OwnerType, std::enable_if_t< detail::is_dummy_array_owner_v< OWNER_TYPE_ >, int > = 0>
 ArrayView (Span< T > data)
 
template<typename OWNER_TYPE_ = OwnerType, std::enable_if_t<!detail::is_dummy_array_owner_v< OWNER_TYPE_ >, int > = 0>
 ArrayView (Span< T > data, const OwnerType &owner)
 
bool operator== (const ArrayView &other) const
 
bool operator< (const ArrayView &other) const
 
bool operator!= (const ArrayView &other) const
 
bool operator> (const ArrayView &other) const
 
bool operator<= (const ArrayView &other) const
 
bool operator>= (const ArrayView &other) const
 
size_t size () const
 
bool empty () const
 
decltype(auto) at (size_t index) const
 
decltype(auto) operator[] (size_t index) const
 
decltype(auto) front () const
 
decltype(auto) back () const
 
 ~ArrayView ()=default
 
 ArrayView (const ArrayView &other)=default
 
ArrayViewoperator= (const ArrayView &other)=default
 
 ArrayView (ArrayView &&other)=default
 
ArrayViewoperator= (ArrayView &&other)=default
 
Span< T > zserioData () const
 
ConstIterator cbegin () const noexcept
 
ConstIterator begin () const noexcept
 
ConstIterator cend () const noexcept
 
ConstIterator end () const noexcept
 
ConstReverseIterator crbegin () const noexcept
 
ConstReverseIterator rbegin () const noexcept
 
ConstReverseIterator crend () const noexcept
 
ConstReverseIterator rend () const noexcept
 

Detailed Description

template<typename T, typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
class zserio::ArrayView< T, ARRAY_TRAITS >

Definition at line 34 of file ArrayView.h.

Member Typedef Documentation

◆ ConstReverseIterator

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
using zserio::ArrayView< T, ARRAY_TRAITS >::ConstReverseIterator = std::reverse_iterator<ConstIterator>

Definition at line 46 of file ArrayView.h.

◆ OwnerType

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
using zserio::ArrayView< T, ARRAY_TRAITS >::OwnerType = detail::array_owner_type_t<Traits>

Typedef for the array's owner type.

Owner type is needed for proper expressions evaluation. If no owner is needed for expressions evaluation, detail::DummyArrayOwner is used.

Definition at line 54 of file ArrayView.h.

◆ Traits

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
using zserio::ArrayView< T, ARRAY_TRAITS >::Traits = ARRAY_TRAITS

Typedef for the array traits.

Definition at line 41 of file ArrayView.h.

◆ ValueType

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
using zserio::ArrayView< T, ARRAY_TRAITS >::ValueType = std::remove_cv_t<T>

Typedef for the value type.

Definition at line 38 of file ArrayView.h.

Constructor & Destructor Documentation

◆ ArrayView() [1/4]

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
template<typename OWNER_TYPE_ = OwnerType, std::enable_if_t< detail::is_dummy_array_owner_v< OWNER_TYPE_ >, int > = 0>
zserio::ArrayView< T, ARRAY_TRAITS >::ArrayView ( Span< T >  data)
inlineexplicit

Constructor from l-value raw array.

Parameters
rawArrayRaw array.

Definition at line 63 of file ArrayView.h.

◆ ArrayView() [2/4]

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
template<typename OWNER_TYPE_ = OwnerType, std::enable_if_t<!detail::is_dummy_array_owner_v< OWNER_TYPE_ >, int > = 0>
zserio::ArrayView< T, ARRAY_TRAITS >::ArrayView ( Span< T >  data,
const OwnerType owner 
)
inlineexplicit

Constructor from l-value raw array.

Parameters
rawArrayRaw array.
ownerView to the array's owner.

Definition at line 75 of file ArrayView.h.

◆ ~ArrayView()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
zserio::ArrayView< T, ARRAY_TRAITS >::~ArrayView ( )
default

Method generated by default.

◆ ArrayView() [3/4]

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
zserio::ArrayView< T, ARRAY_TRAITS >::ArrayView ( const ArrayView< T, ARRAY_TRAITS > &  other)
default

Method generated by default.

◆ ArrayView() [4/4]

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
zserio::ArrayView< T, ARRAY_TRAITS >::ArrayView ( ArrayView< T, ARRAY_TRAITS > &&  other)
default

Method generated by default.

Member Function Documentation

◆ at()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
decltype(auto) zserio::ArrayView< T, ARRAY_TRAITS >::at ( size_t  index) const
inline

Returns element view at the given index.

Parameters
indexElement index.
Returns
View to the specified element.

Definition at line 235 of file ArrayView.h.

◆ back()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
decltype(auto) zserio::ArrayView< T, ARRAY_TRAITS >::back ( ) const
inline

Returns element view for the last element in container.

Returns
View to the last element.

Definition at line 273 of file ArrayView.h.

◆ begin()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstIterator zserio::ArrayView< T, ARRAY_TRAITS >::begin ( ) const
inlinenoexcept

Returns an constant iterator to the beginning.

Returns
Constant iterator to the beginning.

Definition at line 289 of file ArrayView.h.

◆ cbegin()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstIterator zserio::ArrayView< T, ARRAY_TRAITS >::cbegin ( ) const
inlinenoexcept

Returns an constant iterator to the beginning.

Returns
Constant iterator to the beginning.

Definition at line 284 of file ArrayView.h.

◆ cend()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstIterator zserio::ArrayView< T, ARRAY_TRAITS >::cend ( ) const
inlinenoexcept

Returns and constant iterator to the end.

Returns
Constant iterator to the end.

Definition at line 301 of file ArrayView.h.

◆ crbegin()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstReverseIterator zserio::ArrayView< T, ARRAY_TRAITS >::crbegin ( ) const
inlinenoexcept

Returns an constant reverse iterator to the beginning of the reversed array.

Returns
Constant reverse iterator to the beginning of the reversed array.

Definition at line 318 of file ArrayView.h.

◆ crend()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstReverseIterator zserio::ArrayView< T, ARRAY_TRAITS >::crend ( ) const
inlinenoexcept

Returns an constant reverse iterator to the end of the reversed array.

Returns
Constant reverse iterator to the end of the reversed array.

Definition at line 335 of file ArrayView.h.

◆ empty()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::empty ( ) const
inline

Gets whether the array is empty.

Returns
True when the array is empty, false otherwise.

Definition at line 224 of file ArrayView.h.

◆ end()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstIterator zserio::ArrayView< T, ARRAY_TRAITS >::end ( ) const
inlinenoexcept

Returns and constant iterator to the end.

Returns
Constant iterator to the end.

Definition at line 306 of file ArrayView.h.

◆ front()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
decltype(auto) zserio::ArrayView< T, ARRAY_TRAITS >::front ( ) const
inline

Returns element view for the first element in container.

Returns
View to the first element.

Definition at line 263 of file ArrayView.h.

◆ operator!=()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::operator!= ( const ArrayView< T, ARRAY_TRAITS > &  other) const
inline

Operator inequality.

Parameters
otherArrayView to compare.
Returns
True when the arrays have different contents, false otherwise.

Definition at line 168 of file ArrayView.h.

◆ operator<()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::operator< ( const ArrayView< T, ARRAY_TRAITS > &  other) const
inline

Operator less than.

Parameters
otherArrayView to compare.
Returns
True when this array is less than the other array, false otherwise.

Definition at line 140 of file ArrayView.h.

◆ operator<=()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::operator<= ( const ArrayView< T, ARRAY_TRAITS > &  other) const
inline

Operator less than or equal.

Parameters
otherArrayView to compare.
Returns
True when this arrays is less than or equal to the other array, false otherwise.

Definition at line 192 of file ArrayView.h.

◆ operator=() [1/2]

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ArrayView& zserio::ArrayView< T, ARRAY_TRAITS >::operator= ( ArrayView< T, ARRAY_TRAITS > &&  other)
default

Method generated by default.

◆ operator=() [2/2]

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ArrayView& zserio::ArrayView< T, ARRAY_TRAITS >::operator= ( const ArrayView< T, ARRAY_TRAITS > &  other)
default

Method generated by default.

◆ operator==()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::operator== ( const ArrayView< T, ARRAY_TRAITS > &  other) const
inline

Operator equality.

Parameters
otherArrayView to compare.
Returns
True when the underlying raw arrays have same contents, false otherwise.

Definition at line 113 of file ArrayView.h.

◆ operator>()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::operator> ( const ArrayView< T, ARRAY_TRAITS > &  other) const
inline

Operator greater than.

Parameters
otherArrayView to compare.
Returns
True when this arrays is greater than the other array, false otherwise.

Definition at line 180 of file ArrayView.h.

◆ operator>=()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
bool zserio::ArrayView< T, ARRAY_TRAITS >::operator>= ( const ArrayView< T, ARRAY_TRAITS > &  other) const
inline

Operator greater than or equal.

Parameters
otherArrayView to compare.
Returns
True when this arrays is greater than or equal to the other array, false otherwise.

Definition at line 204 of file ArrayView.h.

◆ operator[]()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
decltype(auto) zserio::ArrayView< T, ARRAY_TRAITS >::operator[] ( size_t  index) const
inline

Returns element view at the given index. Like STL vector's operator[] this is does not check the array size.

Parameters
indexElement index.
Returns
View to the specified element.

Definition at line 253 of file ArrayView.h.

◆ rbegin()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstReverseIterator zserio::ArrayView< T, ARRAY_TRAITS >::rbegin ( ) const
inlinenoexcept

Returns an constant reverse iterator to the beginning of the reversed array.

Returns
Constant reverse iterator to the beginning of the reversed array.

Definition at line 323 of file ArrayView.h.

◆ rend()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
ConstReverseIterator zserio::ArrayView< T, ARRAY_TRAITS >::rend ( ) const
inlinenoexcept

Returns an constant reverse iterator to the end of the reversed array.

Returns
Constant reverse iterator to the end of the reversed array.

Definition at line 340 of file ArrayView.h.

◆ size()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
size_t zserio::ArrayView< T, ARRAY_TRAITS >::size ( ) const
inline

Gets length of the array.

Returns
Length of the array.

Definition at line 214 of file ArrayView.h.

◆ zserioData()

template<typename T , typename ARRAY_TRAITS = ArrayTraits<std::remove_cv_t<T>>>
Span<T> zserio::ArrayView< T, ARRAY_TRAITS >::zserioData ( ) const
inline

Gets underlying raw data array.

Returns
Reference to underlying data array.

Definition at line 100 of file ArrayView.h.


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