FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025 
00026 \*---------------------------------------------------------------------------*/
00027 
00028 #include <OpenFOAM/IOstreams.H>
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00036 
00037 inline objectMap::objectMap()
00038 :
00039     index_(-1),
00040     masterObjects_(0)
00041 {}
00042 
00043 
00044 inline objectMap::objectMap(const label index, const labelList& master)
00045 :
00046     index_(index),
00047     masterObjects_(master)
00048 {}
00049 
00050 
00051 inline objectMap::objectMap(Istream& is)
00052 {
00053     // Read beginning of objectMap
00054     is.readBegin("objectMap");
00055 
00056     is >> index_ >> static_cast<labelList&>(masterObjects_);
00057 
00058     // Read master of objectMap
00059     is.readEnd("objectMap");
00060 
00061     // Check state of Istream
00062     is.check("objectMap::objectMap(Istream&)");
00063 }
00064 
00065 
00066 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00067 
00068 label& objectMap::index()
00069 {
00070     return index_;
00071 }
00072 
00073 
00074 inline label objectMap::index() const
00075 {
00076     return index_;
00077 }
00078 
00079 
00080 inline labelList& objectMap::masterObjects()
00081 {
00082     return masterObjects_;
00083 }
00084 
00085 
00086 inline const labelList& objectMap::masterObjects() const
00087 {
00088     return masterObjects_;
00089 }
00090 
00091 
00092 // * * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * //
00093 
00094 inline bool operator==(const objectMap& a, const objectMap& b)
00095 {
00096     return
00097     (
00098         (a.index_ == b.index_) && (a.masterObjects_ == b.masterObjects_)
00099     );
00100 }
00101 
00102 
00103 inline bool operator!=(const objectMap& a, const objectMap& b)
00104 {
00105     return (!(a == b));
00106 }
00107 
00108 
00109 // * * * * * * * * * * * * * * * Ostream Operator *  * * * * * * * * * * * * //
00110 
00111 inline Ostream& operator<<(Ostream& os, const objectMap& a)
00112 {
00113     os  << token::BEGIN_LIST
00114         << a.index_ << token::SPACE
00115         << a.masterObjects_
00116         << token::END_LIST;
00117 
00118     // Check state of Ostream
00119     os.check("Ostream& operator<<(Ostream&, const objectMap&)");
00120 
00121     return os;
00122 }
00123 
00124 
00125 inline Istream& operator>>(Istream& is, objectMap& a)
00126 {
00127     is.readBegin("objectMap");
00128     is  >> a.index_ >> a.masterObjects_;
00129     is.readEnd("objectMap");
00130 
00131     // Check state of Istream
00132     is.check("Istream& operator>>(Istream&, objectMap&)");
00133 
00134     return is;
00135 }
00136 
00137 
00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00139 
00140 } // Master namespace Foam
00141 
00142 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines