annotate libinterp/octave-value/ov-oncleanup.h @ 29358:0a5b15007766 stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 09:52:15 -0500
parents bd51beb6205e
children b16e0d357437
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
3 // Copyright (C) 2010-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
21213
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21102
diff changeset
26 #if ! defined (octave_ov_oncleanup_h)
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21102
diff changeset
27 #define octave_ov_oncleanup_h 1
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21102
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21213
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21213
diff changeset
30
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <iosfwd>
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "ov-base.h"
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include "ov-struct.h"
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "ov.h"
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 class octave_oncleanup : public octave_base_value
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 {
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 public:
26655
cca0548f7b86 refactor calling object destructor
John W. Eaton <jwe@octave.org>
parents: 26399
diff changeset
41
cca0548f7b86 refactor calling object destructor
John W. Eaton <jwe@octave.org>
parents: 26399
diff changeset
42 octave_oncleanup (void) = default;
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 octave_oncleanup (const octave_value& fcn);
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
46 octave_base_value * clone (void) const
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 {
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 if (fcn.is_defined ())
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 20265
diff changeset
49 error ("onCleanup: internal error: cloning nonempty object");
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 return empty_clone ();
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 }
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
54 octave_base_value * empty_clone (void) const
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 {
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 return new octave_oncleanup ();
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 }
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 ~octave_oncleanup (void);
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 bool is_defined (void) const { return true; }
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
23587
0c468af9dc00 maint: Deprecate is_object and replace with isobject.
Rik <rik@octave.org>
parents: 23446
diff changeset
63 bool isobject (void) const { return true; } // do we want this?
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 octave_map map_value (void) const { return scalar_map_value (); }
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 octave_scalar_map scalar_map_value (void) const;
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 dim_vector dims (void) const
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 {
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 static dim_vector dv (1, 1);
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 return dv;
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 }
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 bool save_ascii (std::ostream& os);
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 bool load_ascii (std::istream& is);
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78
26399
586413770c7f pass save_as_floats by value in octave_value save_binary functions
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
79 bool save_binary (std::ostream& os, bool save_as_floats);
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 bool load_binary (std::istream& is, bool swap,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
82 octave::mach_info::float_format fmt);
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19697
diff changeset
84 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19697
diff changeset
86 bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87
18416
bcd71a2531d3 Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17744
diff changeset
88 void print (std::ostream& os, bool pr_as_read_syntax = false);
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91
26655
cca0548f7b86 refactor calling object destructor
John W. Eaton <jwe@octave.org>
parents: 26399
diff changeset
92 void call_object_destructor (void);
cca0548f7b86 refactor calling object destructor
John W. Eaton <jwe@octave.org>
parents: 26399
diff changeset
93
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 private:
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 protected:
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 octave_value fcn;
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 };
21213
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21102
diff changeset
102
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21102
diff changeset
103 #endif