Loading...
Searching...
No Matches
type_lookup_cpp03.h
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2026 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
//***************************************************************************
// THIS FILE HAS BEEN AUTO GENERATED. DO NOT EDIT THIS FILE.
//***************************************************************************
//***************************************************************************
// For 16 types.
//***************************************************************************
template <typename T1,
typename T2 = etl::type_id_pair<etl::null_type<0>, -2>,
typename T3 = etl::type_id_pair<etl::null_type<0>, -3>,
typename T4 = etl::type_id_pair<etl::null_type<0>, -4>,
typename T5 = etl::type_id_pair<etl::null_type<0>, -5>,
typename T6 = etl::type_id_pair<etl::null_type<0>, -6>,
typename T7 = etl::type_id_pair<etl::null_type<0>, -7>,
typename T8 = etl::type_id_pair<etl::null_type<0>, -8>,
typename T9 = etl::type_id_pair<etl::null_type<0>, -9>,
typename T10 = etl::type_id_pair<etl::null_type<0>, -10>,
typename T11 = etl::type_id_pair<etl::null_type<0>, -11>,
typename T12 = etl::type_id_pair<etl::null_type<0>, -12>,
typename T13 = etl::type_id_pair<etl::null_type<0>, -13>,
typename T14 = etl::type_id_pair<etl::null_type<0>, -14>,
typename T15 = etl::type_id_pair<etl::null_type<0>, -15>,
typename T16 = etl::type_id_pair<etl::null_type<0>, -16> >
struct type_id_lookup
{
public:
//************************************
template <int Id>
struct type_from_id
{
typedef
typename etl::conditional<Id == T1::Id, typename T1::type,
typename etl::conditional<Id == T2::Id, typename T2::type,
typename etl::conditional<Id == T3::Id, typename T3::type,
typename etl::conditional<Id == T4::Id, typename T4::type,
typename etl::conditional<Id == T5::Id, typename T5::type,
typename etl::conditional<Id == T6::Id, typename T6::type,
typename etl::conditional<Id == T7::Id, typename T7::type,
typename etl::conditional<Id == T8::Id, typename T8::type,
typename etl::conditional<Id == T9::Id, typename T9::type,
typename etl::conditional<Id == T10::Id, typename T10::type,
typename etl::conditional<Id == T11::Id, typename T11::type,
typename etl::conditional<Id == T12::Id, typename T12::type,
typename etl::conditional<Id == T13::Id, typename T13::type,
typename etl::conditional<Id == T14::Id, typename T14::type,
typename etl::conditional<Id == T15::Id, typename T15::type,
typename etl::conditional<Id == T16::Id, typename T16::type,
etl::null_type<0> >::type>::type>::type>::type>
::type>::type>::type>::type>
::type>::type>::type>::type>
::type>::type>::type>::type type;
ETL_STATIC_ASSERT(!(etl::is_same<etl::null_type<0>, type>::value), "Invalid id");
};
//************************************
enum
{
UNKNOWN = UINT_MAX
};
template <typename T>
struct id_from_type
{
enum
{
value =
(unsigned int) etl::is_same<T, typename T1::type>::value ? (unsigned int)T1::Id :
(unsigned int) etl::is_same<T, typename T2::type>::value ? (unsigned int)T2::Id :
(unsigned int) etl::is_same<T, typename T3::type>::value ? (unsigned int)T3::Id :
(unsigned int) etl::is_same<T, typename T4::type>::value ? (unsigned int)T4::Id :
(unsigned int) etl::is_same<T, typename T5::type>::value ? (unsigned int)T5::Id :
(unsigned int) etl::is_same<T, typename T6::type>::value ? (unsigned int)T6::Id :
(unsigned int) etl::is_same<T, typename T7::type>::value ? (unsigned int)T7::Id :
(unsigned int) etl::is_same<T, typename T8::type>::value ? (unsigned int)T8::Id :
(unsigned int) etl::is_same<T, typename T9::type>::value ? (unsigned int)T9::Id :
(unsigned int) etl::is_same<T, typename T10::type>::value ? (unsigned int)T10::Id :
(unsigned int) etl::is_same<T, typename T11::type>::value ? (unsigned int)T11::Id :
(unsigned int) etl::is_same<T, typename T12::type>::value ? (unsigned int)T12::Id :
(unsigned int) etl::is_same<T, typename T13::type>::value ? (unsigned int)T13::Id :
(unsigned int) etl::is_same<T, typename T14::type>::value ? (unsigned int)T14::Id :
(unsigned int) etl::is_same<T, typename T15::type>::value ? (unsigned int)T15::Id :
(unsigned int) etl::is_same<T, typename T16::type>::value ? (unsigned int)T16::Id :
(unsigned int) UNKNOWN
};
ETL_STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};
//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}
//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};
//***************************************************************************
// For 16 types.
//***************************************************************************
template <typename T1,
typename T2 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T3 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T4 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T5 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T6 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T7 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T8 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T9 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T10 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T11 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T12 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T13 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T14 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T15 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> >,
typename T16 = etl::type_type_pair<etl::null_type<0>, etl::null_type<0> > >
struct type_type_lookup
{
public:
//************************************
template <typename T>
struct type_from_type
{
typedef
typename etl::conditional<etl::is_same<T, typename T1::type1>::value, typename T1::type2,
typename etl::conditional<etl::is_same<T, typename T2::type1>::value, typename T2::type2,
typename etl::conditional<etl::is_same<T, typename T3::type1>::value, typename T3::type2,
typename etl::conditional<etl::is_same<T, typename T4::type1>::value, typename T4::type2,
typename etl::conditional<etl::is_same<T, typename T5::type1>::value, typename T5::type2,
typename etl::conditional<etl::is_same<T, typename T6::type1>::value, typename T6::type2,
typename etl::conditional<etl::is_same<T, typename T7::type1>::value, typename T7::type2,
typename etl::conditional<etl::is_same<T, typename T8::type1>::value, typename T8::type2,
typename etl::conditional<etl::is_same<T, typename T9::type1>::value, typename T9::type2,
typename etl::conditional<etl::is_same<T, typename T10::type1>::value, typename T10::type2,
typename etl::conditional<etl::is_same<T, typename T11::type1>::value, typename T11::type2,
typename etl::conditional<etl::is_same<T, typename T12::type1>::value, typename T12::type2,
typename etl::conditional<etl::is_same<T, typename T13::type1>::value, typename T13::type2,
typename etl::conditional<etl::is_same<T, typename T14::type1>::value, typename T14::type2,
typename etl::conditional<etl::is_same<T, typename T15::type1>::value, typename T15::type2,
typename etl::conditional<etl::is_same<T, typename T16::type1>::value, typename T16::type2,
etl::null_type<0> >::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(!(etl::is_same<etl::null_type<0>, type>::value), "Invalid type");
};
};
etl::null_type
Definition null_type.h:40
etl::type_id_pair
The type/id pair type to use for type/id lookup template parameters.
Definition type_lookup.h:46
etl::type_type_pair
The type/type pair type to use for type/type lookup template parameters.
Definition type_lookup.h:60
type_id_lookup::id_from_type
Definition type_lookup_cpp03.h:93
type_id_lookup::type_from_id
Definition type_lookup_cpp03.h:59
type_id_lookup
Definition type_lookup_cpp03.h:53
type_type_lookup::type_from_type
Definition type_lookup_cpp03.h:160
type_type_lookup
Definition type_lookup_cpp03.h:154