OpenFOAM
dev
The OpenFOAM Foundation
inputModeEntry.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-2025 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
- \par merge merge sub-dictionaries when possible
38
- \par overwrite keep last entry and silently remove previous ones
39
- \par protect keep initial entry and silently ignore subsequent ones
40
- \par warn keep initial entry and warn about subsequent ones
41
- \par error issue a FatalError for duplicate entries
42
- \par 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
{
72
MERGE,
73
OVERWRITE,
74
PROTECT,
75
WARN,
76
ERROR
77
};
78
79
//- The current input mode
80
static
inputMode mode_;
81
82
83
public
:
84
85
//- Runtime type information
86
FunctionTypeName
(
"#inputMode"
);
87
88
89
// Constructors
90
91
//- Construct from line number, dictionary and Istream
92
inputModeEntry
93
(
94
const
label
lineNumber
,
95
const
dictionary
& parentDict,
96
Istream
& is
97
);
98
99
//- Copy construct
100
inputModeEntry
(
const
inputModeEntry
&) =
default
;
101
102
//- Clone
103
virtual
autoPtr<entry>
clone
(
const
dictionary
&)
const
104
{
105
return
autoPtr<entry>
(
new
inputModeEntry
(*
this
));
106
}
107
108
109
// Member Functions
110
111
//- Reset the inputMode to %default (ie, %merge)
112
static
void
clear
();
113
114
//- Return true if the inputMode is %merge
115
static
bool
merge
();
116
117
//- Return true if the inputMode is %overwrite
118
static
bool
overwrite
();
119
120
//- Return true if the inputMode is %protect
121
static
bool
protect
();
122
123
//- Return true if the inputMode is %error
124
static
bool
error
();
125
126
//- Expand the functionEntry into the contextDict
127
virtual
bool
execute
(
dictionary
& contextDict,
Istream
&);
128
129
130
// Member Operators
131
132
//- Disallow default bitwise assignment
133
void
operator=
(
const
inputModeEntry
&) =
delete
;
134
};
135
136
137
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139
}
// End namespace functionEntries
140
}
// End namespace Foam
141
142
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144
#endif
145
146
// ************************************************************************* //
Foam::IOstream::lineNumber
label lineNumber() const
Return current stream line number.
Definition:
IOstream.H:450
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition:
Istream.H:60
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition:
autoPtr.H:51
Foam::dictionary
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition:
dictionary.H:162
Foam::entry::clone
virtual autoPtr< entry > clone() const
Construct on freestore as copy.
Definition:
entry.C:56
Foam::functionEntries::inputModeEntry
Specify the input mode when reading dictionaries, expects a single word to follow.
Definition:
inputModeEntry.H:67
Foam::functionEntries::inputModeEntry::overwrite
static bool overwrite()
Return true if the inputMode is overwrite.
Definition:
inputModeEntry.C:79
Foam::functionEntries::inputModeEntry::protect
static bool protect()
Return true if the inputMode is protect.
Definition:
inputModeEntry.C:85
Foam::functionEntries::inputModeEntry::merge
static bool merge()
Return true if the inputMode is merge.
Definition:
inputModeEntry.C:73
Foam::functionEntries::inputModeEntry::error
static bool error()
Return true if the inputMode is error.
Definition:
inputModeEntry.C:90
Foam::functionEntries::inputModeEntry::FunctionTypeName
FunctionTypeName("#inputMode")
Runtime type information.
Foam::functionEntries::inputModeEntry::clear
static void clear()
Reset the inputMode to default (ie, merge)
Definition:
inputModeEntry.C:67
Foam::functionEntries::inputModeEntry::execute
virtual bool execute(dictionary &contextDict, Istream &)
Expand the functionEntry into the contextDict.
Definition:
inputModeEntry.C:97
Foam::functionEntries::inputModeEntry::operator=
void operator=(const inputModeEntry &)=delete
Disallow default bitwise assignment.
Foam::functionEntries::inputModeEntry::inputModeEntry
inputModeEntry(const label lineNumber, const dictionary &parentDict, Istream &is)
Construct from line number, dictionary and Istream.
Definition:
inputModeEntry.C:47
Foam::functionEntry
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition:
functionEntry.H:66
functionEntry.H
Foam
Namespace for OpenFOAM.
Definition:
atmosphericBoundaryLayer.C:32
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition:
label.H:59
src
OpenFOAM
db
dictionary
functionEntries
inputModeEntry
inputModeEntry.H
Generated by
1.9.1