All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dynamicCodeContext.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-2019 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::dynamicCodeContext
26 
27 Description
28  Encapsulation of dynamic code dictionaries
29 
30 SourceFiles
31  dynamicCodeContext.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef dynamicCodeContext_H
36 #define dynamicCodeContext_H
37 
38 #include "dictionary.H"
39 #include "HashTable.H"
40 #include "SHA1Digest.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class dynamicCodeContext Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 {
53  // Private Data
54 
55  //- The parent dictionary context
56  const dictionary& dict_;
57 
58  //- Code entries
59  HashTable<string> code_;
60 
61  //- Optional "codeOptions" entry
62  string options_;
63 
64  //- Optional "codeLibs" entry
65  string libs_;
66 
67  //- Calculated SHA1Digest
68  SHA1Digest sha1_;
69 
70 
71  // Private Member Functions
72 
73  //- Add a \#line directive to the start of the given source string that
74  // compilation messages are meaningful
75  static void addLineDirective
76  (
77  string&,
78  const label lineNum,
79  const fileName& name
80  );
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Construct from a dictionary and lists of which entries correspond
88  // to code
90  (
91  const dictionary& dict,
92  const wordList& codeKeys
93  );
94 
95 
96  // Member Functions
97 
98  //- Return the parent dictionary context
99  const dictionary& dict() const
100  {
101  return dict_;
102  }
103 
104  //- Return the code table
105  const HashTable<string>& code() const
106  {
107  return code_;
108  }
109 
110  //- Return the code-options
111  const string& options() const
112  {
113  return options_;
114  }
115 
116  //- Return the code-libs
117  const string& libs() const
118  {
119  return libs_;
120  }
121 
122  //- Return SHA1 digest calculated from include, options, code
123  const SHA1Digest& sha1() const
124  {
125  return sha1_;
126  }
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
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
A class for handling file names.
Definition: fileName.H:79
const SHA1Digest & sha1() const
Return SHA1 digest calculated from include, options, code.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
The SHA1 message digest.
Definition: SHA1Digest.H:62
const dictionary & dict() const
Return the parent dictionary context.
An STL-conforming hash table.
Definition: HashTable.H:61
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
const HashTable< string > & code() const
Return the code table.
const string & libs() const
Return the code-libs.
Encapsulation of dynamic code dictionaries.
const string & options() const
Return the code-options.
dynamicCodeContext(const dictionary &dict, const wordList &codeKeys)
Construct from a dictionary and lists of which entries correspond.
Namespace for OpenFOAM.