baseIOdictionary.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::baseIOdictionary
29 
30 Description
31  baseIOdictionary is derived from dictionary and IOobject to give the
32  dictionary automatic IO functionality via the objectRegistry.
33 
34  To facilitate IO, baseIOdictionary is provided with a constructor from
35  IOobject and with readData/writeData functions.
36 
37 SourceFiles
38  baseIOdictionary.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef baseIOdictionary_H
43 #define baseIOdictionary_H
44 
45 #include "dictionary.H"
46 #include "regIOobject.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class baseIOdictionary Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class baseIOdictionary
58 :
59  public regIOobject,
60  public dictionary
61 {
62  // Private Data
63 
64  static bool writeDictionaries;
65 
66 
67 public:
68 
69  //- Declare type-name, virtual type (with debug switch)
70  TypeName("dictionary");
71 
72 
73  // Generated Methods
74 
75  //- Copy construct
76  baseIOdictionary(const baseIOdictionary&) = default;
77 
78  //- Move construct
80 
81  //- Destructor
82  virtual ~baseIOdictionary() = default;
83 
84 
85  // Constructors
86 
87  //- Construct given an IOobject
88  //- and optional fallback dictionary content (ununsed)
89  // A null dictionary pointer is treated like an empty dictionary.
90  explicit baseIOdictionary
91  (
92  const IOobject& io,
93  const dictionary* fallback = nullptr
94  );
95 
96  //- Construct given an IOobject and fallback dictionary
97  //- content (ununsed)
98  baseIOdictionary(const IOobject& io, const dictionary& dict);
99 
100  //- Construct given an IOobject and Istream (ununsed)
101  baseIOdictionary(const IOobject& io, Istream& is);
102 
103 
104  // Member Functions
105 
106  //- Return complete path + object name if the file exists
107  //- either in the case/processor or case otherwise null
108  virtual fileName filePath() const = 0;
109 
110  //- Name function is needed to disambiguate those inherited
111  //- from regIOobject and dictionary
112  const word& name() const;
113 
114  //- The readData function required by regIOobject read operation
115  virtual bool readData(Istream&);
116 
117  //- The writeData function required by regIOobject write operation
118  virtual bool writeData(Ostream&) const;
119 
120  //- Is object global
121  virtual bool global() const = 0;
122 
123 
124  // Member Operators
125 
126  //- Copy assignment of dictionary entries (leave regIOobject untouched)
127  void operator=(const baseIOdictionary& rhs);
128 
129  //- Copy assignment of dictionary entries
130  using dictionary::operator=;
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
regIOobject.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::baseIOdictionary::readData
virtual bool readData(Istream &)
The readData function required by regIOobject read operation.
Definition: baseIOdictionary.C:91
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::baseIOdictionary::writeData
virtual bool writeData(Ostream &) const
The writeData function required by regIOobject write operation.
Definition: baseIOdictionary.C:109
Foam::baseIOdictionary::operator=
void operator=(const baseIOdictionary &rhs)
Copy assignment of dictionary entries (leave regIOobject untouched)
Definition: baseIOdictionary.C:118
Foam::baseIOdictionary::baseIOdictionary
baseIOdictionary(const baseIOdictionary &)=default
Copy construct.
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:85
Foam::baseIOdictionary::global
virtual bool global() const =0
Is object global.
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::baseIOdictionary
baseIOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO function...
Definition: baseIOdictionary.H:56
Foam::baseIOdictionary::TypeName
TypeName("dictionary")
Declare type-name, virtual type (with debug switch)
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::baseIOdictionary::~baseIOdictionary
virtual ~baseIOdictionary()=default
Destructor.
dictionary.H
Foam::baseIOdictionary::filePath
virtual fileName filePath() const =0
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56