Embedded Template Library 1.0
etl::unaligned_type< T, Endian_ > Class Template Reference

Allows an arithmetic type to be stored at an unaligned address. More...

#include <unaligned_type.h>

Classes

struct  unaligned_copy
 Unaligned copy. More...
 
struct  unaligned_copy< U, 1U >
 
struct  unaligned_copy< U, 2U >
 
struct  unaligned_copy< U, 4U >
 
struct  unaligned_copy< U, 8U >
 

Public Types

typedef T value_type
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::storage_type storage_type
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::pointer pointer
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::const_pointer const_pointer
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::iterator iterator
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::const_iterator const_iterator
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::reverse_iterator reverse_iterator
 
typedef private_unaligned_type::unaligned_type_common< sizeof(T)>::const_reverse_iterator const_reverse_iterator
 
- Public Types inherited from etl::private_unaligned_type::unaligned_type_common< sizeof(T)>
typedef unsigned char storage_type
 
typedef storage_type * pointer
 
typedef const storage_type * const_pointer
 
typedef storage_type * iterator
 
typedef const storage_type * const_iterator
 
typedef etl::reverse_iterator< iterator > reverse_iterator
 
typedef etl::reverse_iterator< const_iterator > const_reverse_iterator
 

Public Member Functions

 ETL_STATIC_ASSERT (etl::is_integral< T >::value||etl::is_floating_point< T >::value, "Unaligned type must be integral or floating point")
 
ETL_CONSTEXPR unaligned_type ()
 Default constructor.
 
ETL_CONSTEXPR14 unaligned_type (T value)
 Construct from a value.
 
template<int Endian_Other>
ETL_CONSTEXPR14 unaligned_type (const unaligned_type< T, Endian_Other > &other)
 Copy constructor.
 
ETL_CONSTEXPR14 unaligned_typeoperator= (T value)
 Assignment operator.
 
template<int Endian_Other>
ETL_CONSTEXPR14 unaligned_typeoperator= (const unaligned_type< T, Endian_Other > &other)
 Assignment operator from other endianness.
 
ETL_CONSTEXPR14 operator T () const
 Conversion operator.
 
ETL_CONSTEXPR14 T value () const
 Get the value.
 
- Public Member Functions inherited from etl::private_unaligned_type::unaligned_type_common< sizeof(T)>
ETL_CONSTEXPR unaligned_type_common ()
 Default constructor.
 
ETL_CONSTEXPR size_t size () const
 Size of the storage.
 
pointer data ()
 Pointer to the beginning of the storage.
 
ETL_CONSTEXPR const_pointer data () const
 Const pointer to the beginning of the storage.
 
iterator begin ()
 Iterator to the beginning of the storage.
 
ETL_CONSTEXPR const_iterator begin () const
 Const iterator to the beginning of the storage.
 
ETL_CONSTEXPR const_iterator cbegin () const
 Const iterator to the beginning of the storage.
 
reverse_iterator rbegin ()
 Reverse iterator to the beginning of the storage.
 
ETL_CONSTEXPR14 const_reverse_iterator rbegin () const
 Const reverse iterator to the beginning of the storage.
 
ETL_CONSTEXPR14 const_reverse_iterator crbegin () const
 Const reverse iterator to the beginning of the storage.
 
iterator end ()
 Iterator to the end of the storage.
 
ETL_CONSTEXPR const_iterator end () const
 Const iterator to the end of the storage.
 
ETL_CONSTEXPR const_iterator cend () const
 Const iterator to the end of the storage.
 
reverse_iterator rend ()
 Reverse iterator to the end of the storage.
 
ETL_CONSTEXPR14 const_reverse_iterator rend () const
 Const reverse iterator to the end of the storage.
 
ETL_CONSTEXPR14 const_reverse_iterator crend () const
 Const reverse iterator to the end of the storage.
 
storage_type & operator[] (int i)
 Index operator.
 
ETL_CONSTEXPR const storage_type & operator[] (int i) const
 Const index operator.
 

Static Public Attributes

static ETL_CONSTANT int Endian = Endian_
 
static ETL_CONSTANT size_t Size = private_unaligned_type::unaligned_type_common<sizeof(T)>::Size
 
- Static Public Attributes inherited from etl::private_unaligned_type::unaligned_type_common< sizeof(T)>
static ETL_CONSTANT size_t Size
 

Friends

ETL_CONSTEXPR14 bool operator== (const unaligned_type &lhs, const unaligned_type &rhs)
 Equality operator.
 
ETL_CONSTEXPR14 bool operator== (const unaligned_type &lhs, T rhs)
 Equality operator.
 
ETL_CONSTEXPR14 bool operator== (T lhs, const unaligned_type &rhs)
 Equality operator.
 
ETL_CONSTEXPR14 bool operator!= (const unaligned_type &lhs, T rhs)
 Inequality operator.
 
ETL_CONSTEXPR14 bool operator!= (const unaligned_type &lhs, const unaligned_type &rhs)
 Inequality operator.
 
ETL_CONSTEXPR14 bool operator!= (T lhs, const unaligned_type &rhs)
 Inequality operator.
 

Additional Inherited Members

- Protected Attributes inherited from etl::private_unaligned_type::unaligned_type_common< sizeof(T)>
unsigned char storage [Size]
 

Detailed Description

template<typename T, int Endian_>
class etl::unaligned_type< T, Endian_ >

Allows an arithmetic type to be stored at an unaligned address.

unaligned_type

Template Parameters
TThe arithmetic type.
EndianThe endianness of the arithmetic type.

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