Loading...
Searching...
No Matches
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 Foam_unwatchedIOdictionary_H
41#define Foam_unwatchedIOdictionary_H
42
43#include "baseIOdictionary.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
50/*---------------------------------------------------------------------------*\
51 Class unwatchedIOdictionary Declaration
52\*---------------------------------------------------------------------------*/
53
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 //- The object is global
105 virtual bool global() const
106 {
107 return true;
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 }
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
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//- Global file type for unwatchedIOdictionary
141template<>
142struct is_globalIOobject<unwatchedIOdictionary> : std::true_type {};
143
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147} // End namespace Foam
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151#endif
152
153// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
Definition IOobject.C:604
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
baseIOdictionary(const baseIOdictionary &)=default
Copy construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
unwatchedIOdictionary is like IOdictionary but stores dependencies as files instead of fileMonitor wa...
virtual ~unwatchedIOdictionary()=default
Destructor.
unwatchedIOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
virtual bool global() const
The object is 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 either in the case/processor or case otherwise ...
virtual void addWatch()
Add file watch on object (READ_IF_MODIFIED).
A class for handling words, derived from Foam::string.
Definition word.H:66
const auto & io
const auto & fallback
Namespace for OpenFOAM.
List< fileName > fileNameList
List of fileName.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
const direction noexcept
Definition scalarImpl.H:265
dictionary dict
Trait for specifying global vs. local IOobject file types.
Definition IOobject.H:175