GNU Octave  4.4.1
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-2018 VZLU Prague
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_ov_oncleanup_h)
24 #define octave_ov_oncleanup_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 
30 #include "ov-base.h"
31 #include "ov-struct.h"
32 #include "ov.h"
33 
34 
36 {
37 public:
38  octave_oncleanup (void) : fcn () { }
39 
41 
42  octave_base_value * clone (void) const
43  {
44  if (fcn.is_defined ())
45  error ("onCleanup: internal error: cloning nonempty object");
46 
47  return empty_clone ();
48  }
49 
51  {
52  return new octave_oncleanup ();
53  }
54 
55  ~octave_oncleanup (void);
56 
57  bool is_defined (void) const { return true; }
58 
59  bool isobject (void) const { return true; } // do we want this?
60 
61  octave_map map_value (void) const { return scalar_map_value (); }
62 
64 
65  dim_vector dims (void) const
66  {
67  static dim_vector dv (1, 1);
68  return dv;
69  }
70 
71  bool save_ascii (std::ostream& os);
72 
73  bool load_ascii (std::istream& is);
74 
75  bool save_binary (std::ostream& os, bool& save_as_floats);
76 
77  bool load_binary (std::istream& is, bool swap,
79 
80  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
81 
82  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
83 
84  void print (std::ostream& os, bool pr_as_read_syntax = false);
85 
86  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
87 
88 private:
89 
91 
92 protected:
93 
95 };
96 
97 #endif
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
octave_map map_value(void) const
Definition: ov-oncleanup.h:61
octave_value fcn
Definition: ov-oncleanup.h:94
void error(const char *fmt,...)
Definition: error.cc:578
bool is_defined(void) const
Definition: ov.h:523
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool swap
Definition: load-save.cc:738
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:158
nd deftypefn *std::string name
Definition: sysdep.cc:647
octave_base_value * clone(void) const
Definition: ov-oncleanup.h:42
bool save_as_floats
Definition: load-save.cc:1617
int64_t octave_hdf5_id
bool save_binary(std::ostream &os, bool &save_as_floats)
octave_oncleanup(void)
Definition: ov-oncleanup.h:38
octave_base_value * empty_clone(void) const
Definition: ov-oncleanup.h:50
bool save_ascii(std::ostream &os)
bool is_defined(void) const
Definition: ov-oncleanup.h:57
void print(std::ostream &os, bool pr_as_read_syntax=false)
bool load_ascii(std::istream &is)
bool isobject(void) const
Definition: ov-oncleanup.h:59
octave_scalar_map scalar_map_value(void) const
write the output to stdout if nargout is
Definition: load-save.cc:1612
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
dim_vector dv
Definition: sub2ind.cc:263
dim_vector dims(void) const
Definition: ov-oncleanup.h:65
octave::stream os
Definition: file-io.cc:627
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)