inputMode.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-2016 OpenFOAM Foundation
9  Copyright (C) 2017 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::functionEntries::inputMode
29 
30 Description
31  Specify the global input mode when reading further dictionaries,
32  expects a single word to follow.
33 
34  An example of \c \#inputMode directive:
35  \verbatim
36  #inputMode merge
37  \endverbatim
38 
39  The possible input modes:
40  - \par merge
41  merge sub-dictionaries when possible
42  - \par overwrite
43  keep last entry and silently remove previous ones
44  - \par protect
45  keep initial entry and silently ignore subsequent ones
46  - \par warn
47  keep initial entry and warn about subsequent ones
48  - \par error
49  issue a FatalError for duplicate entries
50  - \par default
51  The default treatment - currently identical to \b merge.
52 
53 SourceFiles
54  inputMode.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef inputMode_H
59 #define inputMode_H
60 
61 #include "entry.H"
62 #include "functionEntry.H"
63 #include "Enum.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace functionEntries
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class inputMode Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class inputMode
77 :
78  public functionEntry
79 {
80 public:
81 
82  //- Text representations of the selectable input modes
84 
85  //- Change the global input-mode.
86  static bool execute(dictionary& unused, Istream& is);
87 };
88 
89 
90 /*---------------------------------------------------------------------------*\
91  Class inputModeDefault Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 //- Temporarily change inputMode to %protect for the following entry
95 class inputModeDefault
96 :
97  public functionEntry
98 {
99 public:
100 
101  //- Execute in a sub-dict context
102  static bool execute(dictionary& parentDict, Istream& is);
103 };
104 
105 
106 /*---------------------------------------------------------------------------*\
107  Class inputModeMerge Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 //- Temporarily change inputMode to %merge for the following entry
111 class inputModeMerge
112 :
113  public functionEntry
114 {
115 public:
116 
117  //- Execute in a sub-dict context
118  static bool execute(dictionary& parentDict, Istream& is);
119 };
120 
121 
122 /*---------------------------------------------------------------------------*\
123  Class inputModeOverwrite Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 //- Temporarily change inputMode to %overwrite for the following entry
127 class inputModeOverwrite
128 :
129  public functionEntry
130 {
131 public:
132 
133  //- Execute in a sub-dict context
134  static bool execute(dictionary& parentDict, Istream& is);
135 };
136 
137 
138 /*---------------------------------------------------------------------------*\
139  Class inputModeWarn Declaration
140 \*---------------------------------------------------------------------------*/
141 
142 //- Temporarily change inputMode to %warn for the following entry
143 class inputModeWarn
144 :
145  public functionEntry
146 {
147 public:
148 
149  //- Execute in a sub-dict context
150  static bool execute(dictionary& parentDict, Istream& is);
151 };
152 
153 
154 /*---------------------------------------------------------------------------*\
155  Class inputModeError Declaration
156 \*---------------------------------------------------------------------------*/
157 
158 //- Temporarily change inputMode to %error for the following entry
159 class inputModeError
160 :
161  public functionEntry
162 {
163 public:
164 
165  //- Execute in a sub-dict context
166  static bool execute(dictionary& parentDict, Istream& is);
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace functionEntries
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
Foam::Enum< entry::inputMode >
Foam::functionEntries::inputModeOverwrite::execute
static bool execute(dictionary &parentDict, Istream &is)
Execute in a sub-dict context.
Definition: inputMode.C:161
Foam::functionEntries::inputModeError::execute
static bool execute(dictionary &parentDict, Istream &is)
Execute in a sub-dict context.
Definition: inputMode.C:181
Foam::functionEntries::inputMode::execute
static bool execute(dictionary &unused, Istream &is)
Change the global input-mode.
Definition: inputMode.C:114
Foam::functionEntries::inputModeOverwrite
Temporarily change inputMode to overwrite for the following entry.
Definition: inputMode.H:126
functionEntry.H
Foam::functionEntries::inputModeMerge
Temporarily change inputMode to merge for the following entry.
Definition: inputMode.H:110
Foam::entry::inputMode
inputMode
The input mode options.
Definition: entry.H:76
entry.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::functionEntries::inputModeDefault::execute
static bool execute(dictionary &parentDict, Istream &is)
Execute in a sub-dict context.
Definition: inputMode.C:141
Foam::functionEntries::inputModeDefault
Temporarily change inputMode to protect for the following entry.
Definition: inputMode.H:94
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::functionEntries::inputMode::selectableNames
static const Enum< entry::inputMode > selectableNames
Text representations of the selectable input modes.
Definition: inputMode.H:82
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionEntries::inputModeWarn::execute
static bool execute(dictionary &parentDict, Istream &is)
Execute in a sub-dict context.
Definition: inputMode.C:171
Foam::functionEntry
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:65
Foam::functionEntries::inputModeWarn
Temporarily change inputMode to warn for the following entry.
Definition: inputMode.H:142
Foam::functionEntries::inputModeError
Temporarily change inputMode to error for the following entry.
Definition: inputMode.H:158
Foam::functionEntries::inputModeMerge::execute
static bool execute(dictionary &parentDict, Istream &is)
Execute in a sub-dict context.
Definition: inputMode.C:151
Enum.H