1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. 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 \*---------------------------------------------------------------------------*/
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
53 // Forward declaration of friend functions and operators
55 Istream& operator>>(Istream&, scalarRange&);
56 Ostream& operator<<(Ostream&, const scalarRange&);
59 /*---------------------------------------------------------------------------*\
60 Class scalarRange Declaration
61 \*---------------------------------------------------------------------------*/
65 //- Enumeration defining the types of token
90 //- Construct an empty range
93 //- Construct a range from lower to upper
94 scalarRange(const scalar lower, const scalar upper);
96 //- Construct from Istream.
97 // Since commas can be used as list delimiters,
98 // leading and trailing commas are ignored.
99 scalarRange(Istream&);
104 //- Is the range empty?
107 //- Is the range non-empty?
110 //- Is the range 'EXACT'?
111 bool isExact() const;
113 //- The value constituting an 'EXACT' match
114 // or the values for 'UPPER' or 'LOWER' limits
115 scalar value() const;
118 scalar lower() const;
121 scalar upper() const;
123 //- Return true if the value is within the range
124 bool selected(const scalar) const;
129 bool operator==(const scalarRange&) const;
130 bool operator!=(const scalarRange&) const;
133 // IOstream Operators
135 friend Istream& operator>>(Istream&, scalarRange&);
136 friend Ostream& operator<<(Ostream&, const scalarRange&);
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 } // End namespace Foam
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 // ************************************************************************* //