CatapultServer  v0.5.0.1 (Elephant)
catapult::utils::ByteArray< N, TTag > Class Template Reference

Base class for wrappers of byte array types, to provide some type-safety. More...

Inheritance diagram for catapult::utils::ByteArray< N, TTag >:
Collaboration diagram for catapult::utils::ByteArray< N, TTag >:

Public Types

using const_iterator = typename std::array< uint8_t, N >::const_iterator
 

Public Member Functions

constexpr ByteArray ()
 Creates a zero-initialized byte array. More...
 
constexpr ByteArray (const std::array< uint8_t, N > &array)
 Creates a byte array around array. More...
 
constexpr ByteArray (const ByteArray &rhs)
 Creates a copy of rhs. More...
 
ByteArrayoperator= (const ByteArray &rhs)
 Assigns rhs to this. More...
 
constexpr size_t size () const
 Returns the array size. More...
 
constexpr const uint8_t & operator[] (size_t index) const
 Returns a const reference to the byte at index. More...
 
constexpr uint8_t & operator[] (size_t index)
 Returns a reference to the byte at index. More...
 
constexpr const uint8_t * data () const noexcept
 Returns a const pointer to the underlying array. More...
 
constexpr uint8_t * data () noexcept
 Returns a pointer to the underlying array. More...
 
constexpr auto cbegin () const noexcept
 Returns a const iterator to the first byte. More...
 
constexpr auto cend () const noexcept
 Returns a const iterator to one past the last byte. More...
 
constexpr auto begin () const noexcept
 Returns a const iterator to the first byte. More...
 
constexpr auto end () const noexcept
 Returns a const iterator to one past the last byte. More...
 
constexpr auto begin () noexcept
 Returns an iterator to the first byte. More...
 
constexpr auto end () noexcept
 Returns an iterator to one past the last byte. More...
 
constexpr bool operator== (const ByteArray &rhs) const
 Returns true if this value is equal to rhs. More...
 
constexpr bool operator!= (const ByteArray &rhs) const
 Returns true if this value is not equal to rhs. More...
 
constexpr bool operator>= (const ByteArray &rhs) const
 Returns true if this value is greater than or equal to rhs. More...
 
constexpr bool operator> (const ByteArray &rhs) const
 Returns true if this value is greater than rhs. More...
 
constexpr bool operator<= (const ByteArray &rhs) const
 Returns true if this value is less than or equal to rhs. More...
 
constexpr bool operator< (const ByteArray &rhs) const
 Returns true if this value is less than rhs. More...
 

Private Attributes

std::array< uint8_t, N > m_array
 

Friends

std::ostream & operator<< (std::ostream &out, const ByteArray &byteArray)
 Insertion operator for outputting byteArray to out. More...
 

Detailed Description

template<size_t N, typename TTag>
class catapult::utils::ByteArray< N, TTag >

Base class for wrappers of byte array types, to provide some type-safety.

Member Typedef Documentation

◆ const_iterator

template<size_t N, typename TTag>
using catapult::utils::ByteArray< N, TTag >::const_iterator = typename std::array<uint8_t, N>::const_iterator

Constructor & Destructor Documentation

◆ ByteArray() [1/3]

template<size_t N, typename TTag>
constexpr catapult::utils::ByteArray< N, TTag >::ByteArray ( )
inlineconstexpr

Creates a zero-initialized byte array.

◆ ByteArray() [2/3]

template<size_t N, typename TTag>
constexpr catapult::utils::ByteArray< N, TTag >::ByteArray ( const std::array< uint8_t, N > &  array)
inlineconstexpr

Creates a byte array around array.

◆ ByteArray() [3/3]

template<size_t N, typename TTag>
constexpr catapult::utils::ByteArray< N, TTag >::ByteArray ( const ByteArray< N, TTag > &  rhs)
inlineconstexpr

Creates a copy of rhs.

Member Function Documentation

◆ begin() [1/2]

template<size_t N, typename TTag>
constexpr auto catapult::utils::ByteArray< N, TTag >::begin ( ) const
inlineconstexprnoexcept

Returns a const iterator to the first byte.

Here is the caller graph for this function:

◆ begin() [2/2]

template<size_t N, typename TTag>
constexpr auto catapult::utils::ByteArray< N, TTag >::begin ( )
inlineconstexprnoexcept

