IOLongList.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25  An IOLongList of a given type is a list which supports automated
26  input and output.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "IOLongList.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 template<class T, label Offset>
41 :
42  regIOobject(io),
43  LongList<T, Offset>()
44 {
45  if
46  (
49  )
50  {
51  readStream(typeName) >> *this;
52  close();
53  }
54 }
55 
56 
57 template<class T, label Offset>
59 (
60  const IOobject& io,
61  const label size
62 )
63 :
64  regIOobject(io),
66 {}
67 
68 
69 template<class T, label Offset>
71 (
72  const IOobject& io,
73  const LongList<T, Offset>& list
74 )
75 :
76  regIOobject(io),
78 {
79  if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
80  {
81  readStream(typeName) >> *this;
82  close();
83  }
84 
86 }
87 
88 
89 template<class T, label Offset>
91 (
92  const IOLongList<T, Offset>& rhs
93 )
94 {
96 }
97 
98 
99 template<class T, label Offset>
101 (
102  const LongList<T, Offset>& rhs
103 )
104 {
106 }
107 
108 
109 template<class T, label Offset>
111 {
112  return (os << *this).good();
113 }
114 
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 } // End namespace Foam
119 
120 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
IOLongList.H
Foam::LongList
Definition: LongList.H:55
Foam::IOobject::headerOk
bool headerOk()
Read and check header info.
Definition: IOobject.C:439
Foam::label
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
Foam::IOobject::readOpt
readOption readOpt() const
Definition: IOobject.H:317
Foam::IOLongList::IOLongList
IOLongList(const IOobject &)
Construct from IOobject.
Definition: IOLongList.C:40
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::IOLongList
Definition: IOLongList.H:51
Foam::LongList::operator=
void operator=(const T &)
Assignment of all entries to the given value.
Definition: LongListI.H:378
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:60
Foam::regIOobject::readStream
Istream & readStream()
Return Istream.
Definition: regIOobjectRead.C:34
Foam::regIOobject::close
void close()
Close Istream.
Definition: regIOobjectRead.C:148
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::IOLongList::writeData
bool writeData(Ostream &) const
Pure virtual writaData function.
Definition: IOLongList.C:110
Foam::IOobject::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition: IOobject.H:110