inputModeEntry.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 | Copyright (C) 2011 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::functionEntries::inputModeEntry
26 
27 Description
28  Specify the input mode when reading dictionaries, expects
29  a single word to follow.
30 
31  An example of \c \#inputMode directive:
32  \verbatim
33  #inputMode merge
34  \endverbatim
35 
36  The possible input modes:
37  \param merge merge sub-dictionaries when possible
38  \param overwrite keep last entry and silently remove previous ones
39  \param protect keep initial entry and silently ignore subsequent ones
40  \param warn keep initial entry and warn about subsequent ones
41  \param error issue a FatalError for duplicate entries
42  \param default currently identical to merge
43 
44 SourceFiles
45  inputModeEntry.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef inputModeEntry_H
50 #define inputModeEntry_H
51 
52 #include "functionEntry.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 namespace functionEntries
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class inputModeEntry Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class inputModeEntry
66 :
67  public functionEntry
68 {
69  //- The input mode options
70  enum inputMode
71  {
76  ERROR
77  };
78 
79  //- The current input mode
80  static inputMode mode_;
81 
82 
83  // Private Member Functions
84 
85  //- Read the mode as a word and set enum appropriately
86  static void setMode(Istream&);
87 
88  //- Disallow default bitwise copy construct
90 
91  //- Disallow default bitwise assignment
92  void operator=(const inputModeEntry&);
93 
94 
95 public:
96 
97  //- Runtime type information
98  ClassName("inputMode");
99 
100 
101  // Member Functions
102 
103  //- Execute the functionEntry in a sub-dict context
104  static bool execute(dictionary& parentDict, Istream&);
105 
106  //- Reset the inputMode to %default (ie, %merge)
107  static void clear();
108 
109  //- Return true if the inputMode is %merge
110  static bool merge();
111 
112  //- Return true if the inputMode is %overwrite
113  static bool overwrite();
114 
115  //- Return true if the inputMode is %protect
116  static bool protect();
117 
118  //- Return true if the inputMode is %error
119  static bool error();
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace functionEntries
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
Foam::functionEntries::inputModeEntry::overwrite
static bool overwrite()
Return true if the inputMode is overwrite.
Definition: inputModeEntry.C:121
Foam::functionEntries::inputModeEntry::MERGE
@ MERGE
Definition: inputModeEntry.H:71
Foam::functionEntries::inputModeEntry::protect
static bool protect()
Return true if the inputMode is protect.
Definition: inputModeEntry.C:127
Foam::functionEntries::inputModeEntry::error
static bool error()
Return true if the inputMode is error.
Definition: inputModeEntry.C:132
Foam::functionEntries::inputModeEntry
Specify the input mode when reading dictionaries, expects a single word to follow.
Definition: inputModeEntry.H:64
Foam::functionEntries::inputModeEntry::inputModeEntry
inputModeEntry(const inputModeEntry &)
Disallow default bitwise copy construct.
Foam::functionEntries::inputModeEntry::clear
static void clear()
Reset the inputMode to default (ie, merge)
Definition: inputModeEntry.C:109
functionEntry.H
Foam::functionEntries::inputModeEntry::operator=
void operator=(const inputModeEntry &)
Disallow default bitwise assignment.
Foam::functionEntries::inputModeEntry::ClassName
ClassName("inputMode")
Runtime type information.
Foam::functionEntries::inputModeEntry::mode_
static inputMode mode_
The current input mode.
Definition: inputModeEntry.H:79
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::functionEntries::inputModeEntry::inputMode
inputMode
The input mode options.
Definition: inputModeEntry.H:69
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::functionEntry
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:63
Foam::functionEntries::inputModeEntry::PROTECT
@ PROTECT
Definition: inputModeEntry.H:73
Foam::functionEntries::inputModeEntry::WARN
@ WARN
Definition: inputModeEntry.H:74
Foam::functionEntries::inputModeEntry::OVERWRITE
@ OVERWRITE
Definition: inputModeEntry.H:72
Foam::functionEntries::inputModeEntry::ERROR
@ ERROR
Definition: inputModeEntry.H:75
Foam::functionEntries::inputModeEntry::setMode
static void setMode(Istream &)
Read the mode as a word and set enum appropriately.
Definition: inputModeEntry.C:61
Foam::functionEntries::inputModeEntry::merge
static bool merge()
Return true if the inputMode is merge.
Definition: inputModeEntry.C:115
Foam::functionEntries::inputModeEntry::execute
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
Definition: inputModeEntry.C:99