Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e9b682

Browse files
2.3.0
* reworked serialization
1 parent647f2ab commit6e9b682

File tree

17 files changed

+979
-282
lines changed

17 files changed

+979
-282
lines changed

‎development/ffsm2/detail/containers/array.hpp‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@ namespace detail {
33

44
////////////////////////////////////////////////////////////////////////////////
55

6+
template<typename T>
7+
FFSM2_CONSTEXPR(11)
8+
T
9+
filler()noexcept{
10+
return T{};
11+
}
12+
13+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14+
15+
template<>
16+
FFSM2_CONSTEXPR(11)
17+
Short
18+
filler<Short>()noexcept{
19+
return INVALID_SHORT;
20+
}
21+
22+
//------------------------------------------------------------------------------
23+
624
template<typename T, Long NCapacity>
725
classStaticArrayTfinal {
826
template<typename>
@@ -30,7 +48,8 @@ class StaticArrayT final {
3048
FFSM2_CONSTEXPR(11)Indexcount()constnoexcept{return CAPACITY;}
3149

3250
FFSM2_CONSTEXPR(14)voidfill(const Item filler)noexcept;
33-
FFSM2_CONSTEXPR(14)voidclear()noexcept{fill(INVALID_SHORT);}
51+
FFSM2_CONSTEXPR(14)voidclear()noexcept{fill(filler<Item>());}
52+
FFSM2_CONSTEXPR(14)boolempty()constnoexcept;
3453

3554
FFSM2_CONSTEXPR(14) Iteratorbegin()noexcept{returnIterator(*this,first());}
3655
FFSM2_CONSTEXPR(11)CIteratorbegin()constnoexcept{returnCIterator(*this,first());}
@@ -76,8 +95,6 @@ class ArrayT final {
7695
staticconstexpr Index CAPACITY= NCapacity;
7796

7897
public:
79-
FFSM2_CONSTEXPR(14)voidclear()noexcept{ _count =0;}
80-
8198
template<typename... TArgs>
8299
FFSM2_CONSTEXPR(14)Indexemplace(const TArgs &... args)noexcept;
83100

@@ -92,8 +109,13 @@ class ArrayT final {
92109

93110
FFSM2_CONSTEXPR(11)Indexcount()constnoexcept{return _count;}
94111

112+
FFSM2_CONSTEXPR(14)voidclear()noexcept{ _count =0;}
113+
FFSM2_CONSTEXPR(11)boolempty()constnoexcept{return _count ==0;}
114+
115+
// SPECIFIC
95116
FFSM2_CONSTEXPR(14)ArrayT&operator += (const Item & item)noexcept;
96117
FFSM2_CONSTEXPR(14)ArrayT&operator += ( Item&& item)noexcept;
118+
// SPECIFIC
97119

98120
template<Long N>
99121
FFSM2_CONSTEXPR(14)ArrayT&operator += (const ArrayT<Item, N>& other)noexcept;

‎development/ffsm2/detail/containers/array.inl‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ StaticArrayT<T, NC>::fill(const Item filler) noexcept {
3535
item = filler;
3636
}
3737

38+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39+
40+
template<typename T, Long NC>
41+
FFSM2_CONSTEXPR(14)
42+
bool
43+
StaticArrayT<T, NC>::empty()constnoexcept {
44+
for (const Item& item : _items)
45+
if (item != filler<Item>())
46+
returnfalse;
47+
48+
returntrue;
49+
}
50+
3851
////////////////////////////////////////////////////////////////////////////////
3952

4053
template<typename T, Long NC>

‎development/ffsm2/detail/containers/bit_array.hpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class BitArrayT final {
1818

1919
FFSM2_CONSTEXPR(14)voidclear()noexcept;
2020

21+
FFSM2_CONSTEXPR(14)boolempty()constnoexcept;
22+
2123
template<typename TIndex>
2224
FFSM2_CONSTEXPR(14)boolget (const TIndex index)constnoexcept;
2325

@@ -37,6 +39,8 @@ template <>
3739
classBitArrayT<0>final {
3840
public:
3941
FFSM2_CONSTEXPR(14)voidclear()noexcept{}
42+
43+
FFSM2_CONSTEXPR(11)boolempty()constnoexcept{returntrue;}
4044
};
4145

4246
////////////////////////////////////////////////////////////////////////////////

‎development/ffsm2/detail/containers/bit_array.inl‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ namespace detail {
1010
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1111
//------------------------------------------------------------------------------
1212
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13-
13+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1414
////////////////////////////////////////////////////////////////////////////////
15+
//------------------------------------------------------------------------------
16+
//------------------------------------------------------------------------------
1517
////////////////////////////////////////////////////////////////////////////////
1618
// COMMON
1719

20+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21+
1822
template<unsigned NCapacity>
1923
FFSM2_CONSTEXPR(14)
2024
void
@@ -24,6 +28,21 @@ BitArrayT<NCapacity>::clear() noexcept {
2428
}
2529

2630
//------------------------------------------------------------------------------
31+
32+
template<unsigned NCapacity>
33+
FFSM2_CONSTEXPR(14)
34+
bool
35+
BitArrayT<NCapacity>::empty()constnoexcept {
36+
for (constuint8_t& unit : _storage)
37+
if (unit !=uint8_t{0})
38+
returnfalse;
39+
40+
returntrue;
41+
}
42+
43+
//------------------------------------------------------------------------------
44+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2746
//------------------------------------------------------------------------------
2847

2948
template<unsigned NCapacity>
@@ -72,6 +91,12 @@ BitArrayT<NCapacity>::clear(const TIndex index) noexcept {
7291
_storage[unit] &= ~mask;
7392
}
7493

94+
//------------------------------------------------------------------------------
95+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96+
//------------------------------------------------------------------------------
97+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
98+
//------------------------------------------------------------------------------
99+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
75100
////////////////////////////////////////////////////////////////////////////////
76101

77102
}

‎development/ffsm2/detail/containers/task_list.hpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ class TaskListT {
119119
using Item= TaskT<Payload>;
120120

121121
public:
122+
FFSM2_CONSTEXPR(14)voidclear()noexcept;
123+
122124
template<typename... TArgs>
123125
FFSM2_CONSTEXPR(14)Indexemplace(TArgs&&... args)noexcept;
124126

@@ -127,16 +129,17 @@ class TaskListT {
127129
FFSM2_CONSTEXPR(14) Item&operator[] (const Index i)noexcept;
128130
FFSM2_CONSTEXPR(11)const Item&operator[] (const Index i)constnoexcept;
129131

130-
FFSM2_CONSTEXPR(11)Indexcount()constnoexcept{return _count;}
132+
FFSM2_CONSTEXPR(11)Indexcount()constnoexcept{return _count;}
133+
FFSM2_CONSTEXPR(11)boolempty()constnoexcept{return _count ==0;}
131134

132135
private:
133136
FFSM2_IF_ASSERT(voidverifyStructure(const Index occupied = INVALID)constnoexcept);
134137

135138
private:
136139
Index _vacantHead =0;
137140
Index _vacantTail =0;
138-
Index _last =0;
139-
Index _count =0;
141+
Index _last =0;
142+
Index _count =0;
140143
Item _items[CAPACITY] {};
141144
};
142145

‎development/ffsm2/detail/containers/task_list.inl‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ namespace detail {
55

66
////////////////////////////////////////////////////////////////////////////////
77

8+
template<typename TP, Long NC>
9+
FFSM2_CONSTEXPR(14)
10+
void
11+
TaskListT<TP, NC>::clear()noexcept {
12+
_vacantHead=0;
13+
_vacantTail=0;
14+
_last=0;
15+
_count=0;
16+
}
17+
18+
//------------------------------------------------------------------------------
19+
820
template<typename TP, Long NC>
921
template<typename... TA>
1022
FFSM2_CONSTEXPR(14)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp