IOList.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::IOList
29 
30 Description
31  A List of objects of type <T> with automated input and output.
32 
33 SourceFiles
34  IOList.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef IOList_H
39 #define IOList_H
40 
41 #include "List.H"
42 #include "regIOobject.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class IOList Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class T>
54 class IOList
55 :
56  public regIOobject,
57  public List<T>
58 {
59 public:
60 
61  //- Runtime type information
62  TypeName("List");
63 
64 
65  // Constructors
66 
67  //- Default copy construct
68  IOList(const IOList&) = default;
69 
70  //- Construct from IOobject
71  explicit IOList(const IOobject& io);
72 
73  //- Construct from IOobject and size of IOList
74  IOList(const IOobject& io, const label len);
75 
76  //- Construct from IOobject and a copy of UList content
77  IOList(const IOobject& io, const UList<T>& content);
78 
79  //- Construct by transferring the List content
80  IOList(const IOobject& io, List<T>&& content);
81 
82 
83  //- Destructor
84  virtual ~IOList() = default;
85 
86 
87  // Member Functions
88 
89  bool writeData(Ostream& os) const;
90 
91 
92  // Member Operators
93 
94  //- Copy assignment of entries
95  void operator=(const IOList<T>& rhs);
96 
97  //- Copy or move assignment of entries
98  using List<T>::operator=;
99 
100 };
101 
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 } // End namespace Foam
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 #ifdef NoRepository
110  #include "IOList.C"
111 #endif
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 #endif
116 
117 // ************************************************************************* //
regIOobject.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
List.H
Foam::IOList::TypeName
TypeName("List")
Runtime type information.
Foam::IOList::IOList
IOList(const IOList &)=default
Default copy construct.
Foam::IOList::operator=
void operator=(const IOList< T > &rhs)
Copy assignment of entries.
Definition: IOList.C:147
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOList::~IOList
virtual ~IOList()=default
Destructor.
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::IOList
A List of objects of type <T> with automated input and output.
Definition: IOList.H:53
Foam::IOList::writeData
bool writeData(Ostream &os) const
Pure virtual writeData function.
Definition: IOList.C:138
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
IOList.C