IOList.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::IOList
26 
27 Description
28  A List of objects of type <Type> with automated input and output.
29 
30 SourceFiles
31  IOList.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef IOList_H
36 #define IOList_H
37 
38 #include "regIOobject.H"
39 #include "List.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class IOListBase Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template
51 <
52  template<class> class Container,
53  template<class> class IOContainer,
54  class Type
55 >
56 class IOListBase
57 :
58  public regIOobject,
59  public Container<Type>
60 {
61 
62 public:
63 
64  // Public Static Data
65 
66  //- Does this object support re-reading?
67  static const bool rereading = false;
68 
69 
70  // Constructors
71 
72  //- Construct from IOobject
73  IOListBase(const IOobject&);
74 
75  //- Construct from IOobject; does local processor require reading?
76  IOListBase(const IOobject&, const bool read);
77 
78  //- Construct from IOobject and size (does not set values)
79  IOListBase(const IOobject&, const label size);
80 
81  //- Construct from IOobject and a Container
82  IOListBase(const IOobject&, const Container<Type>&);
83 
84  //- Move construct by transferring the Container contents
85  IOListBase(const IOobject&, Container<Type>&&);
86 
87  //- Copy constructor
89 
90  //- Move constructor
92 
93 
94  //- Destructor
95  virtual ~IOListBase();
96 
97 
98  // Member Functions
99 
100  //- WriteData function required for regIOobject write operation
101  virtual bool writeData(Ostream&) const;
102 
103 
104  // Member Operators
105 
106  //- Inherit assignment operators
107  using Container<Type>::operator=;
108 
109  //- Assign to another IOList
111 
112  //- Move-assign to another IOList
114 };
115 
116 
117 /*---------------------------------------------------------------------------*\
118  Class IOList Declaration
119 \*---------------------------------------------------------------------------*/
120 
121 template<class Type>
122 class IOList
123 :
124  public IOListBase<List, IOList, Type>
125 {
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("List");
131 
132 
133  // Constructors
134 
135  //- Inherit constructors
137 
138 
139  // Member Operators
140 
141  //- Inherit assignment operators
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #ifdef NoRepository
153  #include "IOList.C"
154 #endif
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition: IOList.C:309
void operator=(const IOListBase< Container, IOContainer, Type > &)
Assign to another IOList.
Definition: IOList.C:326
static const bool rereading
Does this object support re-reading?
Definition: IOList.H:66
IOListBase(const IOobject &)
Construct from IOobject.
Definition: IOList.C:36
virtual ~IOListBase()
Destructor.
Definition: IOList.C:296
A List of objects of type <Type> with automated input and output.
Definition: IOList.H:124
TypeName("List")
Runtime type information.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
virtual bool read()
Read object.
Namespace for OpenFOAM.
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