changeset 20476:b22528fd3deb

Add placeholder functions for save_ascii, save_binary for octave_java (bug #45694). * ov-java.h: (save_ascii, load_ascii, save_binary, load_binary): New function prototypes overriding defaults in ov.h. * ov-java.cc (save_ascii, save_binary): New functions emit warning about inability to save java objects, and then return true so that other variables can be saved. * ov-java.cc (load_ascii, load_binary): New functions silently skip over null octave_java elements in a file produced by save_ascii() or save_binary().
author Rik <rik@octave.org>
date Thu, 13 Aug 2015 22:00:02 -0700
parents 3fc21d7ac11c
children 610c74748518
files libinterp/octave-value/ov-java.cc libinterp/octave-value/ov-java.h
diffstat 2 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc	Tue Aug 11 13:24:55 2015 -0700
+++ b/libinterp/octave-value/ov-java.cc	Thu Aug 13 22:00:02 2015 -0700
@@ -1846,6 +1846,40 @@
   os << "<Java object: " << java_classname << ">";
 }
 
+// FIXME: Need routines to actually save/load java objects through Serialize.
+//        See bug #42112. 
+
+bool
+octave_java::save_ascii (std::ostream& /* os */)
+{
+  warning ("save: unable to save java objects, skipping"); 
+
+  return true;
+}
+
+bool
+octave_java::load_ascii (std::istream& /* is */)
+{
+  // Silently skip over java object that was not saved
+  return true;
+}
+
+bool
+octave_java::save_binary (std::ostream& /* os */, bool& /* save_as_floats */)
+{
+  warning ("save: unable to save java objects, skipping"); 
+
+  return true;
+}
+
+bool
+octave_java::load_binary (std::istream& /* is */, bool /* swap*/,
+                          oct_mach_info::float_format /* fmt */)
+{
+  // Silently skip over java object that was not saved
+  return true;
+}
+
 octave_value
 octave_java::do_javaMethod (JNIEnv* jni_env, const std::string& name,
                             const octave_value_list& args)
--- a/libinterp/octave-value/ov-java.h	Tue Aug 11 13:24:55 2015 -0700
+++ b/libinterp/octave-value/ov-java.h	Thu Aug 13 22:00:02 2015 -0700
@@ -157,6 +157,15 @@
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
   octave_value_list
   subsref (const std::string& type,
            const std::list<octave_value_list>& idx, int nargout);