unwatchedIOdictionary.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2015-2019 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::unwatchedIOdictionary
26 
27 Description
28  unwatchedIOdictionary is like IOdictionary but stores
29  dependencies as files instead of fileMonitor watchIndices. Used
30  to read controlDict since there fileMonitor not yet setup.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef unwatchedIOdictionary_H
35 #define unwatchedIOdictionary_H
36 
37 #include "baseIOdictionary.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class unwatchedIOdictionary Declaration
46 \*---------------------------------------------------------------------------*/
47 
49 :
50  public baseIOdictionary
51 {
52  // Private member data
53 
54  fileNameList files_;
55 
56 
57 public:
58 
59  // Constructors
60 
61  //- Construct given an IOobject
63 
64  //- Construct given an IOobject and dictionary
66  (
67  const IOobject& io,
68  const dictionary& dict
69  );
70 
71  //- Construct given an IOobject and Istream
72  unwatchedIOdictionary(const IOobject& io, Istream& is);
73 
74  //- Move constructor
76 
77 
78  //- Destructor
79  virtual ~unwatchedIOdictionary();
80 
81 
82  // Member Functions
83 
84  //- This object is global
85  virtual bool global() const
86  {
87  return true;
88  }
89 
90  //- Return complete path + object name if the file exists
91  // either in the case/processor or case otherwise null
92  virtual fileName filePath() const
93  {
94  return globalFilePath(type());
95  }
96 
97  //- Add file watch on object (READ_IF_MODIFIED)
98  virtual void addWatch();
99 
100  //- Add file watch for fileName on object if not yet watched. Return
101  // index of watch
102  virtual label addWatch(const fileName&);
104  const fileNameList& files() const
105  {
106  return files_;
107  }
110  {
111  return files_;
112  }
113 
114 
115  // Member Operators
116 
117  //- Move assignment
119 };
120 
121 
122 //- Template function for obtaining global status
123 template<>
125 {
126  return true;
127 }
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
dictionary dict
unwatchedIOdictionary is like IOdictionary but stores dependencies as files instead of fileMonitor wa...
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
A class for handling file names.
Definition: fileName.H:79
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 any number of values (e...
Definition: dictionary.H:158
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual ~unwatchedIOdictionary()
Destructor.
virtual bool global() const
This object is global.
const fileNameList & files() const
unwatchedIOdictionary(const IOobject &io)
Construct given an IOobject.
bool typeGlobal< unwatchedIOdictionary >()
Template function for obtaining global status.
virtual void addWatch()
Add file watch on object (READ_IF_MODIFIED)
fileName globalFilePath(const word &typeName) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:402
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
virtual fileName filePath() const
Return complete path + object name if the file exists.
void operator=(unwatchedIOdictionary &&)
Move assignment.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.