Loading...
Searching...
No Matches
piercedStorageIterator.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_ITERATOR_TPP__
26#define __BITPIT_PIERCED_STORAGE_ITERATOR_TPP__
27
28namespace bitpit {
29
33template<typename value_t, typename id_t, typename value_no_cv_t>
38
45template<typename value_t, typename id_t, typename value_no_cv_t>
46template<typename other_value_t, typename std::enable_if<std::is_const<value_t>::value && !std::is_const<other_value_t>::value && std::is_same<other_value_t, typename std::remove_cv<value_t>::type>::value, int>::type>
51
56template<typename value_t, typename id_t, typename value_no_cv_t>
58 : PiercedKernelIterator<id_t>(storage->getKernel(), pos), m_storage(storage)
59{
60}
61
66template<typename value_t, typename id_t, typename value_no_cv_t>
68 : PiercedKernelIterator<id_t>(iterator), m_storage(storage)
69{
70 assert(&(iterator.getKernel()) == &(storage->getKernel()));
71}
72
79template<typename value_t, typename id_t, typename value_no_cv_t>
81{
83
84 std::swap(m_storage, other.m_storage);
85}
86
92template<typename value_t, typename id_t, typename value_no_cv_t>
97
103template<typename value_t, typename id_t, typename value_no_cv_t>
108
115template<typename value_t, typename id_t, typename value_no_cv_t>
117{
118 if (*this == m_storage->getKernel().end()) {
119 throw std::out_of_range("Iterator points to an invalid position.");
120 }
121
122 std::size_t rawIndex = getRawIndex();
123
124 return m_storage->rawAt(rawIndex, k);
125}
126
134template<typename value_t, typename id_t, typename value_no_cv_t>
141
149template<typename value_t, typename id_t, typename value_no_cv_t>
151{
152 std::size_t rawIndex = getRawIndex();
153 PiercedStorageIterator tmp(m_storage, rawIndex);
154
155 ++(*this);
156
157 return tmp;
158}
159
167template<typename value_t, typename id_t, typename value_no_cv_t>
174
182template<typename value_t, typename id_t, typename value_no_cv_t>
184{
185 std::size_t rawIndex = getRawIndex();
186 PiercedStorageIterator tmp(m_storage, rawIndex);
187
188 --(*this);
189
190 return tmp;
191}
192
198template<typename value_t, typename id_t, typename value_no_cv_t>
200{
201 std::size_t rawIndex = getRawIndex();
202
203 return m_storage->rawAt(rawIndex, 0);
204}
205
211template<typename value_t, typename id_t, typename value_no_cv_t>
213{
214 std::size_t rawIndex = getRawIndex();
215
216 return m_storage->rawData(rawIndex);
217}
218
225template<typename value_t, typename id_t, typename value_no_cv_t>
226template<typename other_value_t, typename std::enable_if<std::is_const<value_t>::value && !std::is_const<other_value_t>::value && std::is_same<other_value_t, typename std::remove_cv<value_t>::type>::value, int>::type>
234
235}
236
237#endif
Iterator for the class PiercedKernel.
void swap(PiercedKernelIterator &other) noexcept
PiercedKernelIterator & operator++()
PiercedKernelIterator & operator--()
const kernel_type & getKernel() const
Iterator for the class PiercedStorage.
PiercedStorageIterator & operator++()
void swap(PiercedStorageIterator &other) noexcept
__PSI_REFERENCE__ getValue(std::size_t k=0) const
const PiercedKernelIterator< id_t > & getKernelIterator() const
PiercedStorageIterator & operator--()
--- layout: doxygen_footer ---