Skip to content

Commit 92735e2

Browse files
2.3.2
* removed superfluous #include
1 parent d4a0666 commit 92735e2

File tree

6 files changed

+35
-40
lines changed

6 files changed

+35
-40
lines changed

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
VERSION: '11'
8181
}
8282
- {
83-
OS: ubuntu-22.04,
83+
OS: ubuntu-20.04,
8484
CC: clang-12,
8585
CXX: clang++-12
8686
}

development/hfsm2/detail/shared/utility.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ template <bool B,
5151
typename TF>
5252
using Conditional = typename ConditionalT<B, TT, TF>::Type;
5353

54+
//------------------------------------------------------------------------------
55+
56+
template <typename, typename>
57+
struct IsSameT final {
58+
static constexpr bool Value = false;
59+
};
60+
61+
template <typename T>
62+
struct IsSameT<T, T> final {
63+
static constexpr bool Value = true;
64+
};
65+
5466
////////////////////////////////////////////////////////////////////////////////
5567

5668
template <typename T>

development/hfsm2/detail/structure/state.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct S_
161161

162162
using Empty = EmptyT<TArgs>;
163163

164-
static HFSM2_CONSTEXPR(11) bool isBare() noexcept { return std::is_base_of<Head, Empty>::value; }
164+
static HFSM2_CONSTEXPR(11) bool isBare() noexcept { return IsSameT<Head, Empty>::Value; }
165165

166166
HFSM2_IF_TYPEINDEX(const std::type_index TYPE = isBare() ? typeid(None) : typeid(Head));
167167

development/hfsm2/machine_dev.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// HFSM2 (hierarchical state machine for games and interactive applications)
2-
// 2.3.1 (2023-09-23)
2+
// 2.3.2 (2023-10-25)
33
//
44
// Created by Andrew Gresyk
55
//
@@ -33,7 +33,7 @@
3333

3434
#define HFSM2_VERSION_MAJOR 2
3535
#define HFSM2_VERSION_MINOR 3
36-
#define HFSM2_VERSION_PATCH 1
36+
#define HFSM2_VERSION_PATCH 2
3737

3838
#define HFSM2_VERSION (10000 * HFSM2_VERSION_MAJOR + 100 * HFSM2_VERSION_MINOR + HFSM2_VERSION_PATCH)
3939

@@ -44,7 +44,6 @@
4444
#ifndef HFSM2_DISABLE_TYPEINDEX
4545
#include <typeindex>
4646
#endif
47-
#include <type_traits> // std::aligned_storage<>
4847

4948
#if defined _DEBUG && _MSC_VER
5049
#include <intrin.h> // __debugbreak()

include/hfsm2/machine.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// HFSM2 (hierarchical state machine for games and interactive applications)
2-
// 2.3.1 (2023-09-23)
2+
// 2.3.2 (2023-10-25)
33
//
44
// Created by Andrew Gresyk
55
//
@@ -33,7 +33,7 @@
3333

3434
#define HFSM2_VERSION_MAJOR 2
3535
#define HFSM2_VERSION_MINOR 3
36-
#define HFSM2_VERSION_PATCH 1
36+
#define HFSM2_VERSION_PATCH 2
3737

3838
#define HFSM2_VERSION (10000 * HFSM2_VERSION_MAJOR + 100 * HFSM2_VERSION_MINOR + HFSM2_VERSION_PATCH)
3939

@@ -44,7 +44,6 @@
4444
#ifndef HFSM2_DISABLE_TYPEINDEX
4545
#include <typeindex>
4646
#endif
47-
#include <type_traits> // std::aligned_storage<>
4847

4948
#if defined _DEBUG && _MSC_VER
5049
#include <intrin.h> // __debugbreak()
@@ -408,6 +407,16 @@ template <bool B,
408407
typename TF>
409408
using Conditional = typename ConditionalT<B, TT, TF>::Type;
410409

