IOdictionary.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::IOdictionary
26 
27 Description
28  IOdictionary is derived from dictionary and IOobject to give the dictionary
29  automatic IO functionality via the objectRegistry. To facilitate IO,
30  IOdictionary is provided with a constructor from IOobject and writeData and
31  write functions.
32 
33 SourceFiles
34  IOdictionary.C
35  IOdictionaryIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef IOdictionary_H
40 #define IOdictionary_H
41 
42 #include "baseIOdictionary.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class IOdictionary Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class IOdictionary
54 :
55  public baseIOdictionary
56 {
57 
58 public:
59 
60  // Constructors
61 
62  //- Construct given an IOobject
63  IOdictionary(const IOobject&);
64 
65  //- Construct given an IOobject and dictionary
66  IOdictionary(const IOobject&, const dictionary&);
67 
68  //- Construct given an IOobject and Istream
69  IOdictionary(const IOobject&, Istream&);
70 
71 
72  //- Destructor
73  virtual ~IOdictionary();
74 
75 
76  // Member functions
77 
78  //- Is object global
79  virtual bool global() const
80  {
81  return true;
82  }
83 
84  //- Return complete path + object name if the file exists
85  // either in the case/processor or case otherwise null
86  virtual fileName filePath() const
87  {
88  return globalFilePath(type());
89  }
90 };
91 
92 
93 //- Template function for obtaining global status
94 template<>
95 inline bool typeGlobal<IOdictionary>()
96 {
97  return true;
98 }
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 } // End namespace Foam
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 #endif
108 
109 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
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 any number of values (e...
Definition: dictionary.H:137
virtual bool global() const
Is object global.
Definition: IOdictionary.H:78
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
virtual fileName filePath() const
Return complete path + object name if the file exists.
Definition: IOdictionary.H:85
fileName globalFilePath(const word &typeName) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:428
virtual ~IOdictionary()
Destructor.
Definition: IOdictionary.C:81
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
bool typeGlobal< IOdictionary >()
Template function for obtaining global status.
Definition: IOdictionary.H:94
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:30
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.