Loading...
Searching...
No Matches
PtrMap.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2017-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::PtrMap
29
30Description
31 A HashTable of pointers to objects of type <T> with a label key.
32
33See also
34 Map, HashPtrTable
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_PtrMap_H
39#define Foam_PtrMap_H
40
41#include "HashPtrTable.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
47
48/*---------------------------------------------------------------------------*\
49 Class PtrMap Declaration
50\*---------------------------------------------------------------------------*/
51
52template<class T>
53class PtrMap
54:
55 public HashPtrTable<T, label, Hash<label>>
56{
57public:
58
59 //- The template instance used for this PtrMap
61
62 //- The template instance used for the parent HashTable
64
65
66 // Constructors
67
68 //- Default construct: empty without allocation (capacity=0)
69 constexpr PtrMap() noexcept = default;
70
71 //- Construct empty without allocation (capacity=0)
72 explicit constexpr PtrMap(Foam::zero) noexcept : this_type() {}
74 //- Construct empty with given initial table capacity
75 explicit PtrMap(const label initialCapacity)
76 :
77 parent_type(initialCapacity)
78 {}
79
80 //- Construct from Istream (with default initial table capacity)
81 PtrMap(Istream& is)
82 :
83 parent_type(is)
84 {}
85
86 //- Copy construct
87 PtrMap(const this_type& map)
88 :
89 parent_type(map)
90 {}
91
92 //- Move construct
94 :
95 parent_type(std::move(map))
96 {}
97
98
99 // Member Operators
100
101 //- Copy assignment
103 {
105 }
106
107 //- Move assignment
108 void operator=(this_type&& rhs)
109 {
110 parent_type::operator=(std::move(rhs));
111 }
112};
114
115// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116
117} // End namespace Foam
118
119// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120
121#endif
122
123// ************************************************************************* //
constexpr HashPtrTable() noexcept=default
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
PtrMap< T > this_type
The template instance used for this PtrMap.
Definition PtrMap.H:55
HashPtrTable< T, label, Hash< label > > parent_type
The template instance used for the parent HashTable.
Definition PtrMap.H:60
PtrMap(const label initialCapacity)
Construct empty with given initial table capacity.
Definition PtrMap.H:78
PtrMap(this_type &&map) noexcept
Move construct.
Definition PtrMap.H:102
void operator=(this_type &&rhs)
Move assignment.
Definition PtrMap.H:121
PtrMap(Istream &is)
Construct from Istream (with default initial table capacity).
Definition PtrMap.H:86
PtrMap(const this_type &map)
Copy construct.
Definition PtrMap.H:94
void operator=(const this_type &rhs)
Copy assignment.
Definition PtrMap.H:113
constexpr PtrMap() noexcept=default
Default construct: empty without allocation (capacity=0).
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
const direction noexcept
Definition scalarImpl.H:265