1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A scalar range specifier.
30 The range selector can be specified as an "LOWER:UPPER" range, as a
31 "LOWER:" bound, as an ":UPPER" bound or simply as an "EXACT" value.
32 The read constructor uses a colon (:) as a range marker and a comma (,)
33 to delimit the next possible range selector.
38 \*---------------------------------------------------------------------------*/
43 #include "debugSwitch.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
54 // Forward declaration of friend functions and operators
56 Istream& operator>>(Istream&, scalarRange&);
57 Ostream& operator<<(Ostream&, const scalarRange&);
60 /*---------------------------------------------------------------------------*\
61 Class scalarRange Declaration
62 \*---------------------------------------------------------------------------*/
66 //- Enumeration defining the types of token
86 static debug::debugSwitch debug;
95 scalarRange(const scalar& lower, const scalar& upper);
97 //- Construct from Istream.
98 // Since commas can be used as list delimiters,
99 // leading and trailing commas are ignored.
100 scalarRange(Istream&);
105 //- Is the range non-empty?
106 bool isDefined() const;
108 //- Is the range 'EXACT'?
109 bool isExact() const;
111 //- The value constituting an 'EXACT' match
112 // or the values for 'UPPER' or 'LOWER' limits
113 scalar value() const;
116 scalar lower() const;
119 scalar upper() const;
121 //- Return true if the value is within the range
122 bool selected(const scalar&) const;
127 bool operator==(const scalarRange&) const;
128 bool operator!=(const scalarRange&) const;
131 // IOstream Operators
133 friend Istream& operator>>(Istream&, scalarRange&);
134 friend Ostream& operator<<(Ostream&, const scalarRange&);
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 // ************************************************************************* //