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 PtrMap_H
39 #define 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
60  typedef PtrMap<T> this_type;
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  :
77  parent_type(size)
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
100 
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 // ************************************************************************* //
Foam::PtrMap::PtrMap
PtrMap(Istream &is)
Construct from Istream.
Definition: PtrMap.H:80
Foam::PtrMap::operator=
void operator=(this_type &&rhs)
Move assignment.
Definition: PtrMap.H:107
Foam::PtrMap::operator=
void operator=(const this_type &rhs)
Copy assignment.
Definition: PtrMap.H:101
Foam::PtrMap::PtrMap
PtrMap(this_type &&map)
Move construct.
Definition: PtrMap.H:92
Foam::PtrMap::PtrMap
PtrMap(const label size)
Construct with given initial table capacity.
Definition: PtrMap.H:74
Foam::PtrMap::PtrMap
PtrMap()
Default construct with default table capacity.
Definition: PtrMap.H:68
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::HashPtrTable::operator=
void operator=(const this_type &rhs)
Copy assignment.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::HashPtrTable
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Definition: HashPtrTable.H:54
Foam::PtrMap::parent_type
HashPtrTable< T, label, Hash< label > > parent_type
The template instance used for the parent HashTable.
Definition: PtrMap.H:62
Foam::PtrMap::this_type
PtrMap< T > this_type
The template instance used for this PtrMap.
Definition: PtrMap.H:59
HashPtrTable.H
Foam::PtrMap::PtrMap
PtrMap(const this_type &map)
Copy construct.
Definition: PtrMap.H:86
Foam::PtrMap
A HashTable of pointers to objects of type <T> with a label key.
Definition: HashTableFwd.H:48