mdds
Toggle main menu visibility
Loading...
Searching...
No Matches
include
mdds
multi_type_vector
iterator_node.hpp
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
// SPDX-FileCopyrightText: 2021 - 2025 Kohei Yoshida
4
//
5
// SPDX-License-Identifier: MIT
6
7
#pragma once
8
9
namespace
mdds {
namespace
detail {
namespace
mtv {
10
17
template
<
typename
ParentT,
typename
SizeT>
18
struct
iterator_value_node
19
{
20
using
parent_type = ParentT;
21
using
size_type = SizeT;
22
23
mdds::mtv::element_t type;
24
size_type position;
25
size_type size;
26
mdds::mtv::base_element_block
* data;
27
28
iterator_value_node(
const
parent_type* parent, size_type block_index, mdds::mtv::container_id_t container_id)
29
: type(mdds::mtv::element_type_empty), position(0), size(0), data(
nullptr
),
30
__private_data(parent, block_index, container_id)
31
{}
32
33
void
swap(iterator_value_node& other)
34
{
35
std::swap(type, other.type);
36
std::swap(position, other.position);
37
std::swap(size, other.size);
38
std::swap(data, other.data);
39
40
__private_data.swap(other.__private_data);
41
}
42
43
struct
private_data
44
{
45
const
parent_type* parent;
46
size_type block_index;
47
mdds::mtv::container_id_t container_id;
48
49
private_data() : parent(
nullptr
), block_index(0), container_id(0)
50
{}
51
private_data(
const
parent_type* _parent, size_type _block_index, mdds::mtv::container_id_t _container_id)
52
: parent(_parent), block_index(_block_index), container_id(_container_id)
53
{}
54
55
void
swap(private_data& other)
56
{
57
std::swap(parent, other.parent);
58
std::swap(block_index, other.block_index);
59
std::swap(container_id, other.container_id);
60
}
61
};
62
private_data
__private_data;
63
64
bool
operator==(
const
iterator_value_node& other)
const
65
{
66
return
type == other.type && position == other.position && size == other.size && data == other.data &&
67
__private_data.parent == other.__private_data.parent &&
68
__private_data.block_index == other.__private_data.block_index;
69
}
70
};
71
72
template
<
typename
ParentT,
typename
SizeT>
73
struct
private_data_no_update
74
{
75
using
node_type =
iterator_value_node<ParentT, SizeT>
;
76
77
static
void
inc(node_type&)
78
{}
79
static
void
dec(node_type&)
80
{}
81
};
82
83
template
<
typename
ParentT,
typename
SizeT>
84
struct
private_data_forward_update
85
{
86
using
node_type =
iterator_value_node<ParentT, SizeT>
;
87
88
static
void
inc(node_type& nd)
89
{
90
++nd.__private_data.block_index;
91
}
92
93
static
void
dec(node_type& nd)
94
{
95
--nd.__private_data.block_index;
96
}
97
};
98
99
}}}
// namespace mdds::detail::mtv
100
101
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
mdds::mtv::base_element_block
Definition
types.hpp:231
mdds::detail::mtv::iterator_value_node::private_data
Definition
iterator_node.hpp:44
mdds::detail::mtv::iterator_value_node
Definition
iterator_node.hpp:19
mdds::detail::mtv::private_data_forward_update
Definition
iterator_node.hpp:85
mdds::detail::mtv::private_data_no_update
Definition
iterator_node.hpp:74
Generated on
for mdds by
1.17.0