localIOdictionary.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) 2015-2017 OpenFOAM Foundation
9  Copyright (C) 2021-2023 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::localIOdictionary
29 
30 Description
31  localIOdictionary is derived from IOdictionary but excludes parallel
32  master reading.
33 
34 SourceFiles
35  localIOdictionary.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_localIOdictionary_H
40 #define Foam_localIOdictionary_H
41 
42 #include "baseIOdictionary.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class localIOdictionary Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public baseIOdictionary
56 {
57 public:
58 
59  // Constructors
60 
61  //- Construct given an IOobject
62  //- and optional fallback dictionary content
63  // A null dictionary pointer is treated like an empty dictionary.
64  explicit localIOdictionary
65  (
66  const IOobject& io,
67  const dictionary* fallback = nullptr
68  );
69 
70  //- Construct given an IOobject and fallback dictionary content
72 
73  //- Construct given an IOobject, wanted typeName
74  //- and optional fallback dictionary content
75  // A null dictionary pointer is treated like an empty dictionary.
77  (
78  const IOobject& io,
79  const word& wantedType,
80  const dictionary* fallback = nullptr
81  );
82 
83  //- Construct given an IOobject and Istream
84  localIOdictionary(const IOobject& io, Istream& is);
85 
86 
87  // Factory Methods
88 
89  //- Read and return contents. The IOobject will not be registered
90  static dictionary readContents(const IOobject& io);
91 
92 
93  //- Destructor
94  virtual ~localIOdictionary() = default;
95 
96 
97  // Member Functions
98 
99  //- Is object global
100  virtual bool global() const
101  {
102  return false;
103  }
104 
105  //- Return complete path + object name if the file exists
106  // in the case otherwise null
107  virtual fileName filePath() const
108  {
109  // Use default (local only) search strategy
110  return localFilePath(type());
111  }
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************************************************************* //
virtual bool global() const
Is object global.
localIOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
dictionary dict
A class for handling file names.
Definition: fileName.H:72
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:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
localIOdictionary is derived from IOdictionary but excludes parallel master reading.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
A class for handling words, derived from Foam::string.
Definition: word.H:63
fileName localFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching locally.
Definition: IOobject.C:536
virtual fileName filePath() const
Return complete path + object name if the file exists.
static dictionary readContents(const IOobject &io)
Read and return contents. The IOobject will not be registered.
virtual ~localIOdictionary()=default
Destructor.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.