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