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-2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::PtrMap
29 
30 Description
31  A HashTable of pointers to objects of type <T> with a label key.
32 
33 See 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 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class PtrMap Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class T>
53 class PtrMap
54 :
55  public HashPtrTable<T, label, Hash<label>>
56 {
57 public:
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 with default table capacity
69  PtrMap()
70  :
71  parent_type()
72  {}
73 
74  //- Construct with given initial table capacity
75  explicit PtrMap(const label size)
76  :
78  {}
79 
80  //- Construct from Istream
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
93  PtrMap(this_type&& map)
94  :
95  parent_type(std::move(map))
96  {}
97 
98 
99  // Member Operators
101  //- Copy assignment
102  void operator=(const this_type& rhs)
103  {
105  }
106 
107  //- Move assignment
108  void operator=(this_type&& rhs)
109  {
110  parent_type::operator=(std::move(rhs));
111  }
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************************************************************* //
void operator=(const this_type &rhs)
Copy assignment.
Definition: PtrMap.H:111
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
HashPtrTable< T, label, Hash< label > > parent_type
The template instance used for the parent HashTable.
Definition: PtrMap.H:60
A HashTable of pointers to objects of type <T> with a label key.
Definition: HashTableFwd.H:42
label size() const noexcept
The number of elements in table.
Definition: HashTableI.H:45
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers...
Definition: HashPtrTable.H:51
A HashTable similar to std::unordered_map.
Definition: HashTable.H:102
void operator=(const this_type &rhs)
Copy assignment.
PtrMap()
Default construct with default table capacity.
Definition: PtrMap.H:68
PtrMap< T > this_type
The template instance used for this PtrMap.
Definition: PtrMap.H:55
Namespace for OpenFOAM.