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 -------------------------------------------------------------------------------
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::IOPtrList
29 
30 Description
31  A PtrList of objects of type <T> with automated input and output.
32 
33 SourceFiles
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 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class IOPtrList Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class T>
54 class IOPtrList
55 :
56  public regIOobject,
57  public PtrList<T>
58 {
59 public:
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 // ************************************************************************* //
regIOobject.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::IOPtrList::operator=
void operator=(const IOPtrList< T > &rhs)
Copy assignment of entries.
Definition: IOPtrList.C:159
Foam::IOPtrList
A PtrList of objects of type <T> with automated input and output.
Definition: IOPtrList.H:53
Foam::IOPtrList::~IOPtrList
virtual ~IOPtrList()=default
Destructor.
Foam::INew
A helper class when constructing from an Istream or dictionary.
Definition: INew.H:51
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
IOPtrList.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:68
Foam::IOPtrList::TypeName
TypeName("PtrList")
Runtime type information.
PtrList.H
Foam::IOPtrList::writeData
bool writeData(Ostream &os) const
Pure virtual writeData function.
Definition: IOPtrList.C:150
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::IOPtrList::IOPtrList
IOPtrList(const IOPtrList &)=default
Default copy construct.