mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
PR review changes
This commit is contained in:
parent
2e54c01c69
commit
1e2b69bc95
@ -88,13 +88,13 @@ namespace etl
|
||||
private:
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsMessagePacket = etl::is_same_v< etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
static constexpr bool IsMessagePacket = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsInMessageList = etl::is_one_of_v<etl::remove_const_t<etl::remove_reference_t<T>>, TMessageTypes...>;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsIMessage = etl::is_same_v<remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
static constexpr bool IsIMessage = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
|
||||
public:
|
||||
|
||||
@ -102,7 +102,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
constexpr message_packet() noexcept
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -403,14 +403,14 @@ namespace etl
|
||||
{
|
||||
private:
|
||||
|
||||
//template <typename T>
|
||||
//static constexpr bool IsMessagePacket = etl::is_same_v< etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
template <typename T>
|
||||
static constexpr bool IsMessagePacket = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsInMessageList = false;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsIMessage = etl::is_same_v<remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
static constexpr bool IsIMessage = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
|
||||
public:
|
||||
|
||||
@ -418,7 +418,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
constexpr message_packet() noexcept
|
||||
{
|
||||
}
|
||||
#include "private/diagnostic_pop.h"
|
||||
@ -620,7 +620,7 @@ namespace etl
|
||||
|
||||
cog.outl(" //********************************************")
|
||||
cog.outl("#include \"private/diagnostic_uninitialized_push.h\"")
|
||||
cog.outl(" message_packet()")
|
||||
cog.outl(" ETL_CONSTEXPR message_packet() ETL_NOEXCEPT")
|
||||
cog.outl(" : valid(false)")
|
||||
cog.outl(" {")
|
||||
cog.outl(" }")
|
||||
@ -934,7 +934,7 @@ namespace etl
|
||||
|
||||
cog.outl(" //********************************************")
|
||||
cog.outl("#include \"private/diagnostic_uninitialized_push.h\"")
|
||||
cog.outl(" message_packet()")
|
||||
cog.outl(" ETL_CONSTEXPR message_packet() ETL_NOEXCEPT")
|
||||
cog.outl(" : valid(false)")
|
||||
cog.outl(" {")
|
||||
cog.outl(" }")
|
||||
@ -1219,7 +1219,7 @@ namespace etl
|
||||
using message_types = etl::type_list<>;
|
||||
#endif
|
||||
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ namespace etl
|
||||
//**********************************************
|
||||
using imessage_router::accepts;
|
||||
|
||||
bool accepts(etl::message_id_t /*id*/) const ETL_OVERRIDE
|
||||
bool accepts(etl::message_id_t id) const ETL_OVERRIDE
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
|
||||
@ -76,13 +76,13 @@ namespace etl
|
||||
private:
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsMessagePacket = etl::is_same_v< etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
static constexpr bool IsMessagePacket = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsInMessageList = etl::is_one_of_v<etl::remove_const_t<etl::remove_reference_t<T>>, TMessageTypes...>;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsIMessage = etl::is_same_v<remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
static constexpr bool IsIMessage = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
|
||||
public:
|
||||
|
||||
@ -90,7 +90,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
constexpr message_packet() noexcept
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -391,14 +391,14 @@ namespace etl
|
||||
{
|
||||
private:
|
||||
|
||||
//template <typename T>
|
||||
//static constexpr bool IsMessagePacket = etl::is_same_v< etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
template <typename T>
|
||||
static constexpr bool IsMessagePacket = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::message_packet<TMessageTypes...>>;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsInMessageList = false;
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool IsIMessage = etl::is_same_v<remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
static constexpr bool IsIMessage = etl::is_same_v<etl::remove_const_t<etl::remove_reference_t<T>>, etl::imessage>;
|
||||
|
||||
public:
|
||||
|
||||
@ -406,7 +406,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
constexpr message_packet() noexcept
|
||||
{
|
||||
}
|
||||
#include "private/diagnostic_pop.h"
|
||||
@ -528,7 +528,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -856,7 +856,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -1182,7 +1182,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -1505,7 +1505,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -1824,7 +1824,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -2137,7 +2137,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -2447,7 +2447,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -2754,7 +2754,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -3057,7 +3057,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -3354,7 +3354,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -3648,7 +3648,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -3939,7 +3939,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -4226,7 +4226,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -4507,7 +4507,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -4785,7 +4785,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -5060,7 +5060,7 @@ namespace etl
|
||||
|
||||
//********************************************
|
||||
#include "private/diagnostic_uninitialized_push.h"
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
@ -5331,7 +5331,7 @@ namespace etl
|
||||
using message_types = etl::type_list<>;
|
||||
#endif
|
||||
|
||||
message_packet()
|
||||
ETL_CONSTEXPR message_packet() ETL_NOEXCEPT
|
||||
: valid(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ namespace etl
|
||||
//**********************************************
|
||||
using imessage_router::accepts;
|
||||
|
||||
bool accepts(etl::message_id_t /*id*/) const ETL_OVERRIDE
|
||||
bool accepts(etl::message_id_t id) const ETL_OVERRIDE
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
|
||||
@ -59,6 +59,11 @@ namespace etl
|
||||
template <typename... TTypes>
|
||||
struct is_type_list<etl::type_list<TTypes...>> : etl::true_type {};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_type_list_v = is_type_list<T>::value;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// The empty type list.
|
||||
//***************************************************************************
|
||||
|
||||
@ -448,31 +448,6 @@ namespace
|
||||
CHECK_EQUAL(1, r1.message4_count);
|
||||
CHECK_EQUAL(0, r1.message_unknown_count);
|
||||
CHECK_EQUAL(4, r2.callback_count);
|
||||
|
||||
//// Send from the null router.
|
||||
//etl::send_message(r0, message1);
|
||||
//CHECK_EQUAL(1, r2.message1_count);
|
||||
//CHECK_EQUAL(0, r2.message2_count);
|
||||
//CHECK_EQUAL(0, r2.message4_count);
|
||||
//CHECK_EQUAL(0, r2.message_unknown_count);
|
||||
|
||||
//etl::send_message(r0, message2);
|
||||
//CHECK_EQUAL(1, r2.message1_count);
|
||||
//CHECK_EQUAL(1, r2.message2_count);
|
||||
//CHECK_EQUAL(0, r2.message4_count);
|
||||
//CHECK_EQUAL(0, r2.message_unknown_count);
|
||||
|
||||
//etl::send_message(r0, message3);
|
||||
//CHECK_EQUAL(1, r2.message1_count);
|
||||
//CHECK_EQUAL(1, r2.message2_count);
|
||||
//CHECK_EQUAL(0, r2.message4_count);
|
||||
//CHECK_EQUAL(1, r2.message_unknown_count);
|
||||
|
||||
//etl::send_message(r0, message4);
|
||||
//CHECK_EQUAL(1, r2.message1_count);
|
||||
//CHECK_EQUAL(1, r2.message2_count);
|
||||
//CHECK_EQUAL(1, r2.message4_count);
|
||||
//CHECK_EQUAL(1, r2.message_unknown_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -37,6 +37,24 @@ namespace
|
||||
#if ETL_USING_CPP11
|
||||
SUITE(test_type_list)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_is_type_list)
|
||||
{
|
||||
using t0 = etl::type_list<>;
|
||||
using t1 = etl::type_list<char, int, uint32_t>;
|
||||
using t2 = int;
|
||||
|
||||
CHECK_TRUE((etl::is_type_list<t0>::value));
|
||||
CHECK_TRUE((etl::is_type_list<t1>::value));
|
||||
CHECK_FALSE((etl::is_type_list<t2>::value));
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
CHECK_TRUE((etl::is_type_list_v<t0>));
|
||||
CHECK_TRUE((etl::is_type_list_v<t1>));
|
||||
CHECK_FALSE((etl::is_type_list_v<t2>));
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_type_list_select)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user