writeDictionary.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) 2013-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::functionObjects::writeDictionary
26 
27 Description
28  Writes dictionaries on start-up and on change.
29 
30 SourceFiles
31  writeDictionary.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef functionObjects_writeDictionary_H
36 #define functionObjects_writeDictionary_H
37 
38 #include "functionObject.H"
39 #include "wordList.H"
40 #include "SHA1Digest.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class objectRegistry;
49 
50 namespace functionObjects
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class writeDictionary Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class writeDictionary
58 :
59  public functionObject
60 {
61  // Private Data
62 
63  //- Reference to the database
64  const objectRegistry& obr_;
65 
66  //- Names of dictionaries to monitor
67  wordList dictNames_;
68 
69  //- List of changed dictionaries (only those registered to database)
70  List<SHA1Digest> digests_;
71 
72 
73  // Private Member Functions
74 
75  //- Helper function to write the dictionary if found at location
76  bool tryDirectory
77  (
78  const label dictI,
79  const word& location,
80  bool& firstDict
81  );
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("writeDictionary");
88 
89 
90  // Constructors
91 
92  //- Construct from Time and dictionary
94  (
95  const word& name,
96  const Time& runTime,
97  const dictionary& dict
98  );
99 
100  //- Disallow default bitwise copy construction
101  writeDictionary(const writeDictionary&) = delete;
102 
103 
104  //- Destructor
105  virtual ~writeDictionary();
106 
107 
108  // Member Functions
109 
110  //- Read the writeDictionary data
111  virtual bool read(const dictionary&);
112 
113  //- Execute, currently does nothing
114  virtual bool execute();
115 
116  //- Write the selected dictionaries
117  virtual bool write();
118 
119 
120  // Member Operators
121 
122  //- Disallow default bitwise assignment
123  void operator=(const writeDictionary&) = delete;
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace functionObjects
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
dictionary dict
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
virtual bool read(const dictionary &)
Read the writeDictionary data.
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
writeDictionary(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
engineTime & runTime
Abstract base-class for Time/database functionObjects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
void operator=(const writeDictionary &)=delete
Disallow default bitwise assignment.
A class for handling words, derived from string.
Definition: word.H:59
TypeName("writeDictionary")
Runtime type information.
virtual bool write()
Write the selected dictionaries.
virtual bool execute()
Execute, currently does nothing.
Writes dictionaries on start-up and on change.
Registry of regIOobjects.
Namespace for OpenFOAM.