GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-oncleanup.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2010-2015 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <iosfwd>
28 
29 #include "ov-base.h"
30 #include "ov-struct.h"
31 #include "ov.h"
32 
33 static void
35 {
36  error ("onCleanup: internal error: cloning nonempty object");
37 }
38 
40 {
41 public:
42  octave_oncleanup (void) : fcn () { }
43 
45 
46  octave_base_value *clone (void) const
47  {
48  if (fcn.is_defined ())
49  gripe_internal ();
50 
51  return empty_clone ();
52  }
53 
55  {
56  return new octave_oncleanup ();
57  }
58 
59  ~octave_oncleanup (void);
60 
61  bool is_defined (void) const { return true; }
62 
63  bool is_object (void) const { return true; } // do we want this?
64 
65  octave_map map_value (void) const { return scalar_map_value (); }
66 
68 
69  dim_vector dims (void) 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 private:
93 
95 
96 protected:
97 
99 };
dim_vector dims(void) const
Definition: ov-oncleanup.h:69
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
octave_value fcn
Definition: ov-oncleanup.h:98
octave_base_value * clone(void) const
Definition: ov-oncleanup.h:46
bool is_defined(void) const
Definition: ov.h:520
void error(const char *fmt,...)
Definition: error.cc:476
bool is_defined(void) const
Definition: ov-oncleanup.h:61
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:142
static void gripe_internal(void)
Definition: ov-oncleanup.h:34
octave_map map_value(void) const
Definition: ov-oncleanup.h:65
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
bool save_binary(std::ostream &os, bool &save_as_floats)
octave_oncleanup(void)
Definition: ov-oncleanup.h:42
bool is_object(void) const
Definition: ov-oncleanup.h:63
bool save_ascii(std::ostream &os)
octave_scalar_map scalar_map_value(void) const
octave_base_value * empty_clone(void) const
Definition: ov-oncleanup.h:54
void print(std::ostream &os, bool pr_as_read_syntax=false)
bool load_ascii(std::istream &is)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)