]>
code.delx.au - gnu-emacs/blob - test/manual/etags/cp-src/Range.h
3 Copyright (C) 1996 John W. Eaton
5 This file is part of Octave.
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #if !defined (octave_Range_h)
24 #define octave_Range_h 1
26 #if defined (__GNUG__)
40 : rng_base (-1), rng_limit (-1), rng_inc (-1), rng_nelem (-1) { }
42 Range (const Range
& r
)
43 : rng_base (r
.rng_base
), rng_limit (r
.rng_limit
), rng_inc (r
.rng_inc
),
44 rng_nelem (r
.rng_nelem
) { }
46 Range (double b
, double l
)
47 : rng_base (b
), rng_limit (l
), rng_inc (1),
48 rng_nelem (nelem_internal ()) { }
50 Range (double b
, double l
, double i
)
51 : rng_base (b
), rng_limit (l
), rng_inc (i
),
52 rng_nelem (nelem_internal ()) { }
54 double base (void) const { return rng_base
; }
55 double limit (void) const { return rng_limit
; }
56 double inc (void) const { return rng_inc
; }
57 int nelem (void) const { return rng_nelem
; }
59 bool all_elements_are_ints (void) const;
61 Matrix
matrix_value (void) const;
63 double min (void) const;
64 double max (void) const;
68 void set_base (double b
) { rng_base
= b
; }
69 void set_limit (double l
) { rng_limit
= l
; }
70 void set_inc (double i
) { rng_inc
= i
; }
72 friend ostream
& operator << (ostream
& os
, const Range
& r
);
73 friend istream
& operator >> (istream
& is
, Range
& r
);
75 void print_range (void);
85 int nelem_internal (void) const;
88 extern Range
operator - (const Range
& r
);
93 ;;; Local Variables: ***