Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
containers
HashTables
HashPtrTable
HashPtrTable.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::HashPtrTable
26
27
Description
28
A HashTable specialization for hashing pointers.
29
30
SourceFiles
31
HashPtrTable.C
32
HashPtrTableIO.C
33
34
\*---------------------------------------------------------------------------*/
35
36
#ifndef HashPtrTable_H
37
#define HashPtrTable_H
38
39
#include <
OpenFOAM/HashTable.H
>
40
41
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43
namespace
Foam
44
{
45
46
class
Istream;
47
class
Ostream;
48
49
// Forward declaration of friend functions and operators
50
51
template
<
class
T,
class
Key,
class
Hash>
class
HashPtrTable;
52
53
template
<
class
T,
class
Key,
class
Hash>
54
Istream&
operator>>
(Istream&, HashPtrTable<T, Key, Hash>&);
55
56
template
<
class
T,
class
Key,
class
Hash>
57
Ostream& operator<<(Ostream&, const HashPtrTable<T, Key, Hash>&);
58
59
60
/*---------------------------------------------------------------------------*\
61
Class HashPtrTable Declaration
62
\*---------------------------------------------------------------------------*/
63
64
template
<
class
T,
class
Key=word,
class
Hash=
string
::hash>
65
class
HashPtrTable
66
:
67
public
HashTable
<T*, Key, Hash>
68
{
69
// Private member functions
70
71
//- Read from Istream using given Istream constructor class
72
template
<
class
INew>
73
void
read(
Istream
&,
const
INew
& inewt);
74
75
76
public
:
77
78
typedef
typename
HashTable<T*, Key, Hash>::iterator
iterator
;
79
typedef
typename
HashTable<T*, Key, Hash>::const_iterator
const_iterator
;
80
81
82
// Constructors
83
84
//- Construct given initial table size
85
HashPtrTable
(
const
label
size
= 128);
86
87
//- Construct from Istream using given Istream constructor class
88
template
<
class
INew>
89
HashPtrTable
(
Istream
&,
const
INew
&);
90
91
//- Construct from Istream using default Istream constructor class
92
HashPtrTable
(
Istream
&);
93
94
//- Construct as copy
95
HashPtrTable
(
const
HashPtrTable<T, Key, Hash>
&);
96
97
98
// Destructor
99
100
~HashPtrTable
();
101
102
103
// Member Functions
104
105
// Edit
106
107
//- Remove and return the pointer specified by given iterator
108
T
*
remove
(
iterator
&);
109
110
//- Erase an hashedEntry specified by given iterator
111
bool
erase
(
iterator
&);
112
113
//- Clear all entries from table
114
void
clear
();
115
116
117
// Member Operators
118
119
void
operator=
(
const
HashPtrTable<T, Key, Hash>
&);
120
121
122
// IOstream Operators
123
124
friend
Istream
&
operator
>> <
T
, Key,
Hash
>
125
(
126
Istream
&,
127
HashPtrTable<T, Key, Hash>
&
128
);
129
130
friend
Ostream
& operator<< <T, Key, Hash>
131
(
132
Ostream
&,
133
const
HashPtrTable<T, Key, Hash>
&
134
);
135
};
136
137
138
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140
}
// End namespace Foam
141
142
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144
#ifdef NoRepository
145
# include <
OpenFOAM/HashPtrTable.C
>
146
#endif
147
148
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150
#endif
151
152
// ************************ vim: set sw=4 sts=4 et: ************************ //