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-2018 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 
53  fileNameList files_;
54 
55 public:
56 
57  // Constructors
58 
59  //- Construct given an IOobject
61 
62  //- Construct given an IOobject and dictionary
64  (
65  const IOobject& io,
66  const dictionary& dict
67  );
68 
69  //- Construct given an IOobject and Istream
70  unwatchedIOdictionary(const IOobject& io, Istream& is);
71 
72  //- Destructor
73  virtual ~unwatchedIOdictionary();
74 
75 
76  // Member functions
77 
78  //- Is object global
79  virtual bool global() const
80  {
81  return true;
82  }
83 
84  //- Return complete path + object name if the file exists
85  // either in the case/processor or case otherwise null
86  virtual fileName filePath() const
87  {
88  return globalFilePath(type());
89  }
90 
91  //- Add file watch on object (READ_IF_MODIFIED)
92  virtual void addWatch();
93 
94  //- Add file watch for fileName on object if not yet watched. Return
95  // index of watch
96  virtual label addWatch(const fileName&);
97 
98  const fileNameList& files() const
99  {
100  return files_;
101  }
104  {
105  return files_;
106  }
107 
108 };
109 
110 
111 //- Template function for obtaining global status
112 template<>
114 {
115  return true;
116 }
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
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:69
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:137
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
Is object 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:428
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
virtual fileName filePath() const
Return complete path + object name if the file exists.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.