mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Changes require for non-virtual messages
This commit is contained in:
parent
f927a1b639
commit
45fb06af3f
2
.gitignore
vendored
2
.gitignore
vendored
@ -382,3 +382,5 @@ test/vs2022/Release MSVC C++20 - No STL - Optimised -O2
|
||||
test/vs2022/Release MSVC C++20 - Optimised O2
|
||||
test/vs2022/Debug MSVC C++ 20 - No Tests
|
||||
test/vs2022/enc_temp_folder
|
||||
test/vs2022/Debug MSVC C++20 - No virtual messages
|
||||
examples/MutexMessageRouter/.vs
|
||||
|
||||
@ -63,6 +63,10 @@ cog.outl("//********************************************************************
|
||||
#ifndef ETL_MESSAGE_PACKET_INCLUDED
|
||||
#define ETL_MESSAGE_PACKET_INCLUDED
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
|
||||
#include "message.h"
|
||||
#include "error_handler.h"
|
||||
#include "static_assert.h"
|
||||
@ -977,5 +981,8 @@ namespace etl
|
||||
/*[[[end]]]*/
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#error "etl::message_packet is not compatible with non-virtual etl::imessage"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -66,7 +66,9 @@ cog.outl("//********************************************************************
|
||||
#include "platform.h"
|
||||
#include "message.h"
|
||||
#include "shared_message.h"
|
||||
#include "message_packet.h"
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
#include "message_packet.h"
|
||||
#endif
|
||||
#include "message_types.h"
|
||||
#include "alignment.h"
|
||||
#include "error_handler.h"
|
||||
@ -402,7 +404,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<TMessageTypes...> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router()
|
||||
@ -560,10 +564,12 @@ namespace etl
|
||||
cog.outl("{")
|
||||
cog.outl("public:")
|
||||
cog.outl("")
|
||||
cog.outl("#if ETL_HAS_VIRTUAL_MESSAGES")
|
||||
cog.out(" typedef etl::message_packet<")
|
||||
for n in range(1, int(Handlers)):
|
||||
cog.out("T%s, " % n)
|
||||
cog.outl(" T%s> message_packet;" % int(Handlers))
|
||||
cog.outl("#endif")
|
||||
cog.outl("")
|
||||
cog.outl(" //**********************************************")
|
||||
cog.outl(" message_router(etl::message_router_id_t id_)")
|
||||
@ -728,10 +734,12 @@ namespace etl
|
||||
cog.outl("{")
|
||||
cog.outl("public:")
|
||||
cog.outl("")
|
||||
cog.outl("#if ETL_HAS_VIRTUAL_MESSAGES")
|
||||
cog.out(" typedef etl::message_packet<")
|
||||
for t in range(1, n):
|
||||
cog.out("T%s, " % t)
|
||||
cog.outl(" T%s> message_packet;" % n)
|
||||
cog.outl("#endif")
|
||||
cog.outl("")
|
||||
cog.outl(" //**********************************************")
|
||||
cog.outl(" message_router(etl::message_router_id_t id_)")
|
||||
|
||||
@ -62,40 +62,127 @@ namespace etl
|
||||
}
|
||||
};
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
//***************************************************************************
|
||||
// Message interface.
|
||||
/// Message interface.
|
||||
/// Virtual.
|
||||
//***************************************************************************
|
||||
class imessage
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~imessage()
|
||||
//***********************************
|
||||
virtual ~imessage() ETL_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
//***********************************
|
||||
ETL_NODISCARD virtual etl::message_id_t get_message_id() const ETL_NOEXCEPT = 0;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// Message type.
|
||||
/// Message type.
|
||||
/// Virtual.
|
||||
//***************************************************************************
|
||||
template <etl::message_id_t ID_, typename TParent = etl::imessage>
|
||||
class message : public TParent
|
||||
template <etl::message_id_t ID_, typename TBase = etl::imessage>
|
||||
class message : public TBase
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_base_of<etl::imessage, TParent>::value), "TParent is not derived from etl::imessage");
|
||||
|
||||
public:
|
||||
|
||||
static ETL_CONSTANT etl::message_id_t ID = ID_;
|
||||
|
||||
ETL_NODISCARD etl::message_id_t get_message_id() const ETL_NOEXCEPT ETL_OVERRIDE
|
||||
//***********************************
|
||||
ETL_NODISCARD virtual etl::message_id_t get_message_id() const ETL_NOEXCEPT ETL_OVERRIDE
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
static ETL_CONSTANT etl::message_id_t ID = ID_;
|
||||
};
|
||||
|
||||
template <etl::message_id_t ID_, typename TParent>
|
||||
ETL_CONSTANT etl::message_id_t message<ID_, TParent>::ID;
|
||||
#else
|
||||
|
||||
//***************************************************************************
|
||||
/// Message interface.
|
||||
/// Non-virtual.
|
||||
//***************************************************************************
|
||||
class imessage
|
||||
{
|
||||
public:
|
||||
|
||||
//***********************************
|
||||
ETL_NODISCARD etl::message_id_t get_message_id() const ETL_NOEXCEPT
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//***********************************
|
||||
imessage(etl::message_id_t id_) ETL_NOEXCEPT
|
||||
: id(id_)
|
||||
{
|
||||
}
|
||||
|
||||
//***********************************
|
||||
imessage(const imessage& other) ETL_NOEXCEPT
|
||||
: id(other.id)
|
||||
{
|
||||
}
|
||||
|
||||
//***********************************
|
||||
imessage& operator =(const imessage& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
id = rhs.id;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
etl::message_id_t id;
|
||||
|
||||
private:
|
||||
|
||||
imessage() ETL_DELETE;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// Message type.
|
||||
/// Non-virtual.
|
||||
//***************************************************************************
|
||||
template <etl::message_id_t ID_, typename TBase = etl::imessage>
|
||||
class message : public TBase
|
||||
{
|
||||
public:
|
||||
|
||||
ETL_STATIC_ASSERT((etl::is_base_of<etl::imessage, TBase>::value), "TBase is not derived from etl::imessage");
|
||||
|
||||
//***********************************
|
||||
message() ETL_NOEXCEPT
|
||||
: TBase(ID)
|
||||
{
|
||||
}
|
||||
|
||||
//***********************************
|
||||
message(const message&) ETL_NOEXCEPT
|
||||
: TBase(ID)
|
||||
{
|
||||
}
|
||||
|
||||
//***********************************
|
||||
message& operator =(const message&) ETL_NOEXCEPT
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
static ETL_CONSTANT etl::message_id_t ID = ID_;
|
||||
};
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// The message's static ID.
|
||||
//***************************************************************************
|
||||
template <etl::message_id_t ID_, typename TBase>
|
||||
ETL_CONSTANT etl::message_id_t etl::message<ID_, TBase>::ID;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -51,6 +51,10 @@ SOFTWARE.
|
||||
#ifndef ETL_MESSAGE_PACKET_INCLUDED
|
||||
#define ETL_MESSAGE_PACKET_INCLUDED
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
|
||||
#include "message.h"
|
||||
#include "error_handler.h"
|
||||
#include "static_assert.h"
|
||||
@ -4717,5 +4721,8 @@ namespace etl
|
||||
};
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#error "etl::message_packet is not compatible with non-virtual etl::imessage"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -54,7 +54,9 @@ SOFTWARE.
|
||||
#include "platform.h"
|
||||
#include "message.h"
|
||||
#include "shared_message.h"
|
||||
#include "message_packet.h"
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
#include "message_packet.h"
|
||||
#endif
|
||||
#include "message_types.h"
|
||||
#include "alignment.h"
|
||||
#include "error_handler.h"
|
||||
@ -390,7 +392,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<TMessageTypes...> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router()
|
||||
@ -538,7 +542,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -683,7 +689,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -828,7 +836,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -972,7 +982,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1114,7 +1126,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1255,7 +1269,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1395,7 +1411,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1534,7 +1552,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1671,7 +1691,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1807,7 +1829,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -1941,7 +1965,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5, T6> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -2074,7 +2100,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4, T5> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -2205,7 +2233,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3, T4> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -2335,7 +2365,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2, T3> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -2464,7 +2496,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet<T1, T2> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
@ -2592,7 +2626,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
typedef etl::message_packet< T1> message_packet;
|
||||
#endif
|
||||
|
||||
//**********************************************
|
||||
message_router(etl::message_router_id_t id_)
|
||||
|
||||
@ -231,6 +231,14 @@ SOFTWARE.
|
||||
#define ETL_HAS_MUTABLE_ARRAY_VIEW 0
|
||||
#endif
|
||||
|
||||
//*************************************
|
||||
// Indicate if etl::imassage is to be non-virtual.
|
||||
#if defined(ETL_MESSAGES_ARE_NOT_VIRTUAL)
|
||||
#define ETL_HAS_VIRTUAL_MESSAGES 0
|
||||
#else
|
||||
#define ETL_HAS_VIRTUAL_MESSAGES 1
|
||||
#endif
|
||||
|
||||
//*************************************
|
||||
// The macros below are dependent on the profile.
|
||||
// C++11
|
||||
@ -449,7 +457,7 @@ namespace etl
|
||||
static ETL_CONSTANT bool using_generic_compiler = (ETL_USING_GENERIC_COMPILER == 1);
|
||||
static ETL_CONSTANT bool using_legacy_bitset = (ETL_USING_LEGACY_BITSET == 1);
|
||||
static ETL_CONSTANT bool using_exceptions = (ETL_USING_EXCEPTIONS == 1);
|
||||
|
||||
|
||||
// Has...
|
||||
static ETL_CONSTANT bool has_initializer_list = (ETL_HAS_INITIALIZER_LIST == 1);
|
||||
static ETL_CONSTANT bool has_8bit_types = (ETL_USING_8BIT_TYPES == 1);
|
||||
@ -467,6 +475,7 @@ namespace etl
|
||||
static ETL_CONSTANT bool has_ivector_repair = (ETL_HAS_IVECTOR_REPAIR == 1);
|
||||
static ETL_CONSTANT bool has_mutable_array_view = (ETL_HAS_MUTABLE_ARRAY_VIEW == 1);
|
||||
static ETL_CONSTANT bool has_ideque_repair = (ETL_HAS_IDEQUE_REPAIR == 1);
|
||||
static ETL_CONSTANT bool has_virtual_messages = (ETL_HAS_VIRTUAL_MESSAGES == 1);
|
||||
|
||||
// Is...
|
||||
static ETL_CONSTANT bool is_debug_build = (ETL_IS_DEBUG_BUILD == 1);
|
||||
|
||||
@ -321,6 +321,11 @@ if (ETL_USER_DEFINED_TYPE_TRAITS)
|
||||
target_compile_definitions(etl_tests PRIVATE -DETL_USER_DEFINED_TYPE_TRAITS)
|
||||
endif()
|
||||
|
||||
if (ETL_MESSAGES_ARE_NOT_VIRTUAL)
|
||||
message(STATUS "Compiling for non-virtual messages")
|
||||
target_compile_definitions(etl_tests PRIVATE -DETL_MESSAGES_ARE_NOT_VIRTUAL)
|
||||
endif()
|
||||
|
||||
if (ETL_FORCE_TEST_CPP03_IMPLEMENTATION)
|
||||
message(STATUS "Compiling for C++03 tests")
|
||||
target_compile_definitions(etl_tests PRIVATE -DETL_FORCE_TEST_CPP03_IMPLEMENTATION)
|
||||
|
||||
@ -155,7 +155,28 @@ SetTestName "GCC - STL"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
gcc --version | grep gcc | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
else
|
||||
FailedCompilation
|
||||
exit $?
|
||||
fi
|
||||
./etl_tests
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedTests
|
||||
else
|
||||
FailedTests
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#******************************************************************************
|
||||
SetTestName "GCC - STL - Non-virtual messages"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
gcc --version | grep gcc | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=ON ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -176,7 +197,7 @@ SetTestName "GCC - STL - Force C++03"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
gcc --version | grep gcc | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -197,7 +218,7 @@ SetTestName "GCC - No STL"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
gcc --version | grep gcc | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -218,7 +239,7 @@ SetTestName "GCC - No STL - Force C++03"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
gcc --version | grep gcc | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -241,7 +262,7 @@ SetTestName "Clang - STL"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
clang --version | grep clang | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -262,7 +283,7 @@ SetTestName "Clang - STL - Force C++03"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
clang --version | grep clang | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -283,7 +304,7 @@ SetTestName "Clang - No STL"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
clang --version | grep clang | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
@ -304,7 +325,7 @@ SetTestName "Clang - No STL - Force C++03"
|
||||
PrintHeader
|
||||
rm * -rf
|
||||
clang --version | grep clang | tee -a log.txt
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
|
||||
cmake -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
|
||||
cmake --build .
|
||||
if [ $? -eq 0 ]; then
|
||||
PassedCompilation
|
||||
|
||||
@ -59,6 +59,7 @@ namespace
|
||||
CHECK_EQUAL((ETL_USING_INTEL_COMPILER == 1), etl::traits::using_intel_compiler);
|
||||
CHECK_EQUAL((ETL_USING_TEXAS_INSTRUMENTS_COMPILER == 1), etl::traits::using_texas_instruments_compiler);
|
||||
CHECK_EQUAL((ETL_USING_GENERIC_COMPILER == 1), etl::traits::using_generic_compiler);
|
||||
|
||||
CHECK_EQUAL((ETL_USING_8BIT_TYPES == 1), etl::traits::has_8bit_types);
|
||||
CHECK_EQUAL((ETL_USING_64BIT_TYPES == 1), etl::traits::has_64bit_types);
|
||||
CHECK_EQUAL((ETL_HAS_ATOMIC == 1), etl::traits::has_atomic);
|
||||
@ -74,7 +75,9 @@ namespace
|
||||
CHECK_EQUAL((ETL_HAS_ISTRING_REPAIR == 1), etl::traits::has_istring_repair);
|
||||
CHECK_EQUAL((ETL_HAS_IVECTOR_REPAIR == 1), etl::traits::has_ivector_repair);
|
||||
CHECK_EQUAL((ETL_HAS_IDEQUE_REPAIR == 1), etl::traits::has_ideque_repair);
|
||||
CHECK_EQUAL((ETL_HAS_MUTABLE_ARRAY_VIEW == 1), etl::traits::has_mutable_array_view);
|
||||
CHECK_EQUAL((ETL_HAS_MUTABLE_ARRAY_VIEW == 1), etl::traits::has_mutable_array_view);
|
||||
CHECK_EQUAL((ETL_HAS_VIRTUAL_MESSAGES == 1), etl::traits::has_virtual_messages);
|
||||
|
||||
CHECK_EQUAL((ETL_IS_DEBUG_BUILD == 1), etl::traits::is_debug_build);
|
||||
CHECK_EQUAL(__cplusplus, etl::traits::cplusplus);
|
||||
CHECK_EQUAL(ETL_VERSION_MAJOR, etl::traits::version_major);
|
||||
|
||||
@ -35,7 +35,7 @@ SOFTWARE.
|
||||
#include "etl/queue.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -166,6 +166,9 @@ namespace
|
||||
entered_state = false;
|
||||
isLampOn = false;
|
||||
speed = 0;
|
||||
|
||||
last_event_id = std::numeric_limits<etl::message_id_t>::max();
|
||||
last_returned_state_id = std::numeric_limits<etl::fsm_state_id_t>::max();
|
||||
}
|
||||
|
||||
//***********************************
|
||||
@ -208,6 +211,8 @@ namespace
|
||||
bool entered_state;
|
||||
bool isLampOn;
|
||||
int speed;
|
||||
etl::message_id_t last_event_id;
|
||||
etl::fsm_state_id_t last_returned_state_id;
|
||||
};
|
||||
|
||||
//***********************************
|
||||
@ -234,6 +239,8 @@ namespace
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event(const SelfTransition&)
|
||||
{
|
||||
get_fsm_context().last_event_id = SelfTransition::ID;
|
||||
get_fsm_context().last_returned_state_id = etl::ifsm_state::Self_Transition;
|
||||
return etl::ifsm_state::Self_Transition;
|
||||
}
|
||||
|
||||
@ -659,6 +666,9 @@ namespace
|
||||
// Execute self transition.
|
||||
motorControl.receive(SelfTransition());
|
||||
|
||||
CHECK_EQUAL(size_t(SelfTransition::ID), size_t(motorControl.last_event_id));
|
||||
CHECK_EQUAL(size_t(etl::ifsm_state::Self_Transition), size_t(motorControl.last_returned_state_id));
|
||||
|
||||
CHECK_TRUE(motorControl.exited_state);
|
||||
CHECK_TRUE(motorControl.entered_state);
|
||||
}
|
||||
|
||||
@ -28,6 +28,10 @@ SOFTWARE.
|
||||
|
||||
#include "unit_test_framework.h"
|
||||
|
||||
#include "etl/platform.h"
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
|
||||
#include "etl/message_packet.h"
|
||||
|
||||
#include <string>
|
||||
@ -450,3 +454,5 @@ namespace
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -68,24 +68,13 @@ namespace
|
||||
//};
|
||||
|
||||
//***********************************
|
||||
struct Interface : public etl::imessage
|
||||
{
|
||||
virtual int VirtualFunction() const = 0;
|
||||
};
|
||||
|
||||
//***********************************
|
||||
struct Message1 : public etl::message<MESSAGE1, Interface>
|
||||
struct Message1 : public etl::message<MESSAGE1>
|
||||
{
|
||||
Message1(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
int VirtualFunction() const override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
@ -153,7 +142,7 @@ namespace
|
||||
{
|
||||
++message1_count;
|
||||
etl::send_message(msg.callback, message5);
|
||||
CHECK_EQUAL(1, msg.VirtualFunction());
|
||||
//CHECK_EQUAL(1, msg.VirtualFunction());
|
||||
}
|
||||
|
||||
void on_receive(const Message2& msg)
|
||||
@ -228,7 +217,7 @@ namespace
|
||||
++message1_count;
|
||||
sender_id = msg.callback.get_message_router_id();
|
||||
etl::send_message(msg.callback, message5);
|
||||
CHECK_EQUAL(1, msg.VirtualFunction());
|
||||
//CHECK_EQUAL(1, msg.VirtualFunction());
|
||||
}
|
||||
|
||||
void on_receive(const Message2& msg)
|
||||
@ -516,6 +505,7 @@ namespace
|
||||
CHECK(r2.accepts(message5.get_message_id()));
|
||||
}
|
||||
|
||||
#if ETL_HAS_VIRTUAL_MESSAGES
|
||||
//*************************************************************************
|
||||
TEST(message_router_queue)
|
||||
{
|
||||
@ -588,6 +578,7 @@ namespace
|
||||
CHECK_EQUAL(4, r1.callback_count);
|
||||
queue.pop();
|
||||
}
|
||||
#endif
|
||||
|
||||
//*************************************************************************
|
||||
TEST(message_router_successor)
|
||||
|
||||
@ -19,6 +19,8 @@ Global
|
||||
Debug MSVC C++17|x64 = Debug MSVC C++17|x64
|
||||
Debug MSVC C++20 - No STL|Win32 = Debug MSVC C++20 - No STL|Win32
|
||||
Debug MSVC C++20 - No STL|x64 = Debug MSVC C++20 - No STL|x64
|
||||
Debug MSVC C++20 - No virtual messages|Win32 = Debug MSVC C++20 - No virtual messages|Win32
|
||||
Debug MSVC C++20 - No virtual messages|x64 = Debug MSVC C++20 - No virtual messages|x64
|
||||
Debug MSVC C++20|Win32 = Debug MSVC C++20|Win32
|
||||
Debug MSVC C++20|x64 = Debug MSVC C++20|x64
|
||||
Release MSVC C++20 - No STL - Optimised -O2|Win32 = Release MSVC C++20 - No STL - Optimised -O2|Win32
|
||||
@ -51,6 +53,10 @@ Global
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.Build.0 = Debug MSVC C++20 - No STL|Win32
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|x64.ActiveCfg = Debug MSVC C++20 - No STL|x64
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|x64.Build.0 = Debug MSVC C++20 - No STL|x64
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No virtual messages|Win32.ActiveCfg = Debug MSVC C++20 - No virtual messages|Win32
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No virtual messages|Win32.Build.0 = Debug MSVC C++20 - No virtual messages|Win32
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No virtual messages|x64.ActiveCfg = Debug MSVC C++20 - No virtual messages|x64
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No virtual messages|x64.Build.0 = Debug MSVC C++20 - No virtual messages|x64
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|Win32.ActiveCfg = Debug MSVC C++20|Win32
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|Win32.Build.0 = Debug MSVC C++20|Win32
|
||||
{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|x64.ActiveCfg = Debug MSVC C++20|x64
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user