OpenFOAM
4.1
The OpenFOAM Foundation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
OpenFOAM
db
regIOobject
regIOobject.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) 2011-2015 OpenFOAM Foundation
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::regIOobject
26
27
Description
28
regIOobject is an abstract class derived from IOobject to handle
29
automatic object registration with the objectRegistry.
30
31
SourceFiles
32
regIOobject.C
33
regIOobjectRead.C
34
regIOobjectWrite.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef regIOobject_H
39
#define regIOobject_H
40
41
#include "
IOobject.H
"
42
#include "
typeInfo.H
"
43
#include "
OSspecific.H
"
44
#include "
NamedEnum.H
"
45
46
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48
49
namespace
Foam
50
{
51
52
namespace
functionEntries
53
{
54
class
codeStream;
55
}
56
57
/*---------------------------------------------------------------------------*\
58
Class regIOobject Declaration
59
\*---------------------------------------------------------------------------*/
60
61
class
regIOobject
62
:
63
public
IOobject
64
{
65
66
public
:
67
68
//- Types of communications
69
enum
fileCheckTypes
70
{
71
timeStamp,
72
timeStampMaster,
73
inotify,
74
inotifyMaster
75
};
76
77
static
const
NamedEnum<fileCheckTypes, 4>
fileCheckTypesNames;
78
79
80
protected
:
81
82
//- To flag master-only reading of objects
83
static
bool
masterOnlyReading;
84
85
86
private
:
87
88
// Private data
89
90
//- Is this object registered with the registry
91
bool
registered_;
92
93
//- Is this object owned by the registry
94
bool
ownedByRegistry_;
95
96
//- Modification watch index
97
mutable
label
watchIndex_;
98
99
//- eventNo of last update
100
label
eventNo_;
101
102
//- Istream for reading
103
Istream
* isPtr_;
104
105
106
// Private Member Functions
107
108
//- Return Istream
109
Istream
& readStream();
110
111
//- Dissallow assignment
112
void
operator=(
const
regIOobject
&);
113
114
115
public
:
116
117
//- Declare friendship with any classes that need access to
118
// masterOnlyReading
119
friend
class
functionEntries::codeStream
;
120
121
122
// Static data
123
124
//- Runtime type information
125
TypeName
(
"regIOobject"
);
126
127
static
int
fileModificationSkew;
128
129
static
fileCheckTypes
fileModificationChecking;
130
131
132
// Constructors
133
134
//- Construct from IOobject. Optional flag for if IOobject is the
135
// top level regIOobject.
136
regIOobject
(
const
IOobject
&,
const
bool
isTime =
false
);
137
138
//- Construct as copy
139
regIOobject
(
const
regIOobject
&);
140
141
//- Construct as copy, transferring registry registration to copy
142
// if registerCopy is true
143
regIOobject
(
const
regIOobject
&,
bool
registerCopy);
144
145
//- Construct as copy with new name, transfering registry registration
146
// to copy as specified
147
regIOobject
(
const
word
& newName,
const
regIOobject
&,
bool
registerCopy);
148
149
//- Construct as copy with new IO parameters
150
regIOobject
(
const
IOobject
&,
const
regIOobject
&);
151
152
153
//- Destructor
154
virtual
~
regIOobject
();
155
156
157
// Member functions
158
159
// Registration
160
161
//- Add object to registry
162
bool
checkIn();
163
164
//- Remove object from registry
165
bool
checkOut();
166
167
//- Is this object owned by the registry?
168
inline
bool
ownedByRegistry()
const
;
169
170
//- Transfer ownership of this object to its registry
171
inline
void
store();
172
173
//- Transfer ownership of the given object pointer to its registry
174
// and return reference to object.
175
template
<
class
Type>
176
inline
static
Type& store(Type*);
177
178
//- Transfer ownership of the given object pointer to its registry
179
// and return reference to object.
180
template
<
class
Type>
181
inline
static
Type& store(
autoPtr<Type>
&);
182
183
//- Release ownership of this object from its registry
184
inline
void
release();
185
186
187
// Dependency checking
188
189
//- Event number at last update.
190
inline
label
eventNo()
const
;
191
192
//- Event number at last update.
193
inline
label
& eventNo();
194
195
//- Return true if up-to-date with respect to given object
196
// otherwise false
197
bool
upToDate(
const
regIOobject
&)
const
;
198
199
//- Return true if up-to-date with respect to given objects
200
// otherwise false
201
bool
upToDate
202
(
203
const
regIOobject
&,
204
const
regIOobject
&
205
)
const
;
206
207
//- Return true if up-to-date with respect to given objects
208
// otherwise false
209
bool
upToDate
210
(
211
const
regIOobject
&,
212
const
regIOobject
&,
213
const
regIOobject
&
214
)
const
;
215
216
//- Return true if up-to-date with respect to given objects
217
// otherwise false
218
bool
upToDate
219
(
220
const
regIOobject
&,
221
const
regIOobject
&,
222
const
regIOobject
&,
223
const
regIOobject
&
224
)
const
;
225
226
//- Set up to date (obviously)
227
void
setUpToDate();
228
229
230
// Edit
231
232
//- Rename
233
virtual
void
rename(
const
word
& newName);
234
235
236
// Reading
237
238
//- Return Istream and check object type against that given
239
Istream
& readStream(
const
word
&);
240
241
//- Close Istream
242
void
close();
243
244
//- Virtual readData function.
245
// Must be defined in derived types for which
246
// re-reading is required
247
virtual
bool
readData(
Istream
&);
248
249
//- Read object
250
virtual
bool
read
();
251
252
//- Return file-monitoring handle
253
inline
label
watchIndex()
const
;
254
255
//- Return file-monitoring handle
256
inline
label
& watchIndex();
257
258
//- Return true if the object's file (or files for objectRegistry)
259
// have been modified. (modified state is cached by Time)
260
virtual
bool
modified()
const
;
261
262
//- Read object if modified (as set by call to modified)
263
virtual
bool
readIfModified();
264
265
266
// Writing
267
268
//- Pure virtual writaData function.
269
// Must be defined in derived types
270
virtual
bool
writeData
(
Ostream
&)
const
= 0;
271
272
//- Write using given format, version and compression
273
virtual
bool
writeObject
274
(
275
IOstream::streamFormat
,
276
IOstream::versionNumber
,
277
IOstream::compressionType
278
)
const
;
279
280
//- Write using setting from DB
281
virtual
bool
write
()
const
;
282
283
284
// Member operators
285
286
void
operator=(
const
IOobject
&);
287
};
288
289
290
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
291
292
}
// End namespace Foam
293
294
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295
296
#include "
regIOobjectI.H
"
297
298
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299
300
#endif
301
302
// ************************************************************************* //
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition:
label.H:59
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition:
Istream.H:57
Foam::regIOobject::fileCheckTypes
fileCheckTypes
Types of communications.
Definition:
regIOobject.H:68
Foam::NamedEnum< fileCheckTypes, 4 >
OSspecific.H
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Foam::read
bool read(const char *, int32_t &)
Definition:
int32IO.C:85
Foam::functionEntries::codeStream
Dictionary entry that contains C++ OpenFOAM code that is compiled to generate the entry itself...
Definition:
codeStream.H:112
Foam::word
A class for handling words, derived from string.
Definition:
word.H:59
NamedEnum.H
Foam::IOstream::streamFormat
streamFormat
Enumeration for the format of data in the stream.
Definition:
IOstream.H:86
TypeName
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition:
typeInfo.H:70
IOobject.H
Foam::IOstream::compressionType
compressionType
Enumeration for the format of data in the stream.
Definition:
IOstream.H:193
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition:
Ostream.H:53
writeData
const bool writeData(readBool(pdfDictionary.lookup("writeData")))
typeInfo.H
Foam::IOstream::versionNumber
Version number type.
Definition:
IOstream.H:96
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.H:60
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition:
PtrList.H:53
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition:
IOobject.H:91
write
runTime write()
Foam
Namespace for OpenFOAM.
Definition:
combustionModel.C:30
regIOobjectI.H
Generated by
1.8.11