-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathpiercedVectorStorage.hpp
More file actions
114 lines (86 loc) · 3.5 KB
/
Copy pathpiercedVectorStorage.hpp
File metadata and controls
114 lines (86 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*---------------------------------------------------------------------------*\
*
* bitpit
*
* Copyright (C) 2015-2021 OPTIMAD engineering Srl
*
* -------------------------------------------------------------------------
* License
* This file is part of bitpit.
*
* bitpit is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License v3 (LGPL)
* as published by the Free Software Foundation.
*
* bitpit is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with bitpit. If not, see <http://www.gnu.org/licenses/>.
*
\*---------------------------------------------------------------------------*/
#ifndef __BITPIT_PIERCED_VECTOR_STORAGE_HPP__
#define __BITPIT_PIERCED_VECTOR_STORAGE_HPP__
#include <cassert>
#include "piercedStorage.hpp"
#include "piercedVectorKernel.hpp"
#define __PVS_REFERENCE__ typename PiercedVectorStorage<value_t, id_t>::reference
#define __PVS_CONST_REFERENCE__ typename PiercedVectorStorage<value_t, id_t>::const_reference
#define __PVS_POINTER__ typename PiercedVectorStorage<value_t, id_t>::pointer
#define __PVS_CONST_POINTER__ typename PiercedVectorStorage<value_t, id_t>::const_pointer
namespace bitpit {
class BasePiercedVectorStorage {
public:
virtual ~BasePiercedVectorStorage() = default;
protected:
BasePiercedVectorStorage() = default;
};
/**
* \ingroup containers
*
* \brief Kernel of the pierced vector.
*/
template<typename value_t, typename id_t = long>
class PiercedVectorStorage : public BasePiercedVectorStorage,
public PiercedStorage<value_t, id_t> {
public:
// Contructors
using PiercedStorage<value_t, id_t>::PiercedStorage;
// Methods that extract the contents of the container
using PiercedStorage<value_t, id_t>::data;
__PVS_REFERENCE__ back();
__PVS_CONST_REFERENCE__ back() const;
__PVS_REFERENCE__ front();
__PVS_CONST_REFERENCE__ front() const;
__PVS_REFERENCE__ at(id_t id);
__PVS_CONST_REFERENCE__ at(id_t id) const;
__PVS_REFERENCE__ rawAt(std::size_t pos);
__PVS_CONST_REFERENCE__ rawAt(std::size_t pos) const;
__PVS_CONST_REFERENCE__ operator[](id_t id) const;
__PVS_REFERENCE__ operator[](id_t id);
using PiercedStorage<value_t, id_t>::find;
using PiercedStorage<value_t, id_t>::rawFind;
// Iterators
using PiercedStorage<value_t, id_t>::begin;
using PiercedStorage<value_t, id_t>::end;
using PiercedStorage<value_t, id_t>::cbegin;
using PiercedStorage<value_t, id_t>::cend;
using PiercedStorage<value_t, id_t>::rawBegin;
using PiercedStorage<value_t, id_t>::rawEnd;
using PiercedStorage<value_t, id_t>::rawCbegin;
using PiercedStorage<value_t, id_t>::rawCend;
// Methods for handing the synchronization
using PiercedStorage<value_t, id_t>::unsetKernel;
void setStaticKernel(const PiercedVectorKernel<id_t> *kernel);
void setDynamicKernel(const PiercedVectorKernel<id_t> *kernel, PiercedSyncMaster::SyncMode syncMode);
const PiercedVectorKernel<id_t> * getKernel() const;
// Dump and restore
using PiercedStorage<value_t, id_t>::dump;
using PiercedStorage<value_t, id_t>::restore;
};
}
// Include the implementation
#include "piercedVectorStorage.tpp"
#endif