annotate src/ov-base-scalar.h @ 3278:9c9f0c035309

[project @ 1999-10-12 06:03:49 by jwe]
author jwe
date Tue, 12 Oct 1999 06:07:01 +0000
parents
children d14c483b3c12
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
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
32 #include <string>
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
33
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
34 class ostream;
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
35
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
36 #include "lo-mappers.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
37 #include "lo-utils.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
38 #include "oct-alloc.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
39 #include "str-vec.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
40
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
41 #include "ov-base.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
42 #include "ov-typeinfo.h"
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
43
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
44 // Real scalar values.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
45
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
46 template <class ST>
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
47 class
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
48 octave_base_scalar : public octave_base_value
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
49 {
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
50 public:
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
51
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
52 octave_base_scalar (void)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
53 : octave_base_value () { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
54
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
55 octave_base_scalar (ST s)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
56 : octave_base_value (), scalar (s) { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
57
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
58 octave_base_scalar (const octave_base_scalar& s)
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
59 : octave_base_value (), scalar (s.scalar) { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
60
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
61 ~octave_base_scalar (void) { }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
62
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
63 int rows (void) const { return 1; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
64
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
65 int columns (void) const { return 1; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
66
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
67 int length (void) const { return 1; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
68
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
69 bool is_constant (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
70
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
71 bool is_defined (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
72
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
73 octave_value all (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
74
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
75 octave_value any (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
76
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
77 bool is_scalar_type (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
78
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
79 bool is_numeric_type (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
80
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
81 bool is_true (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
82
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
83 void print (ostream& os, bool pr_as_read_syntax = false) const;
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
84
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
85 void print_raw (ostream& os, bool pr_as_read_syntax = false) const;
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
86
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
87 bool print_name_tag (ostream& os, const string& name) const;
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
88
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
89 protected:
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
90
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
91 // The value of this scalar.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
92 ST scalar;
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
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
95 #endif
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 /*
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
98 ;;; Local Variables: ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
99 ;;; mode: C++ ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
100 ;;; End: ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
101 */