GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-lvalue.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_oct_lvalue_h)
27 #define octave_oct_lvalue_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 
33 #include "ovl.h"
34 #include "stack-frame.h"
35 #include "symrec.h"
36 
37 namespace octave
38 {
40  {
41  public:
42 
44  const std::shared_ptr<stack_frame>& frame)
45  : m_sym (sr), m_frame (frame), m_black_hole (false),
46  m_type (), m_idx ()
47  { }
48 
49  octave_lvalue (const octave_lvalue&) = default;
50 
52 
53  ~octave_lvalue (void) = default;
54 
55  bool is_black_hole (void) const { return m_black_hole; }
56 
57  void mark_black_hole (void) { m_black_hole = true; }
58 
59  bool is_defined (void) const;
60 
61  bool is_undefined (void) const;
62 
63  bool isstruct (void) const { return value().isstruct (); }
64 
65  void define (const octave_value& v);
66 
68 
69  octave_idx_type numel (void) const;
70 
71  void set_index (const std::string& t, const std::list<octave_value_list>& i);
72 
73  void clear_index (void) { m_type = ""; m_idx.clear (); }
74 
75  std::string index_type (void) const { return m_type; }
76 
77  bool index_is_empty (void) const;
78 
79  bool index_is_colon (void) const;
80 
82 
83  octave_value value (void) const;
84 
85  private:
86 
88  eval_for_numel (const std::string& type,
89  const std::list<octave_value_list>& idx) const;
90 
92 
93  std::shared_ptr<stack_frame> m_frame;
94 
96 
97  std::string m_type;
98 
99  std::list<octave_value_list> m_idx;
100 
102  };
103 }
104 
105 #endif
bool isstruct(void) const
Definition: oct-lvalue.h:63
bool index_is_empty(void) const
Definition: oct-lvalue.cc:181
std::list< octave_value_list > m_idx
Definition: oct-lvalue.h:99
void assign(octave_value::assign_op, const octave_value &)
Definition: oct-lvalue.cc:55
void set_index(const std::string &t, const std::list< octave_value_list > &i)
Definition: oct-lvalue.cc:171
~octave_lvalue(void)=default
bool is_black_hole(void) const
Definition: oct-lvalue.h:55
octave_value value(void) const
Definition: oct-lvalue.cc:215
void define(const octave_value &v)
Definition: oct-lvalue.cc:50
symbol_record m_sym
Definition: oct-lvalue.h:91
octave_idx_type numel(void) const
Definition: oct-lvalue.cc:62
octave_lvalue(const octave_lvalue &)=default
std::string index_type(void) const
Definition: oct-lvalue.h:75
octave_value eval_for_numel(const std::string &type, const std::list< octave_value_list > &idx) const
Definition: oct-lvalue.cc:222
octave_lvalue(const symbol_record &sr, const std::shared_ptr< stack_frame > &frame)
Definition: oct-lvalue.h:43
void clear_index(void)
Definition: oct-lvalue.h:73
void do_unary_op(octave_value::unary_op op)
Definition: oct-lvalue.cc:209
octave_lvalue & operator=(const octave_lvalue &)=delete
std::shared_ptr< stack_frame > m_frame
Definition: oct-lvalue.h:93
bool is_undefined(void) const
Definition: oct-lvalue.cc:45
std::string m_type
Definition: oct-lvalue.h:97
bool index_is_colon(void) const
Definition: oct-lvalue.cc:195
octave_idx_type m_nel
Definition: oct-lvalue.h:101
bool is_defined(void) const
Definition: oct-lvalue.cc:40
void mark_black_hole(void)
Definition: oct-lvalue.h:57
unary_op
Definition: ov.h:83
assign_op
Definition: ov.h:138
bool isstruct(void) const
Definition: ov.h:605