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

bool.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 Primitive
00026     bool
00027 
00028 Description
00029     System bool
00030 
00031 SourceFiles
00032     boolIO.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef bool_H
00037 #define bool_H
00038 
00039 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00040 
00041 namespace Foam
00042 {
00043 
00044 class Istream;
00045 class Ostream;
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 Istream& operator>>(Istream&, bool&);
00050 Ostream& operator<<(Ostream&, const bool);
00051 
00052 bool readBool(Istream&);
00053 
00054 } // End namespace Foam
00055 
00056 
00057 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00058 
00059 #include "pTraits.H"
00060 
00061 namespace Foam
00062 {
00063 
00064 // template specialisation for pTraits<bool>
00065 template<>
00066 class pTraits<bool>
00067 {
00068     bool p_;
00069 
00070 public:
00071 
00072     //- Component type
00073     typedef bool cmptType;
00074 
00075     // Member constants
00076 
00077         enum
00078         {
00079             dim = 3,         // Dimensionality of space
00080             rank = 0,        // Rank of bool is 0
00081             nComponents = 1  // Number of components in bool is 1
00082         };
00083 
00084     // Static data members
00085 
00086         static const char* const typeName;
00087         static const char* componentNames[];
00088         static const bool zero;
00089         static const bool one;
00090 
00091     // Constructors
00092 
00093         //- Construct from Istream
00094         pTraits(Istream&);
00095 
00096     // Member Functions
00097 
00098         operator bool() const
00099         {
00100             return p_;
00101         }
00102 };
00103 
00104 
00105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00106 
00107 } // End namespace Foam
00108 
00109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00110 
00111 #endif
00112 
00113 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd