GlobalIOList.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) 2015-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::GlobalIOList
26 
27 Description
28  IOContainer with global data (so optionally read from master)
29 
30 SourceFiles
31  GlobalIOList.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef GlobalIOList_H
36 #define GlobalIOList_H
37 
38 #include "regIOobject.H"
39 #include "List.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class GlobalIOListBase Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template
51 <
52  template<class> class Container,
53  template<class> class IOContainer,
54  class Type
55 >
56 class GlobalIOListBase
57 :
58  public regIOobject,
59  public Container<Type>
60 {
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct from IOobject
67  GlobalIOListBase(const IOobject&);
68 
69  //- Construct from IOobject and size (does not set values)
70  GlobalIOListBase(const IOobject&, const label size);
71 
72  //- Construct from IOobject and a Container
73  GlobalIOListBase(const IOobject&, const Container<Type>&);
74 
75  //- Move construct by transferring the Container contents
76  GlobalIOListBase(const IOobject&, Container<Type>&&);
77 
78  //- Copy constructor
80 
81  //- Move constructor
83 
84 
85  //- Destructor
86  virtual ~GlobalIOListBase();
87 
88 
89  // Member Functions
90 
91  //- Is object global
92  virtual bool global() const
93  {
94  return true;
95  }
96 
97  //- ReadData function required for regIOobject read operation
98  virtual bool readData(Istream&);
99 
100  //- WriteData function required for regIOobject write operation
101  virtual bool writeData(Ostream&) const;
102 
103  // Member Operators
104 
105  //- Inherit assignment operators
106  using Container<Type>::operator=;
107 
108  //- Assign to another GlobalIOList
110 
111  //- Move-assign to another GlobalIOList
113 };
114 
115 
116 /*---------------------------------------------------------------------------*\
117  Class GlobalIOList Declaration
118 \*---------------------------------------------------------------------------*/
119 
120 template<class Type>
121 class GlobalIOList
122 :
123  public GlobalIOListBase<List, GlobalIOList, Type>
124 {
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("List");
130 
131 
132  // Constructors
133 
134  //- Inherit constructors
136 
137 
138  // Member Operators
139 
140  //- Inherit assignment operators
142 };
143 
144 
145 //- Trait for obtaining global status
146 template<class Type>
147 struct typeGlobal<GlobalIOList<Type>>
148 {
149  static const bool global = true;
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160 # include "GlobalIOList.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
virtual ~GlobalIOListBase()
Destructor.
Definition: GlobalIOList.C:161
void operator=(const GlobalIOListBase< Container, IOContainer, Type > &)
Assign to another GlobalIOList.
Definition: GlobalIOList.C:207
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition: GlobalIOList.C:190
virtual bool global() const
Is object global.
Definition: GlobalIOList.H:91
GlobalIOListBase(const IOobject &)
Construct from IOobject.
Definition: GlobalIOList.C:37
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition: GlobalIOList.C:174
IOContainer with global data (so optionally read from master)
Definition: GlobalIOList.H:123
TypeName("List")
Runtime type information.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
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
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
Trait for obtaining global status.
Definition: IOobject.H:504
static const bool global
Definition: IOobject.H:505