dictionaryListEntry.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) 2016 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::dictionaryListEntry
29 
30 Description
31  Read/write List of dictionaries.
32 
33  The List entries get stored in a
34  dictionary which itself is stored in the parent dictionary with
35  keyword 'entryDDD' where DDD is the position in the parent dictionary.
36  The printing is again in List format - the keyword is only printed as
37  comment. Can be used to e.g. manipulate polyMesh/boundary files.
38 
39 SourceFiles
40  dictionaryListEntry.C
41  dictionaryListEntryIO.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef dictionaryListEntry_H
46 #define dictionaryListEntry_H
47 
48 #include "dictionaryEntry.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of friend functions and operators
56 
57 class dictionaryListEntry;
58 Ostream& operator<<(Ostream& os, const dictionaryListEntry& e);
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class dictionaryListEntry Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 :
67  public dictionaryEntry
68 {
69  // Private Member Functions
70 
71  //- No copy construct
73 
74 
75 public:
76 
77  // Constructors
78 
79  //- Construct from the parent dictionary and Istream
80  dictionaryListEntry(const dictionary& parentDict, Istream& is);
81 
82  //- Construct as copy for the given parent dictionary
84  (
85  const dictionary& parentDict,
86  const dictionaryListEntry& dictEnt
87  );
88 
89  autoPtr<entry> clone(const dictionary& parentDict) const
90  {
91  return autoPtr<entry>(new dictionaryListEntry(parentDict, *this));
92  }
93 
94 
95  // Member functions
96 
97  //- Write
98  virtual void write(Ostream& os) const;
99 
100  //- Return info proxy.
101  // Used to print token information to a stream
103  {
104  return *this;
105  }
106 
107 
108  // Ostream operator
109 
110  friend Ostream& operator<<(Ostream& os, const dictionaryListEntry& e);
111 };
112 
113 
114 template<>
115 Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryListEntry>& ip);
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:65
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::dictionaryListEntry::write
virtual void write(Ostream &os) const
Write.
Definition: dictionaryListEntryIO.C:117
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
dictionaryEntry.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::dictionaryListEntry::info
InfoProxy< dictionaryListEntry > info() const
Return info proxy.
Definition: dictionaryListEntry.H:101
Foam::dictionaryListEntry::operator<<
friend Ostream & operator<<(Ostream &os, const dictionaryListEntry &e)
Foam::dictionaryListEntry::clone
autoPtr< entry > clone(const dictionary &parentDict) const
Construct on freestore as copy with reference to the.
Definition: dictionaryListEntry.H:88
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::dictionary::clone
autoPtr< dictionary > clone() const
Construct and return clone.
Definition: dictionary.C:172
Foam::dictionaryListEntry
Read/write List of dictionaries.
Definition: dictionaryListEntry.H:64
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56