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 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 localIOdictionary_H
40 #define 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
71  localIOdictionary(const IOobject& io, const dictionary& dict);
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  //- Destructor
88  virtual ~localIOdictionary() = default;
89 
90 
91  // Member Functions
92 
93  //- Is object global
94  virtual bool global() const
95  {
96  return false;
97  }
98 
99  //- Return complete path + object name if the file exists
100  // in the case otherwise null
101  virtual fileName filePath() const
102  {
103  // Use default (local only) search strategy
104  return localFilePath(type());
105  }
106 };
107 
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 } // End namespace Foam
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 #endif
116 
117 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::IOobject::localFilePath
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
Definition: IOobject.C:569
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
baseIOdictionary.H
Foam::localIOdictionary::localIOdictionary
localIOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Definition: localIOdictionary.C:34
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
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::localIOdictionary::filePath
virtual fileName filePath() const
Return complete path + object name if the file exists.
Definition: localIOdictionary.H:100
Foam::localIOdictionary::global
virtual bool global() const
Is object global.
Definition: localIOdictionary.H:93
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::localIOdictionary::~localIOdictionary
virtual ~localIOdictionary()=default
Destructor.
Foam::localIOdictionary
localIOdictionary is derived from IOdictionary but excludes parallel master reading.
Definition: localIOdictionary.H:52