GNU Octave  9.1.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-2024 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 
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_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE (octave_lvalue)
50 
51  bool is_black_hole () const { return m_black_hole; }
52 
53  void mark_black_hole () { m_black_hole = true; }
54 
55  bool is_defined () const;
56 
57  bool is_undefined () const;
58 
59  bool isstruct () const { return value().isstruct (); }
60 
61  void define (const octave_value& v);
62 
63  void assign (octave_value::assign_op, const octave_value&);
64 
65  octave_idx_type numel () const;
66 
67  void set_index (const std::string& t,
68  const std::list<octave_value_list>& i);
69 
70  void clear_index () { m_type = ""; m_idx.clear (); }
71 
72  std::string index_type () const { return m_type; }
73 
74  bool index_is_empty () const;
75 
76  bool index_is_colon () const;
77 
79 
80  octave_value value () const;
81 
82 private:
83 
85  eval_for_numel (const std::string& type,
86  const std::list<octave_value_list>& idx) const;
87 
88  symbol_record m_sym;
89 
90  std::shared_ptr<stack_frame> m_frame;
91 
92  bool m_black_hole;
93 
94  std::string m_type;
95 
96  std::list<octave_value_list> m_idx;
97 };
98 
99 OCTAVE_END_NAMESPACE(octave)
100 
101 #endif
void mark_black_hole()
Definition: oct-lvalue.h:53
void clear_index()
Definition: oct-lvalue.h:70
bool isstruct() const
Definition: oct-lvalue.h:59
octave_lvalue(const symbol_record &sr, const std::shared_ptr< stack_frame > &frame)
Definition: oct-lvalue.h:43
std::string index_type() const
Definition: oct-lvalue.h:72
unary_op
Definition: ov.h:79
assign_op
Definition: ov.h:134
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
T::size_type numel(const T &str)
Definition: oct-string.cc:74
octave_value unary_op(type_info &ti, octave_value::unary_op op, const octave_value &a)