OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 label& objectMap::index()
00070 {
00071     return index_;
00072 }
00073 
00074 
00075 inline label objectMap::index() const
00076 {
00077     return index_;
00078 }
00079 
00080 
00081 inline labelList& objectMap::masterObjects()
00082 {
00083     return masterObjects_;
00084 }
00085 
00086 
00087 inline const labelList& objectMap::masterObjects() const
00088 {
00089     return masterObjects_;
00090 }
00091 
00092 
00093 // * * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * //
00094 
00095 inline bool operator==(const objectMap& a, const objectMap& b)
00096 {
00097     return
00098     (
00099         (a.index_ == b.index_) && (a.masterObjects_ == b.masterObjects_)
00100     );
00101 }
00102 
00103 
00104 inline bool operator!=(const objectMap& a, const objectMap& b)
00105 {
00106     return (!(a == b));
00107 }
00108 
00109 
00110 // * * * * * * * * * * * * * * * Ostream Operator *  * * * * * * * * * * * * //
00111 
00112 inline Ostream& operator<<(Ostream& os, const objectMap& a)
00113 {
00114     os  << token::BEGIN_LIST
00115         << a.index_ << token::SPACE
00116         << a.masterObjects_
00117         << token::END_LIST;
00118 
00119     // Check state of Ostream
00120     os.check("Ostream& operator<<(Ostream&, const objectMap&)");
00121 
00122     return os;
00123 }
00124 
00125 
00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00127 
00128 } // Master namespace Foam
00129 
00130 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd