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

entry.C

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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "entry.H"
00028 #include "dictionary.H"
00029 #include "OStringStream.H"
00030 
00031 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00032 
00033 Foam::entry::entry(const keyType& keyword)
00034 :
00035     keyword_(keyword)
00036 {}
00037 
00038 
00039 Foam::entry::entry(const entry& e)
00040 :
00041     IDLList<entry>::link(),
00042     keyword_(e.keyword_)
00043 {}
00044 
00045 
00046 Foam::autoPtr<Foam::entry> Foam::entry::clone() const
00047 {
00048     return clone(dictionary::null);
00049 }
00050 
00051 
00052 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00053 
00054 void Foam::entry::operator=(const entry& e)
00055 {
00056     // check for assignment to self
00057     if (this == &e)
00058     {
00059         FatalErrorIn("entry::operator=(const entry&)")
00060             << "attempted assignment to self"
00061             << abort(FatalError);
00062     }
00063 
00064     keyword_ = e.keyword_;
00065 }
00066 
00067 
00068 bool Foam::entry::operator==(const entry& e) const
00069 {
00070     if (keyword_ != e.keyword_)
00071     {
00072         return false;
00073     }
00074     else
00075     {
00076         OStringStream oss1;
00077         oss1 << *this;
00078 
00079         OStringStream oss2;
00080         oss2 << e;
00081 
00082         return oss1.str() == oss2.str();
00083     }
00084 }
00085 
00086 
00087 bool Foam::entry::operator!=(const entry& e) const
00088 {
00089     return !operator==(e);
00090 }
00091 
00092 
00093 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd