...
This commit is contained in:
@@ -30,27 +30,56 @@ struct EV3 {
|
||||
static constexpr std::string_view ID = "EV3";
|
||||
};
|
||||
|
||||
struct EVN {
|
||||
static constexpr std::string_view ID = "EVN";
|
||||
};
|
||||
|
||||
struct ST1;
|
||||
struct ST2;
|
||||
|
||||
struct STN {
|
||||
static constexpr std::string_view ID = "STN";
|
||||
using transition_t = fsm::fsm_transition_table_t<std::pair<EV1, STN>, std::pair<EV2, ST2>>;
|
||||
|
||||
void enter()
|
||||
{
|
||||
std::cout << "transit to " << ID << "-state\n";
|
||||
}
|
||||
|
||||
void exit()
|
||||
{
|
||||
std::cout << "transit from " << ID << "-state\n";
|
||||
}
|
||||
};
|
||||
|
||||
struct ST3 {
|
||||
static constexpr std::string_view ID = "ST3";
|
||||
using transition_t = fsm::fsm_transition_table_t<std::pair<EV1, ST1>, std::pair<EV2, ST2>>;
|
||||
|
||||
void enter(EV3& ev)
|
||||
{
|
||||
std::cout << "transit to " << ID << "-state\n";
|
||||
}
|
||||
|
||||
void exit()
|
||||
{
|
||||
std::cout << "transit from " << ID << "-state\n";
|
||||
}
|
||||
};
|
||||
|
||||
struct ST2 {
|
||||
static constexpr std::string_view ID = "ST2";
|
||||
using transition_t = fsm::fsm_transition_table_t<std::pair<EV2, STN>, std::pair<EV3, ST3>>;
|
||||
|
||||
void enter(EV1& ev)
|
||||
void enter(EV2& ev)
|
||||
{
|
||||
std::cout << "transit to " << ID << "-state\n";
|
||||
}
|
||||
|
||||
void exit()
|
||||
{
|
||||
std::cout << "transit from " << ID << "-state\n";
|
||||
}
|
||||
};
|
||||
|
||||
struct ST1 {
|
||||
@@ -58,6 +87,11 @@ struct ST1 {
|
||||
using transition_t =
|
||||
fsm::fsm_transition_table_t<std::pair<EV1, ST2>, std::pair<EV2, STN>, std::pair<EV3, STN>, std::pair<EV3, STN>>;
|
||||
|
||||
void enter()
|
||||
{
|
||||
std::cout << "transit to " << ID << "-state\n";
|
||||
}
|
||||
|
||||
void exit()
|
||||
{
|
||||
std::cout << "transit from " << ID << "-state\n";
|
||||
@@ -151,8 +185,10 @@ int main()
|
||||
std::cout << "\n";
|
||||
|
||||
fsmach.dispatchEvent<EV1>();
|
||||
// fsmach.dispatchEvent<EV1>();
|
||||
fsmach.dispatchEvent<EV3>();
|
||||
fsmach.dispatchEvent<EV2>();
|
||||
|
||||
// fsmach.dispatchEvent<EVN>();
|
||||
|
||||
// using tab_t = fsm::fsm_transition_table_t<std::pair<EV1, ST2>, std::pair<EV3, ST1>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user