IOPtrList.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 Copyright (C) 2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::IOPtrList
29
30Description
31 A PtrList of objects of type <T> with automated input and output.
32
33SourceFiles
34 IOPtrList.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef IOPtrList_H
39#define IOPtrList_H
40
41#include "PtrList.H"
42#include "regIOobject.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class IOPtrList Declaration
51\*---------------------------------------------------------------------------*/
52
53template<class T>
54class IOPtrList
55:
56 public regIOobject,
57 public PtrList<T>
58{
59public:
60
61 //- Runtime type information
62 TypeName("PtrList");
63
64
65 // Constructors
66
67 //- Default copy construct
68 IOPtrList(const IOPtrList&) = default;
69
70 //- Construct from IOobject
71 explicit IOPtrList(const IOobject& io);
72
73 //- Construct from IOobject using given Istream constructor class
74 template<class INew>
75 IOPtrList(const IOobject& io, const INew& inewt);
76
77 //- Construct from IOobject with given size
78 IOPtrList(const IOobject& io, const label len);
79
80 //- Construct from IOobject and a copy of PtrList content
81 IOPtrList(const IOobject& io, const PtrList<T>& content);
82
83 //- Construct by transferring the PtrList content
84 IOPtrList(const IOobject& io, PtrList<T>&& content);
85
86
87 //- Destructor
88 virtual ~IOPtrList() = default;
89
90
91 // Member Functions
92
93 bool writeData(Ostream& os) const;
94
95
96 // Member Operators
97
98 //- Copy assignment of entries
99 void operator=(const IOPtrList<T>& rhs);
100
101 //- Copy or move assignment of entries
102 using PtrList<T>::operator=;
103};
104
105
106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
108} // End namespace Foam
109
110// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112#ifdef NoRepository
113 #include "IOPtrList.C"
114#endif
115
116// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117
118#endif
119
120// ************************************************************************* //
A helper class when constructing from an Istream or dictionary.
Definition: INew.H:52
A PtrList of objects of type <T> with automated input and output.
Definition: IOPtrList.H:57
TypeName("PtrList")
Runtime type information.
bool writeData(Ostream &os) const
Pure virtual writeData function.
Definition: IOPtrList.C:150
IOPtrList(const IOPtrList &)=default
Default copy construct.
virtual ~IOPtrList()=default
Destructor.
void operator=(const IOPtrList< T > &rhs)
Copy assignment of entries.
Definition: IOPtrList.C:159
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
friend Ostream & operator(Ostream &os, const UPtrList< T > &list)
Write UPtrList to Ostream.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
const volScalarField & T
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73