IOdictionary.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) 2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::IOdictionary
29
30Description
31 IOdictionary is derived from dictionary and IOobject to give the dictionary
32 automatic IO functionality via the objectRegistry. To facilitate IO,
33 IOdictionary is provided with a constructor from IOobject and with
34 readData/writeData functions.
35
36SourceFiles
37 IOdictionary.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef IOdictionary_H
42#define IOdictionary_H
43
44#include "baseIOdictionary.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class IOdictionary Declaration
53\*---------------------------------------------------------------------------*/
55class IOdictionary
56:
57 public baseIOdictionary
58{
59public:
60
61 // Constructors
62
63 //- Construct given an IOobject
64 //- and optional fallback dictionary content
65 // A null dictionary pointer is treated like an empty dictionary.
66 explicit IOdictionary
67 (
68 const IOobject& io,
69 const dictionary* fallback = nullptr
70 );
71
72 //- Construct given an IOobject
73 //- and fallback dictionary content
74 IOdictionary(const IOobject& io, const dictionary& dict);
75
76 //- Construct given an IOobject, wanted typeName
77 //- and optional fallback dictionary content
78 // A null dictionary pointer is treated like an empty dictionary.
80 (
81 const IOobject& io,
82 const word& wantedType,
83 const dictionary* fallback = nullptr
84 );
85
86 //- Construct given an IOobject and Istream
87 IOdictionary(const IOobject& io, Istream& is);
88
89
90 //- Destructor
91 virtual ~IOdictionary() = default;
92
93
94 // Member Functions
95
96 //- Is object global
97 virtual bool global() const
98 {
99 return true;
100 }
101
102 //- Return complete path + object name if the file exists
103 // either in the case/processor or case otherwise null
104 virtual fileName filePath() const
105 {
106 return globalFilePath(type());
107 }
108};
109
110
111// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112
113//- Template function for obtaining global status
114template<>
115inline bool typeGlobal<IOdictionary>()
116{
117 return true;
118}
119
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123} // End namespace Foam
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127#endif
128
129// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
virtual bool global() const
Is object global.
Definition: IOdictionary.H:96
virtual ~IOdictionary()=default
Destructor.
virtual fileName filePath() const
Return complete path + object name if the file exists.
Definition: IOdictionary.H:103
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:593
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
baseIOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO function...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
A class for handling words, derived from Foam::string.
Definition: word.H:68
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
bool typeGlobal< IOdictionary >()
Template function for obtaining global status.
Definition: IOdictionary.H:114
dictionary dict