Loading...
Searching...
No Matches
userValue.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) 2024 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::substitutionModels::userValue
28
29Description
30 The \c userValue substitution model. Dictionaries can be retrieved from
31 an object registry, e.g. time, mesh, or from a file.
32
33 \verbatim
34 userValues1
35 {
36 // Mandatory entries
37 type userValue;
38
39 entries
40 {
41 my_keyword1 "My local string value";
42 my_keyword2 "My local string value";
43 }
44
45 // Inherited entries
46 ...
47 }
48 \endverbatim
49
50 The entries mean:
51 \table
52 Property | Description | Type | Reqd | Deflt
53 type | Type name: userValue | word | yes | -
54 entries | Keyword lookup pairs | dictionary | yes | -
55 \endtable
56
57 The inherited entries are elaborated in:
58 - \link substitutionModel.H \endlink
59
60SourceFiles
61 userValue.C
62
63---------------------------------------------------------------------------*/
64
65#ifndef Foam_substitutionModels_userValue_H
66#define Foam_substitutionModels_userValue_H
67
68#include "substitutionModel.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74
75namespace substitutionModels
76{
77
78/*---------------------------------------------------------------------------*\
79 Class userValue Declaration
80\*---------------------------------------------------------------------------*/
81
82class userValue
83:
84 public substitutionModel
85{
86 // Private Data
87
88 //- Hash table for key and environment variable pairs
89 HashTable<string> entries_;
90
91
92 // Private Functions
93
94 //- No copy construct
95 userValue(const userValue&) = delete;
96
97 //- No copy assignment
98 void operator=(const userValue&) = delete;
99
100
101public:
102
103 //- Runtime type information
104 TypeName("userValue");
105
106
107 //- Constructor
108 userValue(const dictionary& dict, const Time& time);
109
110
111 //- Destructor
112 virtual ~userValue() = default;
113
114
115 // Member Functions
116
117 //- Return true of model applies to this keyName
118 virtual bool valid(const word& keyName) const;
119
120 //- Apply substitutions to this string buffer
121 virtual bool apply(const word& key, string& buffer) const;
122
123 //- Return a word list of the keys
124 virtual wordList keys() const;
126
127
128// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129
130} // End namespace substitutionModels
131} // End namespace Foam
132
133// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134
135#endif
136
137// ************************************************************************* //
A HashTable similar to std::unordered_map.
Definition HashTable.H:124
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
The userValue substitution model. Dictionaries can be retrieved from an object registry,...
Definition userValue.H:98
virtual bool apply(const word &key, string &buffer) const
Apply substitutions to this string buffer.
Definition userValue.C:73
TypeName("userValue")
Runtime type information.
virtual bool valid(const word &keyName) const
Return true of model applies to this keyName.
Definition userValue.C:64
virtual wordList keys() const
Return a word list of the keys.
Definition userValue.C:86
virtual ~userValue()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68