annotate src/ov-base-scalar.h @ 3775:13905c3a24af

[project @ 2001-02-06 01:56:59 by jwe]
author jwe
date Tue, 06 Feb 2001 01:57:06 +0000
parents b80bbb43a1a9
children f9ea3dcf58ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
1 /*
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
2
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
4
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
6
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
10 later version.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
11
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
15 for more details.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
16
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
20
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
21 */
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
22
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_base_scalar_h)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
24 #define octave_base_scalar_h 1
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
25
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
26 #if defined (__GNUG__)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
27 #pragma interface
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
28 #endif
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
29
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
30 #include <cstdlib>
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
31
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3278
diff changeset
32 #include <iostream>
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
33 #include <string>
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
34
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
35 #include "lo-mappers.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
36 #include "lo-utils.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
37 #include "oct-alloc.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
38 #include "str-vec.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
39
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
40 #include "ov-base.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
41 #include "ov-typeinfo.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
42
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
43 // Real scalar values.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
44
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
45 template <class ST>
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
46 class
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
47 octave_base_scalar : public octave_base_value
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
48 {
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
49 public:
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
50
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
51 octave_base_scalar (void)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
52 : octave_base_value () { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
53
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3523
diff changeset
54 octave_base_scalar (const ST& s)
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
55 : octave_base_value (), scalar (s) { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
56
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
57 octave_base_scalar (const octave_base_scalar& s)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
58 : octave_base_value (), scalar (s.scalar) { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
59
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
60 ~octave_base_scalar (void) { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
61
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
62 int rows (void) const { return 1; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
63
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
64 int columns (void) const { return 1; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
65
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
66 int length (void) const { return 1; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
67
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
68 bool is_constant (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
69
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
70 bool is_defined (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
71
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
72 octave_value all (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
73
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
74 octave_value any (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
75
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
76 bool is_scalar_type (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
77
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
78 bool is_numeric_type (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
79
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
80 bool is_true (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
81
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
82 void print (std::ostream& os, bool pr_as_read_syntax = false) const;
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
83
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
84 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
85
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
86 bool print_name_tag (std::ostream& os, const std::string& name) const;
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
87
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
88 protected:
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
89
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
90 // The value of this scalar.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
91 ST scalar;
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
92 };
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
93
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
94 #endif
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
95
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
96 /*
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
97 ;;; Local Variables: ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
98 ;;; mode: C++ ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
99 ;;; End: ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
100 */