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
db
objectRegistry
objectRegistry.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::objectRegistry
26
27
Description
28
Registry of regIOobjects
29
30
SourceFiles
31
objectRegistry.C
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef objectRegistry_H
36
#define objectRegistry_H
37
38
#include <
OpenFOAM/HashTable.H
>
39
#include <
OpenFOAM/regIOobject.H
>
40
41
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43
namespace
Foam
44
{
45
46
/*---------------------------------------------------------------------------*\
47
Class objectRegistry Declaration
48
\*---------------------------------------------------------------------------*/
49
50
class
objectRegistry
51
:
52
public
regIOobject
,
53
public
HashTable
<regIOobject*>
54
{
55
// Private Data
56
57
//- Master time objectRegistry
58
const
Time
& time_;
59
60
//- Parent objectRegistry
61
const
objectRegistry
& parent_;
62
63
//- Local directory path of this objectRegistry relative to time
64
fileName
dbDir_;
65
66
//- Current event
67
mutable
label event_;
68
69
70
// Private Member Functions
71
72
//- Disallow Copy constructor
73
objectRegistry
(
const
objectRegistry
&);
74
75
//- Disallow default bitwise copy construct and assignment
76
void
operator=(
const
objectRegistry
&);
77
78
79
public
:
80
81
//- Declare type name for this IOobject
82
TypeName
(
"objectRegistry"
);
83
84
85
// Constructors
86
87
//- Construct the time objectRegistry given an initial estimate
88
// for the number of entries
89
explicit
objectRegistry
90
(
91
const
Time
&
db
,
92
const
label nIoObjects = 128
93
);
94
95
//- Construct a sub-registry given an IObject to describe the registry
96
// and an initial estimate for the number of entries
97
explicit
objectRegistry
98
(
99
const
IOobject
& io,
100
const
label nIoObjects = 128
101
);
102
103
104
// Destructor
105
106
virtual
~objectRegistry
();
107
108
109
// Member functions
110
111
// Access
112
113
//- Return time
114
const
Time
&
time
()
const
115
{
116
return
time_;
117
}
118
119
//- Return the parent objectRegistry
120
const
objectRegistry
&
parent
()
const
121
{
122
return
parent_;
123
}
124
125
//- Local directory path of this objectRegistry relative to the time
126
virtual
const
fileName
&
dbDir
()
const
127
{
128
return
dbDir_;
129
}
130
131
//- Return the list of names of the IOobjects
132
wordList
names
()
const
;
133
134
//- Return the list of names of the IOobjects of given class name
135
wordList
names
(
const
word
& className)
const
;
136
137
//- Return the list of names of the IOobjects of given type
138
template
<
class
Type>
139
wordList
names
()
const
;
140
141
//- Lookup and return a const sub-objectRegistry
142
const
objectRegistry
&
subRegistry
(
const
word
&
name
)
const
;
143
144
//- Lookup and return all the object of the given Type
145
template
<
class
Type>
146
HashTable<const Type*>
lookupClass
()
const
;
147
148
//- Is the named Type
149
template
<
class
Type>
150
bool
foundObject
(
const
word
&
name
)
const
;
151
152
//- Lookup and return the object of the given Type
153
template
<
class
Type>
154
const
Type&
lookupObject
(
const
word
&
name
)
const
;
155
156
//- Return new event number.
157
label
getEvent
()
const
;
158
159
160
// Edit
161
162
//- Rename
163
virtual
void
rename
(
const
word
& newName);
164
165
//- Add an regIOobject to registry
166
bool
checkIn
(
regIOobject
&)
const
;
167
168
//- Remove an regIOobject from registry
169
bool
checkOut
(
regIOobject
&)
const
;
170
171
172
// Reading
173
174
//- Return true if any of the object's files have been modified
175
virtual
bool
modified
()
const
;
176
177
//- Read the objects that have been modified
178
void
readModifiedObjects
();
179
180
//- Read object if modified
181
virtual
bool
readIfModified
();
182
183
184
// Writing
185
186
//- writeData function required by regIOobject but not used
187
// for this class, write is used instead
188
virtual
bool
writeData
(
Ostream
&)
const
189
{
190
notImplemented
191
(
192
"void objectRegistry::writeData(Ostream&) const: "
193
"use write() instead"
194
);
195
196
return
false
;
197
}
198
199
//- Write the objects
200
virtual
bool
writeObject
201
(
202
IOstream::streamFormat
fmt,
203
IOstream::versionNumber
ver,
204
IOstream::compressionType
cmp
205
)
const
;
206
};
207
208
209
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210
211
}
// End namespace Foam
212
213
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215
#ifdef NoRepository
216
# include <
OpenFOAM/objectRegistryTemplates.C
>
217
#endif
218
219
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220
221
#endif
222
223
// ************************ vim: set sw=4 sts=4 et: ************************ //