unwatchedIOdictionary.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) 2015-2017 OpenFOAM Foundation
9 Copyright (C) 2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::unwatchedIOdictionary
29
30Description
31 unwatchedIOdictionary is like IOdictionary but stores
32 dependencies as files instead of fileMonitor watchIndices.
33 Used to read controlDict since there fileMonitor not yet setup.
34
35SourceFiles
36 unwatchedIOdictionary.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef unwatchedIOdictionary_H
41#define unwatchedIOdictionary_H
42
43#include "baseIOdictionary.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class unwatchedIOdictionary Declaration
52\*---------------------------------------------------------------------------*/
55:
56 public baseIOdictionary
57{
58 // Private Data
59
60 //- The files that would be watched
61 fileNameList files_;
62
63
64public:
65
66 // Constructors
67
68 //- Construct given an IOobject
69 //- and optional fallback dictionary content
70 // A null dictionary pointer is treated like an empty dictionary.
72 (
73 const IOobject& io,
74 const dictionary* fallback = nullptr
75 );
76
77 //- Construct given an IOobject and fallback dictionary content
79 (
80 const IOobject& io,
81 const dictionary& dict
82 );
83
84 //- Construct given an IOobject, wanted typeName
85 //- and optional fallback dictionary content
86 // A null dictionary pointer is treated like an empty dictionary.
88 (
89 const IOobject& io,
90 const word& wantedType,
91 const dictionary* fallback = nullptr
92 );
93
94 //- Construct given an IOobject and Istream
96
97
98 //- Destructor
99 virtual ~unwatchedIOdictionary() = default;
100
101
102 // Member Functions
103
104 //- Is object global
105 virtual bool global() const
106 {
107 return true;
108 }
109
110 //- Return complete path + object name if the file exists
111 // either in the case/processor or case otherwise null
112 virtual fileName filePath() const
113 {
114 return globalFilePath(type());
115 }
116
117 //- Add file watch on object (READ_IF_MODIFIED)
118 virtual void addWatch();
119
120 //- Add file watch for fileName on object if not yet watched.
121 // \return index of watch
122 virtual label addWatch(const fileName&);
123
124 //- Return the files that would be watched
125 const fileNameList& files() const noexcept
126 {
127 return files_;
128 }
129
130 //- Access to the files that would be watched
132 {
133 return files_;
134 }
135};
136
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140//- Template function for obtaining global status
141template<>
143{
144 return true;
145}
146
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150} // End namespace Foam
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154#endif
155
156// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:593
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
baseIOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO function...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
unwatchedIOdictionary is like IOdictionary but stores dependencies as files instead of fileMonitor wa...
virtual ~unwatchedIOdictionary()=default
Destructor.
virtual bool global() const
Is object global.
const fileNameList & files() const noexcept
Return the files that would be watched.
fileNameList & files() noexcept
Access to the files that would be watched.
virtual fileName filePath() const
Return complete path + object name if the file exists.
virtual void addWatch()
Add file watch on object (READ_IF_MODIFIED)
A class for handling words, derived from Foam::string.
Definition: word.H:68
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
bool typeGlobal< unwatchedIOdictionary >()
Template function for obtaining global status.
const direction noexcept
Definition: Scalar.H:223
dictionary dict