mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Updated versions
This commit is contained in:
parent
2e115df488
commit
b084913b3f
@ -195,6 +195,7 @@ namespace etl
|
|||||||
|
|
||||||
//*******************************************
|
//*******************************************
|
||||||
/// Adds a child to this state.
|
/// Adds a child to this state.
|
||||||
|
/// Only of use when part of an HFSM.
|
||||||
//*******************************************
|
//*******************************************
|
||||||
void add_child_state(etl::ifsm_state& state)
|
void add_child_state(etl::ifsm_state& state)
|
||||||
{
|
{
|
||||||
@ -210,6 +211,7 @@ namespace etl
|
|||||||
|
|
||||||
//*******************************************
|
//*******************************************
|
||||||
/// Adds a list of child states.
|
/// Adds a list of child states.
|
||||||
|
/// Only of use when part of an HFSM.
|
||||||
//*******************************************
|
//*******************************************
|
||||||
template <typename TSize>
|
template <typename TSize>
|
||||||
void set_child_states(etl::ifsm_state** state_list, TSize size)
|
void set_child_states(etl::ifsm_state** state_list, TSize size)
|
||||||
@ -224,30 +226,6 @@ namespace etl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************************
|
|
||||||
/// Get the parent state for this state.
|
|
||||||
//*******************************************
|
|
||||||
etl::ifsm_state* get_parent_state() const
|
|
||||||
{
|
|
||||||
return p_parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
//*******************************************
|
|
||||||
/// Get the active child state for this state.
|
|
||||||
//*******************************************
|
|
||||||
etl::ifsm_state* get_active_child_state() const
|
|
||||||
{
|
|
||||||
return p_active_child;
|
|
||||||
}
|
|
||||||
|
|
||||||
//*******************************************
|
|
||||||
/// Get the default child state for this state.
|
|
||||||
//*******************************************
|
|
||||||
etl::ifsm_state* get_default_child_state() const
|
|
||||||
{
|
|
||||||
return p_default_child;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//*******************************************
|
//*******************************************
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Embedded Template Library.
|
|||||||
https://github.com/ETLCPP/etl
|
https://github.com/ETLCPP/etl
|
||||||
https://www.etlcpp.com
|
https://www.etlcpp.com
|
||||||
|
|
||||||
Copyright(c) 2021
|
Copyright(c) 2021 Jeremy Overesch, John Wellbelove
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files(the "Software"), to deal
|
of this software and associated documentation files(the "Software"), to deal
|
||||||
@ -88,41 +88,41 @@ namespace etl
|
|||||||
//*******************************************
|
//*******************************************
|
||||||
/// Return the first common ancester of the two states.
|
/// Return the first common ancester of the two states.
|
||||||
//*******************************************
|
//*******************************************
|
||||||
static etl::ifsm_state* common_ancestor(etl::ifsm_state* p1, etl::ifsm_state* p2)
|
static etl::ifsm_state* common_ancestor(etl::ifsm_state* s1, etl::ifsm_state* s2)
|
||||||
{
|
{
|
||||||
size_t depth1 = get_depth(p1);
|
size_t depth1 = get_depth(s1);
|
||||||
size_t depth2 = get_depth(p2);
|
size_t depth2 = get_depth(s2);
|
||||||
|
|
||||||
// Adjust p1 and p2 to the same depth.
|
// Adjust s1 and s2 to the same depth.
|
||||||
if (depth1 > depth2)
|
if (depth1 > depth2)
|
||||||
{
|
{
|
||||||
p1 = adjust_depth(p1, depth1 - depth2);
|
s1 = adjust_depth(s1, depth1 - depth2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p2 = adjust_depth(p2, depth2 - depth1);
|
s2 = adjust_depth(s2, depth2 - depth1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now they're aligned to the same depth they can step towards the root together.
|
// Now they're aligned to the same depth they can step towards the root together.
|
||||||
while (p1 != p2)
|
while (s1 != s2)
|
||||||
{
|
{
|
||||||
p1 = p1->p_parent;
|
s1 = s1->p_parent;
|
||||||
p2 = p2->p_parent;
|
s2 = s2->p_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p1;
|
return s1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************************
|
//*******************************************
|
||||||
/// Find the depth of the state.
|
/// Find the depth of the state.
|
||||||
//*******************************************
|
//*******************************************
|
||||||
static size_t get_depth(etl::ifsm_state* p)
|
static size_t get_depth(etl::ifsm_state* s)
|
||||||
{
|
{
|
||||||
size_t depth = 0;
|
size_t depth = 0;
|
||||||
|
|
||||||
while (p != ETL_NULLPTR)
|
while (s != ETL_NULLPTR)
|
||||||
{
|
{
|
||||||
p = p->p_parent;
|
s = s->p_parent;
|
||||||
++depth;
|
++depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,15 +132,15 @@ namespace etl
|
|||||||
//*******************************************
|
//*******************************************
|
||||||
/// Align the depths of the states.
|
/// Align the depths of the states.
|
||||||
//*******************************************
|
//*******************************************
|
||||||
static etl::ifsm_state* adjust_depth(etl::ifsm_state* p, size_t offset)
|
static etl::ifsm_state* adjust_depth(etl::ifsm_state* s, size_t offset)
|
||||||
{
|
{
|
||||||
while (offset != 0U)
|
while (offset != 0U)
|
||||||
{
|
{
|
||||||
p = p->p_parent;
|
s = s->p_parent;
|
||||||
--offset;
|
--offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************************
|
//*******************************************
|
||||||
|
|||||||
@ -38,8 +38,8 @@ SOFTWARE.
|
|||||||
///\ingroup utilities
|
///\ingroup utilities
|
||||||
|
|
||||||
#define ETL_VERSION_MAJOR 20
|
#define ETL_VERSION_MAJOR 20
|
||||||
#define ETL_VERSION_MINOR 9
|
#define ETL_VERSION_MINOR 10
|
||||||
#define ETL_VERSION_PATCH 3
|
#define ETL_VERSION_PATCH 0
|
||||||
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||||
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||||
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ETL Embedded Template Library",
|
"name": "ETL Embedded Template Library",
|
||||||
"version": "20.9.3",
|
"version": "20.10.0",
|
||||||
"author s": {
|
"author s": {
|
||||||
"name": "John Wellbelove",
|
"name": "John Wellbelove",
|
||||||
"email": "john.wellbelove@etlcpp.com"
|
"email": "john.wellbelove@etlcpp.com"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name=Embedded Template Library ETL
|
name=Embedded Template Library ETL
|
||||||
version=20.9.3
|
version=20.10.0
|
||||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||||
license=MIT
|
license=MIT
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
===============================================================================
|
||||||
|
20.10.0
|
||||||
|
Added Hierarchical Finite State Machine (etl::hfsm) derived from etl::fsm
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
20.9.3
|
20.9.3
|
||||||
Fixed misspelt DBL_MAX macro.
|
Fixed misspelt DBL_MAX macro.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user