410+
template <typename, typename>
411+
struct IsSameT final {
412+
static constexpr bool Value = false;
413+
};
414+
415+
template <typename T>
416+
struct IsSameT<T, T> final {
417+
static constexpr bool Value = true;
418+
};
419+
411420
template <typename T>
412421
struct RemoveConstT final {
413422
using Type = T;
@@ -7798,7 +7807,7 @@ struct S_
77987807

77997808
using Empty = EmptyT<TArgs>;
78007809

7801-
static HFSM2_CONSTEXPR(11) bool isBare() noexcept { return std::is_base_of<Head, Empty>::value; }
7810+
static HFSM2_CONSTEXPR(11) bool isBare() noexcept { return IsSameT<Head, Empty>::Value; }
78027811

78037812
HFSM2_IF_TYPEINDEX(const std::type_index TYPE = isBare() ? typeid(None) : typeid(Head));
78047813

test/test_debug.cpp

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using FSM = M::Root<S(Apex),
3333
S(R_1),
3434
S(R_2)
3535
>,
36-
M::Composite<S(C),
36+
M::CompositePeers<
3737
S(C_1),
3838
S(C_2)
3939
>,
@@ -55,7 +55,6 @@ using FSM = M::Root<S(Apex),
5555
static_assert(FSM::regionId<Apex>() == 0, "");
5656
static_assert(FSM::regionId<O >() == 1, "");
5757
static_assert(FSM::regionId<R >() == 2, "");
58-
static_assert(FSM::regionId<C >() == 3, "");
5958
static_assert(FSM::regionId<U >() == 4, "");
6059
static_assert(FSM::regionId<N >() == 5, "");
6160

@@ -65,7 +64,6 @@ static_assert(FSM::stateId<O >() == 2, "");
6564
static_assert(FSM::stateId<R >() == 3, "");
6665
static_assert(FSM::stateId<R_1 >() == 4, "");
6766
static_assert(FSM::stateId<R_2 >() == 5, "");
68-
static_assert(FSM::stateId<C >() == 6, "");
6967
static_assert(FSM::stateId<C_1 >() == 7, "");
7068
static_assert(FSM::stateId<C_2 >() == 8, "");
7169
static_assert(FSM::stateId<U >() == 9, "");
@@ -83,7 +81,6 @@ struct O : FSM::State {};
8381
struct R : FSM::State {};
8482
struct R_1 : FSM::State {};
8583
struct R_2 : FSM::State {};
86-
struct C : FSM::State {};
8784
struct C_1 : FSM::State {};
8885
struct C_2 : FSM::State {};
8986
struct U : FSM::State {};
@@ -159,7 +156,6 @@ const Types all = {
159156
FSM::stateId<R >(),
160157
FSM::stateId<R_1>(),
161158
FSM::stateId<R_2>(),
162-
FSM::stateId<C >(),
163159
FSM::stateId<C_1>(),
164160
FSM::stateId<C_2>(),
165161
FSM::stateId<U >(),
@@ -200,8 +196,7 @@ TEST_CASE("FSM.Debug") {
200196
hfsm2::StructureEntry{ false, L"", "R"},
201197
hfsm2::StructureEntry{ false, L" ║ ├ ", "R_1"},
202198
hfsm2::StructureEntry{ false, L" ║ └ ", "R_2"},
203-
hfsm2::StructureEntry{ false, L"", "C"},
204-
hfsm2::StructureEntry{ false, L" ║ ├ ", "C_1"},
199+
hfsm2::StructureEntry{ false, L" ╟ ┬ ", "C_1"},
205200
hfsm2::StructureEntry{ false, L" ║ └ ", "C_2"},
206201
hfsm2::StructureEntry{ false, L"", "U"},
207202
hfsm2::StructureEntry{ false, L" ║ ├ ", "U_1"},
@@ -226,7 +221,6 @@ TEST_CASE("FSM.Debug") {
226221
-1,
227222
-1,
228223
-1,
229-
-1,
230224
});
231225
}
232226

@@ -252,7 +246,7 @@ TEST_CASE("FSM.Debug") {
252246
{ FSM::stateId<O >(), Event::Type::ENTRY_GUARD },
253247
{ FSM::stateId<R >(), Event::Type::ENTRY_GUARD },
254248
{ FSM::stateId<R_1 >(), Event::Type::ENTRY_GUARD },
255-
{ FSM::stateId<C >(), Event::Type::ENTRY_GUARD },
249+
{ hfsm2::StateID{6} , Event::Type::ENTRY_GUARD },
256250
{ FSM::stateId<C_1 >(), Event::Type::ENTRY_GUARD },
257251
{ FSM::stateId<U >(), Event::Type::ENTRY_GUARD },
258252
{ FSM::stateId<U_1 >(), Event::Type::ENTRY_GUARD },
@@ -264,7 +258,7 @@ TEST_CASE("FSM.Debug") {
264258
{ FSM::stateId<O >(), Event::Type::ENTER },
265259
{ FSM::stateId<R >(), Event::Type::ENTER },
266260
{ FSM::stateId<R_1 >(), Event::Type::ENTER },
267-
{ FSM::stateId<C >(), Event::Type::ENTER },
261+
{ hfsm2::StateID{6} , Event::Type::ENTER },
268262
{ FSM::stateId<C_1 >(), Event::Type::ENTER },
269263
{ FSM::stateId<U >(), Event::Type::ENTER },
270264
{ FSM::stateId<U_1 >(), Event::Type::ENTER },
@@ -276,7 +270,7 @@ TEST_CASE("FSM.Debug") {
276270
FSM::stateId<O >(),
277271
FSM::stateId<R >(),
278272
FSM::stateId<R_1 >(),
279-
FSM::stateId<C >(),
273+
hfsm2::StateID{6} ,
280274
FSM::stateId<C_1 >(),
281275
FSM::stateId<U >(),
282276
FSM::stateId<U_1 >(),
@@ -288,24 +282,6 @@ TEST_CASE("FSM.Debug") {
288282
FSM::stateId<I >(),
289283
});
290284

291-
assertStructure(machine.structure(), {
292-
hfsm2::StructureEntry{ true, L"", "Apex"},
293-
hfsm2::StructureEntry{ false, L"", "I"},
294-
hfsm2::StructureEntry{ true, L"", "O"},
295-
hfsm2::StructureEntry{ true, L"", "R"},
296-
hfsm2::StructureEntry{ true, L" ║ ├ ", "R_1"},
297-
hfsm2::StructureEntry{ false, L" ║ └ ", "R_2"},
298-
hfsm2::StructureEntry{ true, L"", "C"},
299-
hfsm2::StructureEntry{ true, L" ║ ├ ", "C_1"},
300-
hfsm2::StructureEntry{ false, L" ║ └ ", "C_2"},
301-
hfsm2::StructureEntry{ true, L"", "U"},
302-
hfsm2::StructureEntry{ true, L" ║ ├ ", "U_1"},
303-
hfsm2::StructureEntry{ false, L" ║ └ ", "U_2"},
304-
hfsm2::StructureEntry{ true, L"", "N"},
305-
hfsm2::StructureEntry{ false, L"", "N_1"},
306-
hfsm2::StructureEntry{ true, L"", "N_2"},
307-
});
308-
309285
assertActivity(machine.activityHistory(), {
310286
+2,
311287
-1,
@@ -314,7 +290,6 @@ TEST_CASE("FSM.Debug") {
314290
+1,
315291
-2,
316292
+1,
317-
+1,
318293
-2,
319294
+1,
320295
+1,
@@ -332,7 +307,7 @@ TEST_CASE("FSM.Debug") {
332307
{ FSM::stateId<R_1 >(), Event::Type::EXIT },
333308
{ FSM::stateId<R >(), Event::Type::EXIT },
334309
{ FSM::stateId<C_1 >(), Event::Type::EXIT },
335-
{ FSM::stateId<C >(), Event::Type::EXIT },
310+
{ hfsm2::StateID{6} , Event::Type::EXIT },
336311
{ FSM::stateId<U_1 >(), Event::Type::EXIT },
337312
{ FSM::stateId<U >(), Event::Type::EXIT },
338313
{ FSM::stateId<N_2 >(), Event::Type::EXIT },

0 commit comments

Comments
 (0)