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