acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
packset.h
1
#pragma once
2
3
4
template
<
typename
ELEMENT1,
typename
ELEMENT2,
typename
ARRAY = array < ELEMENT2 > >
5
class
packset :
6
public
map_base < ELEMENT1, ARRAY >
7
{
8
public
:
9
10
11
using
BASE_MAP = map_base < ELEMENT1, ARRAY >;
12
using
ARG_ELEMENT1 =
typename
BASE_MAP::ARG_KEY;
13
using
ARG_ELEMENT2 =
typename
BASE_MAP::PAYLOAD::BASE_ARG_TYPE;
14
15
packset();
16
17
18
void
pack(ARG_ELEMENT1
atom
, ARG_ELEMENT2
item
);
19
20
21
::collection::count get_pack_count();
22
::collection::count get_item_count();
23
24
25
};
26
27
28
template
<
typename
ELEMENT1,
typename
ELEMENT2,
typename
ARRAY >
29
packset < ELEMENT1, ELEMENT2, ARRAY >
::packset
()
30
{
31
32
}
33
34
35
template
<
typename
ELEMENT1,
typename
ELEMENT2,
typename
ARRAY >
36
void
packset < ELEMENT1, ELEMENT2, ARRAY > ::pack(ARG_ELEMENT1
atom
, ARG_ELEMENT2
item
)
37
{
38
39
this->operator[](
atom
).add(
item
);
40
41
}
42
43
44
template
<
typename
ELEMENT1,
typename
ELEMENT2,
typename
ARRAY >
45
::collection::count packset < ELEMENT1, ELEMENT2, ARRAY > ::get_pack_count()
46
{
47
48
return
this->get_size();
49
50
}
51
52
53
template
<
typename
ELEMENT1,
typename
ELEMENT2,
typename
ARRAY >
54
::collection::count packset < ELEMENT1, ELEMENT2, ARRAY > ::get_item_count()
55
{
56
57
::collection::count count = 0;
58
59
auto
iterator
= this->get_start();
60
61
while
(
iterator
!=
nullptr
)
62
{
63
64
count +=
iterator
->element2().get_count();
65
66
this->get_next(
iterator
);
67
68
}
69
70
return
count;
71
72
}
73
74
75
atom
Definition
atom.h:237
item
Definition
item.h:93
packset
Definition
packset.h:7
iterator
Definition
std_iterator.h:49
prototype
collection
packset.h
Generated by
1.17.0