Loading...
Searching...
No Matches
piercedVectorStorage.hpp
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_VECTOR_STORAGE_HPP__
26#define __BITPIT_PIERCED_VECTOR_STORAGE_HPP__
27
28#include <cassert>
29
30#include "piercedStorage.hpp"
31#include "piercedVectorKernel.hpp"
32
33#define __PVS_REFERENCE__ typename PiercedVectorStorage<value_t, id_t>::reference
34#define __PVS_CONST_REFERENCE__ typename PiercedVectorStorage<value_t, id_t>::const_reference
35#define __PVS_POINTER__ typename PiercedVectorStorage<value_t, id_t>::pointer
36#define __PVS_CONST_POINTER__ typename PiercedVectorStorage<value_t, id_t>::const_pointer
37
38namespace bitpit {
39
41
42public:
43 virtual ~BasePiercedVectorStorage() = default;
44
45protected:
46 BasePiercedVectorStorage() = default;
47
48};
49
55template<typename value_t, typename id_t = long>
57 public PiercedStorage<value_t, id_t> {
58
59public:
60 // Contructors
61 using PiercedStorage<value_t, id_t>::PiercedStorage;
62
63 // Methods that extract the contents of the container
64 using PiercedStorage<value_t, id_t>::data;
65
66 __PVS_REFERENCE__ back();
67 __PVS_CONST_REFERENCE__ back() const;
68
69 __PVS_REFERENCE__ front();
70 __PVS_CONST_REFERENCE__ front() const;
71
72 __PVS_REFERENCE__ at(id_t id);
73 __PVS_CONST_REFERENCE__ at(id_t id) const;
74
75 __PVS_REFERENCE__ rawAt(std::size_t pos);
76 __PVS_CONST_REFERENCE__ rawAt(std::size_t pos) const;
77
78 __PVS_CONST_REFERENCE__ operator[](id_t id) const;
79 __PVS_REFERENCE__ operator[](id_t id);
80
81 using PiercedStorage<value_t, id_t>::find;
82
83 using PiercedStorage<value_t, id_t>::rawFind;
84
85 // Iterators
86 using PiercedStorage<value_t, id_t>::begin;
87 using PiercedStorage<value_t, id_t>::end;
88 using PiercedStorage<value_t, id_t>::cbegin;
89 using PiercedStorage<value_t, id_t>::cend;
90
91 using PiercedStorage<value_t, id_t>::rawBegin;
92 using PiercedStorage<value_t, id_t>::rawEnd;
93 using PiercedStorage<value_t, id_t>::rawCbegin;
94 using PiercedStorage<value_t, id_t>::rawCend;
95
96 // Methods for handing the synchronization
97 using PiercedStorage<value_t, id_t>::unsetKernel;
98
101 const PiercedVectorKernel<id_t> * getKernel() const;
102
103 // Dump and restore
104 using PiercedStorage<value_t, id_t>::dump;
105 using PiercedStorage<value_t, id_t>::restore;
106
107};
108
109}
110
111// Include the implementation
112#include "piercedVectorStorage.tpp"
113
114#endif
Base class for pierced vector kernels.
void unsetKernel(bool release=true)
Metafunction for generating a pierced storage.
raw_iterator rawBegin() noexcept
raw_iterator rawEnd() noexcept
void restore(std::istream &stream)
const_iterator cend() const noexcept
iterator end() noexcept
iterator rawFind(std::size_t pos) noexcept
iterator find(const id_t &id) noexcept
iterator begin() noexcept
raw_const_iterator rawCbegin() const noexcept
void dump(std::ostream &stream) const
const_iterator cbegin() const noexcept
raw_const_iterator rawCend() const noexcept
Kernel of the pierced vector.
Kernel of the pierced vector.
void setStaticKernel(const PiercedVectorKernel< id_t > *kernel)
__PVS_REFERENCE__ at(id_t id)
const PiercedVectorKernel< id_t > * getKernel() const
__PVS_REFERENCE__ rawAt(std::size_t pos)
void setDynamicKernel(const PiercedVectorKernel< id_t > *kernel, PiercedSyncMaster::SyncMode syncMode)
__PVS_CONST_REFERENCE__ operator[](id_t id) const
--- layout: doxygen_footer ---