GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-legacy-range.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2025 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_ov_legacy_range_h)
27#define octave_ov_legacy_range_h 1
28
29#include "octave-config.h"
30
31#include <cstdlib>
32
33#include <iosfwd>
34#include <memory>
35#include <string>
36
37#include "lo-mappers.h"
38#include "lo-utils.h"
39#include "mx-base.h"
40
41#include "error.h"
42#include "oct-stream.h"
43#include "ov-base.h"
44#include "ov-re-mat.h"
45#include "ov-typeinfo.h"
46
47class Range;
48
50
51// Legacy Range values.
52
53// Provide enough of the old octave_range class to allow Range objects
54// to be loaded from files. After loading, they are converted to some
55// other type by a call to octave_value::maybe_mutate in
56// load_save_system::load_vars so there should no longer be any values
57// of this type used by the interpreter. The action of maybe_mutate is
58// performed by octave_legacy_range::try_narrowing_conversion.
59
61{
62public:
63
65
66 octave_legacy_range (const Range& r);
67
69
70 // No assignment.
71
73
75
77 {
78 return new octave_legacy_range (*this);
79 }
80
81 // A range is really just a special kind of real matrix object. In
82 // the places where we need to call empty_clone, it makes more sense
83 // to create an empty matrix (0x0) instead of an empty range (1x0).
84 octave_base_value * empty_clone () const { return new octave_matrix (); }
85
86 type_conv_info numeric_conversion_function () const;
87
89
90 bool is_defined () const { return true; }
91
92 bool is_legacy_object () const { return true; }
93
94 bool is_constant () const { return true; }
95
96 bool load_ascii (std::istream& is);
97
98 bool load_binary (std::istream& is, bool swap,
99 octave::mach_info::float_format fmt);
100
101 bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
102
103private:
104
105 std::unique_ptr<Range> m_range;
106
108};
109
110#endif
bool load_ascii(std::istream &is)
~octave_legacy_range()=default
octave_base_value * empty_clone() const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
bool is_legacy_object() const
octave_legacy_range & operator=(const octave_legacy_range &)=delete
octave_base_value * try_narrowing_conversion()
bool is_defined() const
bool is_constant() const
octave_base_value * clone() const
type_conv_info numeric_conversion_function() const
int64_t octave_hdf5_id
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA_API(API)
Definition ov-base.h:185