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-2022 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 //- Trait for obtaining global status
128 template<>
129 struct typeGlobal<IOdictionary>
130 {
131  static const bool global = true;
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
void operator=(const IOdictionary &)
Assignment of dictionary entries only.
Definition: IOdictionary.C:137
virtual bool global() const
Return true as object is global, i.e. same for all processors.
Definition: IOdictionary.H:104
IOdictionary(const IOobject &io, const word &wantedType)
Construct given an IOobject, supply wanted typeName.
Definition: IOdictionary.C:47
TypeName("dictionary")
static bool writeDictionaries
Definition: IOdictionary.H:74
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
virtual ~IOdictionary()
Destructor.
Definition: IOdictionary.C:131
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const word & name() const
Return name.
Definition: IOobject.H:310
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
Trait for obtaining global status.
Definition: IOobject.H:504
static const bool global
Definition: IOobject.H:505