Loading...
Searching...
No Matches
environmentVariable.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::environmentVariable
28
29Description
30 The \c environmentVariable substitution model.
31
32 \verbatim
33 environmentVariables1
34 {
35 // Mandatory entries
36 type environmentVariable;
37
38 entries
39 {
40 home "HOME";
41 ldpath "LD_LIBRARY_PATH";
42 }
43
44 // Inherited entries
45 ...
46 }
47 \endverbatim
48
49 The entries mean:
50 \table
51 Property | Description | Type | Reqd | Deflt
52 type | Type name: environmentVariable | word | yes | -
53 entries | Keyword lookup pairs | dictionary | yes | -
54 \endtable
55
56 The inherited entries are elaborated in:
57 - \link substitutionModel.H \endlink
58
59SourceFiles
60 environmentVariable.C
61
62---------------------------------------------------------------------------*/
63
64#ifndef Foam_substitutionModels_environmentVariable_H
65#define Foam_substitutionModels_environmentVariable_H
66
67#include "substitutionModel.H"
68
69// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70
71namespace Foam
72{
73
74namespace substitutionModels
75{
76
77/*---------------------------------------------------------------------------*\
78 Class environmentVariable Declaration
79\*---------------------------------------------------------------------------*/
80
82:
83 public substitutionModel
84{
85 // Private Data
86
87 //- Hash table for key and environment variable pairs
88 HashTable<string> entries_;
89
90
91 // Private Functions
92
93 //- No copy construct
94 environmentVariable(const environmentVariable&) = delete;
95
96 //- No copy assignment
97 void operator=(const environmentVariable&) = delete;
98
99
100public:
101
102 //- Runtime type information
103 TypeName("environmentVariable");
104
105
106 //- Constructor
107 environmentVariable(const dictionary& dict, const Time& time);
108
109
110 //- Destructor
111 virtual ~environmentVariable() = default;
112
113
114 // Member Functions
115
116 //- Return true of model applies to this keyName
117 virtual bool valid(const word& keyName) const;
118
119 //- Apply substitutions to this string buffer
120 virtual bool apply(const word& key, string& buffer) const;
121
122 //- Return a word list of the keys
123 virtual wordList keys() const;
125
126
127// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128
129} // End namespace substitutionModels
130} // End namespace Foam
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134#endif
135
136// ************************************************************************* //
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 environmentVariable substitution model.
virtual bool apply(const word &key, string &buffer) const
Apply substitutions to this string buffer.
virtual bool valid(const word &keyName) const
Return true of model applies to this keyName.
virtual ~environmentVariable()=default
Destructor.
virtual wordList keys() const
Return a word list of the keys.
TypeName("environmentVariable")
Runtime type information.
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