Returns an iterator to the first byte.

◆ cbegin()

template<size_t N, typename TTag>
constexpr auto catapult::utils::ByteArray< N, TTag >::cbegin ( ) const
inlineconstexprnoexcept

Returns a const iterator to the first byte.

Here is the caller graph for this function:

◆ cend()

template<size_t N, typename TTag>
constexpr auto catapult::utils::ByteArray< N, TTag >::cend ( ) const
inlineconstexprnoexcept

Returns a const iterator to one past the last byte.

Here is the caller graph for this function:

◆ data() [1/2]

template<size_t N, typename TTag>
constexpr const uint8_t* catapult::utils::ByteArray< N, TTag >::data ( ) const
inlineconstexprnoexcept

Returns a const pointer to the underlying array.

Here is the caller graph for this function:

◆ data() [2/2]

template<size_t N, typename TTag>
constexpr uint8_t* catapult::utils::ByteArray< N, TTag >::data ( )
inlineconstexprnoexcept

Returns a pointer to the underlying array.

◆ end() [1/2]

template<size_t N, typename TTag>
constexpr auto catapult::utils::ByteArray< N, TTag >::end ( ) const
inlineconstexprnoexcept

Returns a const iterator to one past the last byte.

◆ end() [2/2]

template<size_t N, typename TTag>
constexpr auto catapult::utils::ByteArray< N, TTag >::end ( )
inlineconstexprnoexcept

Returns an iterator to one past the last byte.

◆ operator!=()

template<size_t N, typename TTag>
constexpr bool catapult::utils::ByteArray< N, TTag >::operator!= ( const ByteArray< N, TTag > &  rhs) const
inlineconstexpr

Returns true if this value is not equal to rhs.

◆ operator<()

template<size_t N, typename TTag>
constexpr bool catapult::utils::ByteArray< N, TTag >::operator< ( const ByteArray< N, TTag > &  rhs) const
inlineconstexpr

Returns true if this value is less than rhs.

◆ operator<=()

template<size_t N, typename TTag>
constexpr bool catapult::utils::ByteArray< N, TTag >::operator<= ( const ByteArray< N, TTag > &  rhs) const
inlineconstexpr

Returns true if this value is less than or equal to rhs.

◆ operator=()

template<size_t N, typename TTag>
ByteArray& catapult::utils::ByteArray< N, TTag >::operator= ( const ByteArray< N, TTag > &  rhs)
inline

Assigns rhs to this.

◆ operator==()

template<size_t N, typename TTag>
constexpr bool catapult::utils::ByteArray< N, TTag >::operator== ( const ByteArray< N, TTag > &  rhs) const
inlineconstexpr

Returns true if this value is equal to rhs.

◆ operator>()

template<size_t N, typename TTag>
constexpr bool catapult::utils::ByteArray< N, TTag >::operator> ( const ByteArray< N, TTag > &  rhs) const
inlineconstexpr

Returns true if this value is greater than rhs.

◆ operator>=()

template<size_t N, typename TTag>
constexpr bool catapult::utils::ByteArray< N, TTag >::operator>= ( const ByteArray< N, TTag > &  rhs) const
inlineconstexpr

Returns true if this value is greater than or equal to rhs.

◆ operator[]() [1/2]

template<size_t N, typename TTag>
constexpr uint8_t& catapult::utils::ByteArray< N, TTag >::operator[] ( size_t  index)
inlineconstexpr

Returns a reference to the byte at index.

◆ operator[]() [2/2]

template<size_t N, typename TTag>
constexpr const uint8_t& catapult::utils::ByteArray< N, TTag >::operator[] ( size_t  index) const
inlineconstexpr

Returns a const reference to the byte at index.

◆ size()

template<size_t N, typename TTag>
constexpr size_t catapult::utils::ByteArray< N, TTag >::size ( ) const
inlineconstexpr

Returns the array size.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<size_t N, typename TTag>
std::ostream& operator<< ( std::ostream &  out,
const ByteArray< N, TTag > &  byteArray 
)
friend

Insertion operator for outputting byteArray to out.

Member Data Documentation

◆ m_array

template<size_t N, typename TTag>
std::array<uint8_t, N> catapult::utils::ByteArray< N, TTag >::m_array
private

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