GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-legacy-range.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 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 <string>
35 
36 #include "Range.h"
37 
38 #include "lo-mappers.h"
39 #include "lo-utils.h"
40 #include "mx-base.h"
41 
42 #include "error.h"
43 #include "oct-stream.h"
44 #include "ov-base.h"
45 #include "ov-re-mat.h"
46 #include "ov-typeinfo.h"
47 
48 class octave_value_list;
49 
50 // Legacy Range values.
51 
52 // Provide enough of the old octave_range class to allow Range objects
53 // to be loaded from files. After loading, they are converted to some
54 // other type by a call to octave_value::maybe_mutate in
55 // load_save_system::load_vars so there should no longer be any values
56 // of this type used by the interpreter. The action of maybe_mutate is
57 // performed by octave_legacy_range::try_narrowing_conversion.
58 
59 class
61 {
62 public:
63 
64  octave_legacy_range (void);
65 
66  octave_legacy_range (const Range& r);
67 
69 
70  // No assignment.
71 
73 
75 
76  octave_base_value * clone (void) const
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 (void) const { return new octave_matrix (); }
85 
86  type_conv_info numeric_conversion_function (void) const;
87 
88  octave_base_value * try_narrowing_conversion (void);
89 
90  bool is_defined (void) const { return true; }
91 
92  bool is_legacy_object (void) const { return true; }
93 
94  bool is_constant (void) const { return true; }
95 
96  bool load_ascii (std::istream& is);
97 
98  bool load_binary (std::istream& is, bool swap,
100 
101  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
102 
103 private:
104 
106 
108 };
109 
110 #endif
Definition: Range.h:401
octave_base_value * clone(void) const
bool is_constant(void) const
octave_base_value * empty_clone(void) const
bool is_legacy_object(void) const
bool is_defined(void) const
octave_legacy_range(const octave_legacy_range &r)=default
octave_value_list & operator=(const octave_value_list &obj)=default
float_format
Definition: mach-info.h:38
T * r
Definition: mx-inlines.cc:773
int64_t octave_hdf5_id
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:181