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-2019 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  //- Copy constructor
72  IOdictionary(const IOdictionary&);
73 
74  //- Move constructor
76 
77 
78  //- Destructor
79  virtual ~IOdictionary();
80 
81 
82  // Member Functions
83 
84  //- Is object global
85  virtual bool global() const
86  {
87  return true;
88  }
89 
90  //- Return complete path + object name if the file exists
91  // either in the case/processor or case otherwise null
92  virtual fileName filePath() const
93  {
94  return globalFilePath(type());
95  }
96 
97 
98  // Member Operators
99 
100  //- Move assignment
101  void operator=(IOdictionary&&);
102 };
103 
104 
105 //- Template function for obtaining global status
106 template<>
107 inline bool typeGlobal<IOdictionary>()
108 {
109  return true;
110 }
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace Foam
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #endif
120 
121 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
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:158
virtual bool global() const
Is object global.
Definition: IOdictionary.H:84
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void operator=(IOdictionary &&)
Move assignment.
Definition: IOdictionary.C:105
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:91
fileName globalFilePath(const word &typeName) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:421
virtual ~IOdictionary()
Destructor.
Definition: IOdictionary.C:99
bool typeGlobal< IOdictionary >()
Template function for obtaining global status.
Definition: IOdictionary.H:106
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:30
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.