Loading...
Searching...
No Matches
piercedStorageRange.tpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25#ifndef __BITPIT_PIERCED_STORAGE_RANGE_TPP__
26#define __BITPIT_PIERCED_STORAGE_RANGE_TPP__
27
28namespace bitpit {
29
33template<typename value_t, typename id_t, typename value_no_cv_t>
39
45template<typename value_t, typename id_t, typename value_no_cv_t>
47{
48 initialize(storage);
49}
50
58template<typename value_t, typename id_t, typename value_no_cv_t>
60{
61 initialize(storage, first, last);
62}
63
70template<typename value_t, typename id_t, typename value_no_cv_t>
72{
73 initialize(begin, end);
74}
75
81template<typename value_t, typename id_t, typename value_no_cv_t>
83{
84 PiercedKernelRange<id_t>::initialize(&(storage->getKernel()));
85
86 m_begin = storage->begin();
87 m_end = storage->end();
88}
89
97template<typename value_t, typename id_t, typename value_no_cv_t>
98void PiercedStorageRange<value_t, id_t, value_no_cv_t>::initialize(const storage_t *storage, id_t first, id_t last)
99{
100 PiercedKernelRange<id_t>::initialize(&(storage->getKernel()), first, last);
101
102 m_begin = storage->find(first);
103 m_end = ++(storage->find(last));
104}
105
112template<typename value_t, typename id_t, typename value_no_cv_t>
114{
115 if (&(begin.getStorage()) != &(end.getStorage())) {
116 throw std::runtime_error("The two iterators belong to different storages");
117 }
118
119 PiercedKernelRange<id_t>::initialize(begin.getKernelIterator(), end.getKernelIterator());
120
121 m_begin = begin;
122 m_end = end;
123}
124
131template<typename value_t, typename id_t, typename value_no_cv_t>
133{
135
136 std::swap(m_begin, other.m_begin);
137 std::swap(m_end, other.m_end);
138}
139
145template<typename value_t, typename id_t, typename value_no_cv_t>
150
156template<typename value_t, typename id_t, typename value_no_cv_t>
157template<typename U, typename U_no_cv,
158 typename std::enable_if<std::is_same<U, U_no_cv>::value, int>::type>
163
171template<typename value_t, typename id_t, typename value_no_cv_t>
172template<typename U, typename U_no_cv,
173 typename std::enable_if<std::is_same<U, U_no_cv>::value, int>::type>
178
184template<typename value_t, typename id_t, typename value_no_cv_t>
189
197template<typename value_t, typename id_t, typename value_no_cv_t>
202
208template<typename value_t, typename id_t, typename value_no_cv_t>
213
221template<typename value_t, typename id_t, typename value_no_cv_t>
226
227}
228
229#endif
The PiercedKernelRange allow to iterate using range-based loops over a PiercedStorage.
void initialize(const kernel_t *kernel)
void swap(PiercedKernelRange &other) noexcept
The PiercedStorageRange allow to iterate using range-based loops over a PiercedStorage.
void swap(PiercedStorageRange &other) noexcept
const_iterator cbegin() const noexcept
const PiercedKernelRange< id_t > & getKernelRange() const
const_iterator cend() const noexcept
void initialize(const storage_t *storage)
--- layout: doxygen_footer ---