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 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  baseIOdictionaryIO.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef baseIOdictionary_H
44 #define baseIOdictionary_H
45 
46 #include "dictionary.H"
47 #include "regIOobject.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class baseIOdictionary Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class baseIOdictionary
59 :
60  public regIOobject,
61  public dictionary
62 {
63  // Private Data
64 
65  static bool writeDictionaries;
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  baseIOdictionary(const IOobject&);
89 
90  //- Construct given an IOobject and dictionary
91  baseIOdictionary(const IOobject&, const dictionary&);
92 
93  //- Construct given an IOobject and Istream
95 
96 
97  // Member Functions
98 
99  //- Return complete path + object name if the file exists
100  //- either in the case/processor or case otherwise null
101  virtual fileName filePath() const = 0;
102 
103  //- Name function is needed to disambiguate those inherited
104  //- from regIOobject and dictionary
105  const word& name() const;
106 
107  //- The readData function required by regIOobject read operation
108  virtual bool readData(Istream&);
109 
110  //- The writeData function required by regIOobject write operation
111  virtual bool writeData(Ostream&) const;
112 
113  //- Is object global
114  virtual bool global() const = 0;
115 
116 
117  // Member Operators
118 
119  //- Copy assignment of dictionary entries (leave regIOobject untouched)
120  void operator=(const baseIOdictionary&);
121 
122  //- Copy assignment of dictionary entries
123  using dictionary::operator=;
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
regIOobject.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::baseIOdictionary::readData
virtual bool readData(Istream &)
The readData function required by regIOobject read operation.
Definition: baseIOdictionaryIO.C:33
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::baseIOdictionary::writeData
virtual bool writeData(Ostream &) const
The writeData function required by regIOobject write operation.
Definition: baseIOdictionaryIO.C:51
Foam::baseIOdictionary::baseIOdictionary
baseIOdictionary(const baseIOdictionary &)=default
Copy construct.
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:82
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:57
Foam::baseIOdictionary::TypeName
TypeName("dictionary")
Declare type-name, virtual type (with debug switch)
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
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:71
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
Foam::baseIOdictionary::operator=
void operator=(const baseIOdictionary &)
Copy assignment of dictionary entries (leave regIOobject untouched)
Definition: baseIOdictionary.C:90