functionEntry.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) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
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 
26 Namespace
27  Foam::functionEntries
28 
29 Description
30  Namespace for containing a functionEntry.
31 
32 
33 Class
34  Foam::functionEntry
35 
36 Description
37  A functionEntry causes entries to be added/manipulated on the specified
38  dictionary given an input stream.
39 
40  In dictionaries, a \c '\#' sigil is typically used for a functionEntry.
41 
42 SourceFiles
43  functionEntry.C
44  functionEntryIO.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef functionEntry_H
49 #define functionEntry_H
50 
51 #include "word.H"
53 #include "primitiveEntry.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 class dictionary;
61 
62 /*---------------------------------------------------------------------------*\
63  Class functionEntry Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class functionEntry
67 :
68  public primitiveEntry
69 {
70  // Private Member Functions
71 
72  //- No copy construct
73  functionEntry(const functionEntry&) = delete;
74 
75  //- No copy assignment
76  void operator=(const functionEntry&) = delete;
77 
78 
79 protected:
80 
81  //- Read line and return as a string token
82  static token readLine(const word& key, Istream& is);
83 
84  //- Read a List of strings values, treating a single entry like a
85  //- list of size 1.
86  template<class StringType>
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct from keyword, parent dictionary and Istream
94  functionEntry(const word& key, const dictionary& dict, Istream& is);
95 
96 
97  // Member Function Selectors
98 
100  (
101  bool,
103  execute,
104  dictionaryIstream,
105  (
106  dictionary& parentDict,
107  Istream& is
108  ),
109  (parentDict, is)
110  );
111 
112  //- Execute the functionEntry in a sub-dict context
113  static bool execute
114  (
115  const word& functionName,
116  dictionary& parentDict,
117  Istream& is
118  );
119 
121  (
122  bool,
124  execute,
125  primitiveEntryIstream,
126  (
127  const dictionary& parentDict,
129  Istream& is
130  ),
131  (parentDict, entry, is)
132  );
133 
134  //- Execute the functionEntry in a primitiveEntry context
135  static bool execute
136  (
137  const word& functionName,
138  const dictionary& parentDict,
140  Istream& is
141  );
142 
143  //- Write
144  virtual void write(Ostream& os) const;
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #ifdef NoRepository
155  #include "functionEntryTemplates.C"
156 #endif
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::functionEntry::readStringList
static List< StringType > readStringList(Istream &is)
Foam::primitiveEntry
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
Definition: primitiveEntry.H:63
primitiveEntry.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::functionEntry::write
virtual void write(Ostream &os) const
Write.
Definition: functionEntry.C:160
Foam::token
A token holds an item read from Istream.
Definition: token.H:68
Foam::primitiveEntry::dict
virtual const dictionary & dict() const
This entry is not a dictionary,.
Definition: primitiveEntry.C:297
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionEntry
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:65
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::functionEntry::readLine
static token readLine(const word &key, Istream &is)
Read line and return as a string token.
Definition: functionEntry.C:54
Foam::functionEntry::declareMemberFunctionSelectionTable
declareMemberFunctionSelectionTable(bool, functionEntry, execute, dictionaryIstream,(dictionary &parentDict, Istream &is),(parentDict, is))
memberFunctionSelectionTables.H
Macros to enable the easy declaration of member function selection tables.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::functionEntry::execute
static bool execute(const word &functionName, dictionary &parentDict, Istream &is)
Execute the functionEntry in a sub-dict context.
Definition: functionEntry.C:83
functionEntryTemplates.C