objectMapI.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 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "IOstreams.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 inline Foam::objectMap::objectMap(const label index, const labelUList& master)
33 :
34  index_(index),
35  objects_(master)
36 {}
37 
38 
39 inline Foam::objectMap::objectMap(const label index, labelList&& master)
40 :
41  index_(index),
42  objects_(std::move(master))
43 {}
44 
45 
47 {
48  is.readBegin("objectMap");
49 
50  is >> index_ >> objects_;
51 
52  is.readEnd("objectMap");
53  is.check(FUNCTION_NAME);
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * //
58 
59 inline bool Foam::operator==(const objectMap& a, const objectMap& b)
60 {
61  return
62  (
63  (a.index_ == b.index_) && (a.objects_ == b.objects_)
64  );
65 }
66 
67 
68 inline bool Foam::operator!=(const objectMap& a, const objectMap& b)
69 {
70  return !(a == b);
71 }
72 
73 
74 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
75 
76 inline Foam::Ostream& Foam::operator<<(Ostream& os, const objectMap& a)
77 {
79  << a.index_ << token::SPACE
80  << a.objects_
82 
84  return os;
85 }
86 
87 
88 inline Foam::Istream& Foam::operator>>(Istream& is, objectMap& a)
89 {
90  is.readBegin("objectMap");
91  is >> a.index_ >> a.objects_;
92  is.readEnd("objectMap");
93 
94  is.check(FUNCTION_NAME);
95  return is;
96 }
97 
98 
99 // ************************************************************************* //
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:45
bool readBegin(const char *funcName)
Begin read of data chunk, starts with &#39;(&#39;.
Definition: Istream.C:134
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Begin list [isseparator].
Definition: token.H:161
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Istream & operator>>(Istream &, directionInfo &)
Space [isspace].
Definition: token.H:131
End list [isseparator].
Definition: token.H:162
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
bool readEnd(const char *funcName)
End read of data chunk, ends with &#39;)&#39;.
Definition: Istream.C:152
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:297
objectMap() noexcept
Default construct, with index=-1 and no objects.
Definition: objectMap.H:78
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)