annotate src/ov-base-scalar.h @ 4219:23d06c9e1edd

[project @ 2002-12-06 21:29:17 by jwe]
author jwe
date Fri, 06 Dec 2002 21:29:19 +0000
parents 5719210fff4c
children fc9a075d10fb
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
4192
5719210fff4c [project @ 2002-11-20 16:56:47 by jwe]
jwe
parents: 4066
diff changeset
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
3278
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
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
62 octave_value subsref (const std::string type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
63 const std::list<octave_value_list>& idx);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
64
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
65 octave_value subsasgn (const std::string type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
66 const std::list<octave_value_list>& idx,
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
67 const octave_value& rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
68
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
69 int rows (void) const { return 1; }
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 int columns (void) const { return 1; }
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 int length (void) const { return 1; }
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 bool is_constant (void) const { return true; }
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_defined (void) const { return true; }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
78
4017
0eb247b9cc9b [project @ 2002-08-03 04:07:14 by jwe]
jwe
parents: 3933
diff changeset
79 octave_value all (int = 0) const { return (scalar != 0.0); }
3278
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
80
4017
0eb247b9cc9b [project @ 2002-08-03 04:07:14 by jwe]
jwe
parents: 3933
diff changeset
81 octave_value any (int = 0) const { return (scalar != 0.0); }
3278
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 bool is_scalar_type (void) const { return true; }
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 bool is_numeric_type (void) const { return true; }
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 is_true (void) const { return (scalar != 0.0); }
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
88
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
89 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
90
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
91 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
92
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
93 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
94
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
95 protected:
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 // The value of this scalar.
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
98 ST scalar;
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
99 };
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
100
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
101 #endif
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
102
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
103 /*
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
104 ;;; Local Variables: ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
105 ;;; mode: C++ ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
106 ;;; End: ***
9c9f0c035309 [project @ 1999-10-12 06:03:49 by jwe]
jwe
parents:
diff changeset
107 */