This commit is contained in:
2025-05-30 12:48:15 +03:00
parent 7e987536b8
commit fbe82fc56c
2 changed files with 87 additions and 28 deletions

View File

@@ -1,15 +1,52 @@
#include <cxxabi.h>
#include <iostream>
#include <typeinfo>
#include "../mcc_fsm.h"
using namespace mcc;
struct S {
};
struct EV1 {
static constexpr std::string_view ID = "EV1";
// EV1() = default;
// EV1(EV1&&) = default;
// EV1& operator=(EV1&&) = default;
};
struct EV2 {
static constexpr std::string_view ID = "EV2";
};
struct STN : fsm::MccFsmAbstractState {
static constexpr std::string_view ID = "STN";
using transition_t = trans_table_t<std::pair<EV1, STN>, std::pair<EV2, STN>>;
};
struct ST2 : fsm::MccFsmAbstractState {
static constexpr std::string_view ID = "ST2";
using transition_t = trans_table_t<std::pair<EV2, STN>>;
};
struct ST1 : fsm::MccFsmAbstractState {
static constexpr std::string_view ID = "ST1";
using transition_t = trans_table_t<std::pair<EV1, ST2>, std::pair<EV2, STN>>;
};
// using tr_t = fsm::MccFsmAbstractState::trans_table_t<std::pair<EV1, ST1>>;
// static_assert(fsm::traits::fsm_trans_table_c<tr_t>, "!!!!!!!!!!!!!");
// fsm::MccFiniteStateMachine<ST1> fsm;
int main()
{
using namespace mcc;
typedef fsm::unique_tuple_t<int, float, long, int, double, char, long> ut_t;
std::cout << "type index: " << fsm::unique_tuple_type_index_t<double, ut_t>::index << " (double)\n";
@@ -37,5 +74,18 @@ int main()
using t2_t = fsm::pair_holder_second_t<ph_t>::second_t;
std::cout << "second types: " << typeid(t2_t).name() << "\n";
using tp1_t = std::tuple<int, float, long, char>;
using tp2_t = std::tuple<double, float, char*>;
int status;
char* aa = abi::__cxa_demangle(typeid(STN::transition_t::states_t).name(), NULL, NULL, &status);
std::cout << "aa = " << aa << "\n";
char* uu = abi::__cxa_demangle(typeid(STN::transition_t::unique_states_t).name(), NULL, NULL, &status);
std::cout << "uu = " << uu << "\n";
free(aa);
free(uu);
return 0;
}