OpenFOAM logo
Open Source CFD Toolkit

objectMapI.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "IOstreams.H"
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00037 
00038 inline objectMap::objectMap()
00039 :
00040     index_(-1),
00041     masterObjects_(0)
00042 {}
00043 
00044 
00045 inline objectMap::objectMap(const label index, const labelList& master)
00046 :
00047     index_(index),
00048     masterObjects_(master)
00049 {}
00050 
00051 
00052 inline objectMap::objectMap(Istream& is)
00053 {
00054     // Read beginning of objectMap
00055     is.readBegin("objectMap");
00056 
00057     is >> index_ >> static_cast<labelList&>(masterObjects_);
00058 
00059     // Read master of objectMap
00060     is.readEnd("objectMap");
00061 
00062     // Check state of Istream
00063     is.check("objectMap::objectMap(Istream&)");
00064 }
00065 
00066 
00067 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00068 
00069 inline label objectMap::index() const
00070 {
00071     return index_;
00072 }
00073 
00074 
00075 inline const labelList& objectMap::masterObjects() const
00076 {
00077     return masterObjects_;
00078 }
00079 
00080 
00081 // * * * * * * * * * * * * * * * * Frimaster Operators  * * * * * * * * * * * * //
00082 
00083 inline bool operator==(const objectMap& a, const objectMap& b)
00084 {
00085     return
00086     (
00087         (a.index_ == b.index_) && (a.masterObjects_ == b.masterObjects_)
00088     );
00089 }
00090 
00091 
00092 inline bool operator!=(const objectMap& a, const objectMap& b)
00093 {
00094     return (!(a == b));
00095 }
00096 
00097 
00098 // * * * * * * * * * * * * * * * Ostream Operator *  * * * * * * * * * * * * //
00099 
00100 inline Ostream& operator<<(Ostream& os, const objectMap& a)
00101 {
00102     os  << token::BEGIN_LIST
00103         << a.index_ << token::SPACE
00104         << a.masterObjects_
00105         << token::END_LIST;
00106 
00107     // Check state of Ostream
00108     os.check("Ostream& operator<<(Ostream&, const objectMap&)");
00109 
00110     return os;
00111 }
00112 
00113 
00114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00115 
00116 } // Master namespace Foam
00117 
00118 // ************************************************************************* //
For further information go to www.openfoam.org