All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompactIOList.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-2019 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::CompactIOList
26 
27 Description
28  A List of objects of type <T> with automated input and output using
29  a compact storage. Behaves like IOList except when binary output in
30  case it writes a CompactListList.
31 
32  Useful for lists of small sublists e.g. faceList, cellList.
33 
34 SourceFiles
35  CompactIOList.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef CompactIOList_H
40 #define CompactIOList_H
41 
42 #include "ListCompactIO.H"
43 #include "regIOobject.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class CompactIOList Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class T, class BaseType>
55 class CompactIOList
56 :
57  public regIOobject,
58  public ListCompactIO<T, BaseType>
59 {
60  // Private Member Functions
61 
62  //- Read according to header type
63  void readFromStream();
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("CompactList");
69 
70 
71  // Constructors
72 
73  //- Construct from IOobject
74  CompactIOList(const IOobject&);
75 
76  //- Construct from IOobject and size of CompactIOList
77  CompactIOList(const IOobject&, const label);
78 
79  //- Construct from IOobject and a List
80  CompactIOList(const IOobject&, const List<T>&);
81 
82  //- Move construct by transferring the List contents
83  CompactIOList(const IOobject&, List<T>&&);
84 
85  //- Move constructor
87 
88 
89  // Destructor
90 
91  virtual ~CompactIOList();
92 
93 
94  // Member Functions
95 
96  virtual bool writeObject
97  (
101  const bool write
102  ) const;
103 
104  virtual bool writeData(Ostream&) const;
105 
106 
107  // Member Operators
108 
111 
112  void operator=(const List<T>&);
113  void operator=(List<T>&&);
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #ifdef NoRepository
124  #include "CompactIOList.C"
125 #endif
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
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
A List of objects of type <T> with input and output using a compact storage. Behaves like List except...
Definition: ListCompactIO.H:52
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
CompactIOList(const IOobject &)
Construct from IOobject.
Definition: CompactIOList.C:63
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual ~CompactIOList()
A List of objects of type <T> with automated input and output using a compact storage. Behaves like IOList except when binary output in case it writes a CompactListList.
Definition: CompactIOList.H:54
Version number type.
Definition: IOstream.H:96
TypeName("CompactList")
Runtime type information.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
void operator=(const CompactIOList< T, BaseType > &)
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType, const bool write) const
Write using given format, version and compression.
virtual bool write(const bool write=true) const
Write using setting from DB.
virtual bool writeData(Ostream &) const
Pure virtual writaData function.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.