GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
oct-lvalue.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
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 3 of the License, or (at your
10 option) any later version.
11 
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
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_oct_lvalue_h)
24 #define octave_oct_lvalue_h 1
25 
26 #include "octave-config.h"
27 
28 class octave_value;
29 class octave_value_list;
30 
31 #include <string>
32 
33 #include "ovl.h"
34 #include "pt-idx.h"
35 #include "symtab.h"
36 
37 class
39 {
40 public:
41 
44  : sym (s), type (), idx (), nel (1)
45  { }
46 
48  : sym (vr.sym), type (vr.type), idx (vr.idx), nel (vr.nel)
49  { }
50 
52  {
53  if (this != &vr)
54  {
55  sym = vr.sym;
56  type = vr.type;
57  idx = vr.idx;
58  nel = vr.nel;
59  }
60 
61  return *this;
62  }
63 
64  ~octave_lvalue (void) { }
65 
66  bool is_black_hole (void) const { return sym.is_black_hole (); }
67 
68  bool is_defined (void) const
69  {
70  return ! is_black_hole () && sym->is_defined ();
71  }
72 
73  bool is_undefined (void) const
74  {
75  return is_black_hole () || sym->is_undefined ();
76  }
77 
78  bool is_map (void) const
79  {
80  return value().is_map ();
81  }
82 
83  void define (const octave_value& v) { sym->assign (v); }
84 
85  void assign (octave_value::assign_op, const octave_value&);
86 
87  void numel (octave_idx_type n) { nel = n; }
88 
89  octave_idx_type numel (void) const { return nel; }
90 
91  void set_index (const std::string& t, const std::list<octave_value_list>& i);
92 
93  void clear_index (void) { type = ""; idx.clear (); }
94 
95  std::string index_type (void) const { return type; }
96 
97  bool index_is_empty (void) const;
98 
100 
101  octave_value value (void) const;
102 
103 private:
104 
106 
108 
109  std::list<octave_value_list> idx;
110 
112 };
113 
114 #endif
octave_idx_type numel(void) const
Definition: oct-lvalue.h:89
octave_lvalue(const octave_lvalue &vr)
Definition: oct-lvalue.h:47
octave_idx_type nel
Definition: oct-lvalue.h:111
assign_op
Definition: ov.h:131
octave_value do_unary_op(octave_value::unary_op op, const octave_value &v)
Definition: ov.cc:2645
symbol_table::symbol_reference sym
Definition: oct-lvalue.h:105
bool is_map(void) const
Definition: oct-lvalue.h:78
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
s
Definition: file-io.cc:2682
octave_lvalue(const symbol_table::symbol_reference &s=symbol_table::symbol_reference())
Definition: oct-lvalue.h:42
std::string type
Definition: oct-lvalue.h:107
void define(const octave_value &v)
Definition: oct-lvalue.h:83
bool is_black_hole(void) const
Definition: oct-lvalue.h:66
void numel(octave_idx_type n)
Definition: oct-lvalue.h:87
idx type
Definition: ov.cc:3129
bool is_defined(void) const
Definition: oct-lvalue.h:68
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by nd tex zero divided by nd ifnottex and any operation involving another NaN value(5+NaN).Note that NaN always compares not equal to NaN(NaN!
std::string index_type(void) const
Definition: oct-lvalue.h:95
std::list< octave_value_list > idx
Definition: oct-lvalue.h:109
void clear_index(void)
Definition: oct-lvalue.h:93
~octave_lvalue(void)
Definition: oct-lvalue.h:64
bool is_undefined(void) const
Definition: oct-lvalue.h:73
unary_op
Definition: ov.h:76
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
octave_value_list & operator=(const octave_value_list &obj)
Definition: ovl.h:75