IOdictionary.C
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-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "IOdictionary.H"
29 #include "objectRegistry.H"
30 #include "Pstream.H"
31 #include "Time.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
36 :
38 {
39  readHeaderOk(IOstream::ASCII, typeName);
40 
41  // For if MUST_READ_IF_MODIFIED
42  addWatch();
43 }
44 
45 
47 (
48  const IOobject& io,
49  const dictionary& dict
50 )
51 :
53 {
54  if (!readHeaderOk(IOstream::ASCII, typeName))
55  {
57  }
58 
59  // For if MUST_READ_IF_MODIFIED
60  addWatch();
61 }
62 
63 
65 (
66  const IOobject& io,
67  Istream& is
68 )
69 :
70  baseIOdictionary(io, is)
71 {
72  // Note that we do construct the dictionary null and read in
73  // afterwards
74  // so that if there is some fancy massaging due to a
75  // functionEntry in
76  // the dictionary at least the type information is already complete.
77  is >> *this;
78 
79  // For if MUST_READ_IF_MODIFIED
80  addWatch();
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
85 
87 {}
88 
89 
90 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::IOdictionary::IOdictionary
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:35
Foam::IOdictionary::~IOdictionary
virtual ~IOdictionary()
Destructor.
Definition: IOdictionary.C:86
Foam::regIOobject::addWatch
virtual void addWatch()
Add file watch on object (if registered and READ_IF_MODIFIED)
Definition: regIOobject.C:284
objectRegistry.H
Foam::regIOobject::readHeaderOk
bool readHeaderOk(const IOstream::streamFormat PstreamFormat, const word &typeName)
Helper: check readOpt flags and read if necessary.
Definition: regIOobjectRead.C:39
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::baseIOdictionary
baseIOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO function...
Definition: baseIOdictionary.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Pstream.H
IOdictionary.H
Time.H
Foam::IOstreamOption::ASCII
"ascii" (normal default)
Definition: IOstreamOption.H:72
Foam::dictionary::operator=
void operator=(const dictionary &rhs)
Copy assignment.
Definition: dictionary.C:948