GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-oncleanup.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2010-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_ov_oncleanup_h)
27 #define octave_ov_oncleanup_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 
33 #include "ov-base.h"
34 #include "ov-struct.h"
35 #include "ov.h"
36 
37 
39 {
40 public:
41 
42  octave_oncleanup () = default;
43 
45 
47  {
48  if (m_fcn.is_defined ())
49  error ("onCleanup: internal error: cloning nonempty object");
50 
51  return empty_clone ();
52  }
53 
55  {
56  return new octave_oncleanup ();
57  }
58 
60 
61  bool is_defined () const { return true; }
62 
63  bool isobject () const { return true; } // do we want this?
64 
65  octave_map map_value () const { return scalar_map_value (); }
66 
68 
69  dim_vector dims () const
70  {
71  static dim_vector dv (1, 1);
72  return dv;
73  }
74 
75  bool save_ascii (std::ostream& os);
76 
77  bool load_ascii (std::istream& is);
78 
79  bool save_binary (std::ostream& os, bool save_as_floats);
80 
81  bool load_binary (std::istream& is, bool swap,
83 
84  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
85 
86  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
87 
88  void print (std::ostream& os, bool pr_as_read_syntax = false);
89 
90  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
91 
92  void call_object_destructor ();
93 
95  {
96  if (m_count == 1)
98  }
99 
100 private:
101 
103 
104 protected:
105 
107 };
108 
109 #endif
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
octave::refcount< octave_idx_type > m_count
Definition: ov-base.h:933
octave_base_value * empty_clone() const
Definition: ov-oncleanup.h:54
bool is_defined() const
Definition: ov-oncleanup.h:61
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
void call_object_destructor()
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
octave_scalar_map scalar_map_value() const
Definition: ov-oncleanup.cc:74
bool save_binary(std::ostream &os, bool save_as_floats)
Definition: ov-oncleanup.cc:97
bool load_ascii(std::istream &is)
Definition: ov-oncleanup.cc:90
dim_vector dims() const
Definition: ov-oncleanup.h:69
octave_value m_fcn
Definition: ov-oncleanup.h:106
octave_base_value * clone() const
Definition: ov-oncleanup.h:46
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool isobject() const
Definition: ov-oncleanup.h:63
void maybe_call_dtor()
Definition: ov-oncleanup.h:94
void print(std::ostream &os, bool pr_as_read_syntax=false)
octave_map map_value() const
Definition: ov-oncleanup.h:65
bool save_ascii(std::ostream &os)
Definition: ov-oncleanup.cc:82
octave_oncleanup()=default
bool is_defined() const
Definition: ov.h:592
void() error(const char *fmt,...)
Definition: error.cc:988
float_format
Definition: mach-info.h:38
int64_t octave_hdf5_id
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:181