IOdictionary.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) 2011-2021 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::IOdictionary
26 
27 Description
28  IOdictionary is derived from dictionary and IOobject to give the
29  dictionary automatic IO functionality via the objectRegistry. To facilitate
30  IO, IOdictionary is provided with a constructor from IOobject and writeData
31  and write functions.
32 
33 SourceFiles
34  IOdictionary.C
35  IOdictionaryIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef IOdictionary_H
40 #define IOdictionary_H
41 
42 #include "dictionary.H"
43 #include "regIOobject.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class IOdictionary Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class IOdictionary
55 :
56  public regIOobject,
57  public dictionary
58 {
59 
60 protected:
61 
62  // Protected constructors
63 
64  //- Construct given an IOobject, supply wanted typeName
65  IOdictionary(const IOobject& io, const word& wantedType);
66 
67 
68 public:
69 
70  TypeName("dictionary");
71 
72 
73  // Public static data
74 
75  static bool writeDictionaries;
76 
77 
78  // Constructors
79 
80  //- Construct given an IOobject
81  IOdictionary(const IOobject&);
82 
83  //- Construct given an IOobject and dictionary
84  IOdictionary(const IOobject&, const dictionary&);
85 
86  //- Construct given an IOobject and Istream
87  IOdictionary(const IOobject&, Istream&);
88 
89  //- Copy constructor
90  IOdictionary(const IOdictionary&);
91 
92  //- Move constructor
94 
95 
96  //- Destructor
97  virtual ~IOdictionary();
98 
99 
100  // Member Functions
101 
102  using regIOobject::name;
103 
104  //- Return true as object is global, i.e. same for all processors
105  virtual bool global() const
106  {
107  return true;
108  }
109 
110  //- ReadData function required for regIOobject read operation
111  virtual bool readData(Istream&);
112 
113  //- WriteData function required for regIOobject write operation
114  virtual bool writeData(Ostream&) const;
115 
116 
117  // Member Operators
118 
119  //- Assignment of dictionary entries only
120  void operator=(const IOdictionary&);
121 
122  //- Move assignment of dictionary entries only
123  void operator=(IOdictionary&&);
124 };
125 
126 
127 //- Template function for obtaining global status
128 template<>
129 inline bool typeGlobal<IOdictionary>()
130 {
131  return true;
132 }
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
static bool writeDictionaries
Definition: IOdictionary.H:74
const word & name() const
Return name.
Definition: IOobject.H:315
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool global() const
Return true as object is global, i.e. same for all processors.
Definition: IOdictionary.H:104
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
void operator=(const IOdictionary &)
Assignment of dictionary entries only.
Definition: IOdictionary.C:137
A class for handling words, derived from string.
Definition: word.H:59
virtual ~IOdictionary()
Destructor.
Definition: IOdictionary.C:131
IOdictionary(const IOobject &io, const word &wantedType)
Construct given an IOobject, supply wanted typeName.
Definition: IOdictionary.C:47
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool typeGlobal< IOdictionary >()
Template function for obtaining global status.
Definition: IOdictionary.H:128
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:52
TypeName("dictionary")
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Namespace for OpenFOAM.