Loading...
Searching...
No Matches
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-2023 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 Foam_IOPtrList_H
39#define Foam_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 // Factory Methods
88
89 //- Read and return contents. The IOobject will not be registered
90 static PtrList<T> readContents(const IOobject& io);
91
92
93 //- Destructor
94 virtual ~IOPtrList() = default;
95
96
97 // Member Functions
98
99 bool writeData(Ostream& os) const;
100
101
102 // Member Operators
103
104 //- Copy or move assignment of entries
105 using PtrList<T>::operator=;
106
107 //- Copy assignment of entries
108 void operator=(const IOPtrList<T>& rhs)
109 {
111 }
112
113 //- Move assignment of entries
115 {
116 PtrList<T>::operator=(std::move(static_cast<PtrList<T>&>(rhs)));
117 }
118};
119
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123} // End namespace Foam
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127#ifdef NoRepository
128 #include "IOPtrList.C"
129#endif
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132
133#endif
134
135// ************************************************************************* //
A helper class when constructing from an Istream or dictionary.
Definition INew.H:47
A PtrList of objects of type <T> with automated input and output.
Definition IOPtrList.H:53
TypeName("PtrList")
Runtime type information.
bool writeData(Ostream &os) const
Pure virtual writeData function.
Definition IOPtrList.C:133
IOPtrList(const IOPtrList &)=default
Default copy construct.
void operator=(IOPtrList< T > &&rhs)
Move assignment of entries.
Definition IOPtrList.H:133
static PtrList< T > readContents(const IOobject &io)
Read and return contents. The IOobject will not be registered.
Definition IOPtrList.C:115
virtual ~IOPtrList()=default
Destructor.
void operator=(const IOPtrList< T > &rhs)
Copy assignment of entries.
Definition IOPtrList.H:125
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
void operator=(const UPtrList< T > &list)
Copy assignment.
Definition PtrListI.H:304
constexpr PtrList() noexcept
Default construct.
Definition PtrListI.H:29
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
Definition regIOobject.C:43
OBJstream os(runTime.globalPath()/outputName)
const auto & io
Namespace for OpenFOAM.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68