|
Embedded Template Library 1.0
|
Classes | |
| struct | etl::monostate |
| class | etl::variant_exception |
| class | etl::variant_incorrect_type_exception |
| class | etl::bad_variant_access |
| class | etl::variant_not_a_base_exception |
| class | etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 > |
A class that can contain one a several specified types in a type safe manner.
| struct etl::monostate |
Monostate for variants.
| class etl::variant_exception |
Base exception for the variant class.
Public Member Functions | |
| variant_exception (string_type reason_, string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::exception | |
| ETL_CONSTEXPR | exception (string_type reason_, string_type, numeric_type line_) |
| Constructor. | |
| ETL_CONSTEXPR string_type | what () const |
| ETL_CONSTEXPR string_type | file_name () const |
| ETL_CONSTEXPR numeric_type | line_number () const |
Additional Inherited Members | |
Public Types inherited from etl::exception | |
| typedef const char * | string_type |
| typedef int | numeric_type |
| class etl::variant_incorrect_type_exception |
'Unsupported type' exception for the variant class.
Public Member Functions | |
| variant_incorrect_type_exception (string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::variant_exception | |
| variant_exception (string_type reason_, string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::exception | |
| ETL_CONSTEXPR | exception (string_type reason_, string_type, numeric_type line_) |
| Constructor. | |
| ETL_CONSTEXPR string_type | what () const |
| ETL_CONSTEXPR string_type | file_name () const |
| ETL_CONSTEXPR numeric_type | line_number () const |
Additional Inherited Members | |
Public Types inherited from etl::exception | |
| typedef const char * | string_type |
| typedef int | numeric_type |
| class etl::bad_variant_access |
'Bad variant access' exception for the variant class.
Public Member Functions | |
| bad_variant_access (string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::variant_exception | |
| variant_exception (string_type reason_, string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::exception | |
| ETL_CONSTEXPR | exception (string_type reason_, string_type, numeric_type line_) |
| Constructor. | |
| ETL_CONSTEXPR string_type | what () const |
| ETL_CONSTEXPR string_type | file_name () const |
| ETL_CONSTEXPR numeric_type | line_number () const |
Additional Inherited Members | |
Public Types inherited from etl::exception | |
| typedef const char * | string_type |
| typedef int | numeric_type |
| class etl::variant_not_a_base_exception |
'Not a base type' exception for the variant class.
Public Member Functions | |
| variant_not_a_base_exception (string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::variant_exception | |
| variant_exception (string_type reason_, string_type file_name_, numeric_type line_number_) | |
Public Member Functions inherited from etl::exception | |
| ETL_CONSTEXPR | exception (string_type reason_, string_type, numeric_type line_) |
| Constructor. | |
| ETL_CONSTEXPR string_type | what () const |
| ETL_CONSTEXPR string_type | file_name () const |
| ETL_CONSTEXPR numeric_type | line_number () const |
Additional Inherited Members | |
Public Types inherited from etl::exception | |
| typedef const char * | string_type |
| typedef int | numeric_type |
| class etl::variant |
A template class that can store any of the types defined in the template parameter list. Supports up to 8 types.
Public Types | |
| typedef uint_least8_t | type_id_t |
| The type used for ids. | |
| typedef reader_type< T1, T2, T3, T4, T5, T6, T7, T8 > | reader |
| The base type for derived readers. | |
Public Member Functions | |
| ~variant () | |
| Destructor. | |
| variant () | |
| template<typename T > | |
| variant (const T &value) | |
| variant (const variant &other) | |
| template<typename T > | |
| T & | emplace () |
| Emplace with one constructor parameter. | |
| template<typename T , typename TP1 > | |
| T & | emplace (const TP1 &value1) |
| Emplace with one constructor parameter. | |
| template<typename T , typename TP1 , typename TP2 > | |
| T & | emplace (const TP1 &value1, const TP2 &value2) |
| Emplace with two constructor parameters. | |
| template<typename T , typename TP1 , typename TP2 , typename TP3 > | |
| T & | emplace (const TP1 &value1, const TP2 &value2, const TP3 &value3) |
| Emplace with three constructor parameters. | |
| template<typename T , typename TP1 , typename TP2 , typename TP3 , typename TP4 > | |
| T & | emplace (const TP1 &value1, const TP2 &value2, const TP3 &value3, const TP4 &value4) |
| Emplace with four constructor parameters. | |
| template<typename T > | |
| variant & | operator= (const T &value) |
| variant & | operator= (const variant &other) |
| bool | is_same_type (const variant &other) const |
| template<typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 > | |
| bool | is_same_type (const variant< U1, U2, U3, U4, U5, U6, U7, U8 > &other) const |
| void | call (reader &r) |
| bool | is_valid () const |
| template<typename T > | |
| bool | is_type () const |
| size_t | index () const |
| Gets the index of the type currently stored or UNSUPPORTED_TYPE_ID. | |
| void | clear () |
| Clears the value to 'no valid stored value'. | |
| template<typename T > | |
| T & | get () |
| template<typename T > | |
| const T & | get () const |
| template<typename TBase > | |
| TBase * | upcast_ptr () |
| template<typename TBase > | |
| TBase & | upcast () |
| template<typename TBase > | |
| const TBase * | upcast_ptr () const |
| template<typename TBase > | |
| const TBase & | upcast () const |
| template<typename TBase > | |
| bool | is_base_of () const |
| Check that TBase is a base class of the current variant value. | |
| operator T1 & () | |
| Conversion operators for each type. | |
| operator T2 & () | |
| operator T3 & () | |
| operator T4 & () | |
| operator T5 & () | |
| operator T6 & () | |
| operator T7 & () | |
| operator T8 & () | |
Static Public Member Functions | |
| template<typename T > | |
| static bool | is_supported_type () |
Static Public Attributes | |
| static const type_id_t | UNSUPPORTED_TYPE_ID = etl::integral_limits<type_id_t>::max |
| The id a unsupported types. | |
|
inline |
Default constructor. Sets the state of the instance to containing no valid data.
|
inline |
Constructor that catches any types that are not supported. Forces a ETL_STATIC_ASSERT.
|
inline |
Copy constructor.
| other | The other variant object to copy. |
|
inline |
Calls the supplied reader instance. The 'read' function appropriate to the current type is called with the stored value.
|
inline |
Gets the value stored as the specified template type. Throws a variant_incorrect_type_exception if the actual type is not that specified.
|
inline |
Gets the value stored as the specified template type. Throws a variant_incorrect_type_exception if the actual type is not that specified.
|
inline |
Checks if the type is the same as the current stored type. For variants with the same type declarations.
|
inline |
Checks if the type is the same as the current stored type. For variants with differing declarations.
|
inlinestatic |
Checks if the template type is supported by the implementation of variant..
|
inline |
Checks to see if the type currently stored is the same as that specified in the template parameter.
|
inline |
Checks whether a valid value is currently stored.
|
inline |
Assignment operator for T1 type.
| value | The value to assign. |
|
inline |
Assignment operator for variant type.
| other | The variant to assign. |
|
inline |
Gets the value stored as the specified template type.
|
inline |
Gets the value stored as the specified template type.
|
inline |
Gets the value stored as the specified template type.
|
inline |
Gets the value stored as the specified template type.