Mercurial > octave-nkf
comparison libinterp/octave-value/ov-str-mat.cc @ 19897:09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
* oct-hdf5-id.cc, oct-hdf5-id.h: New files.
* libinterp/corefcn/module.mk: Update.
* libgui/src/module.mk (src_libgui_src_la_CPPFLAGS): Remove
$(HDF5_CPPFLAGS) from the list.
* load-save.h (enum load_save_format_type): Always include LS_HDF5
in the list of values.
* ls-hdf5.cc (read_hdf5_data, save_hdf5_data):
Call check_hdf5_id_type.
* oct-hdf5.h: Also #define HDF5_SAVE_TYPE.
* ov.h, ov-base.h: Include oct-hdf5-id.h instead of oct-hdf5.h.
Always declare load_hdf5 and save_hdf5 functions.
* ov-base-int.cc, ov-base-int.h, ov-base.cc, ov-bool-mat.cc,
ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-cell.cc, ov-cell.h, ov-class.cc, ov-class.h,
ov-complex.cc, ov-complex.h, ov-cx-mat.cc, ov-cx-mat.h,
ov-cx-sparse.cc, ov-cx-sparse.h, ov-fcn-handle.cc, ov-fcn-handle.h,
ov-fcn-inline.cc, ov-fcn-inline.h, ov-float.cc, ov-float.h,
ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-mat.cc,
ov-flt-cx-mat.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-lazy-idx.h, ov-oncleanup.cc,
ov-oncleanup.h, ov-range.cc ov-range.h, ov-re-mat.cc, ov-re-mat.h,
ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h,
ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-uint16.cc,
ov-uint32.cc, ov-uint64.cc, ov-uint8.cc: Move #ifdef HAVE_HDF5 inside
load_hdf5 and save_hdf5 functions. Always declare and define
load_hdf5 and save_hdf5 functions.
author | John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org> |
---|---|
date | Thu, 26 Feb 2015 10:49:20 -0500 |
parents | 4197fc428c7d |
children | b2100e1659ac |
comparison
equal
deleted
inserted
replaced
19896:6b851f6acd55 | 19897:09ed6f7538dd |
---|---|
42 #include "ls-ascii-helper.h" | 42 #include "ls-ascii-helper.h" |
43 #include "ls-hdf5.h" | 43 #include "ls-hdf5.h" |
44 #include "ls-oct-ascii.h" | 44 #include "ls-oct-ascii.h" |
45 #include "ls-utils.h" | 45 #include "ls-utils.h" |
46 #include "oct-obj.h" | 46 #include "oct-obj.h" |
47 #include "oct-hdf5.h" | |
47 #include "oct-stream.h" | 48 #include "oct-stream.h" |
48 #include "ops.h" | 49 #include "ops.h" |
49 #include "ov-scalar.h" | 50 #include "ov-scalar.h" |
50 #include "ov-re-mat.h" | 51 #include "ov-re-mat.h" |
51 #include "ov-str-mat.h" | 52 #include "ov-str-mat.h" |
567 matrix = chm; | 568 matrix = chm; |
568 } | 569 } |
569 return true; | 570 return true; |
570 } | 571 } |
571 | 572 |
573 bool | |
574 octave_char_matrix_str::save_hdf5 (octave_hdf5_id loc_id, const char *name, | |
575 bool /* save_as_floats */) | |
576 { | |
577 bool retval = false; | |
578 | |
572 #if defined (HAVE_HDF5) | 579 #if defined (HAVE_HDF5) |
573 | 580 |
574 bool | |
575 octave_char_matrix_str::save_hdf5 (hid_t loc_id, const char *name, | |
576 bool /* save_as_floats */) | |
577 { | |
578 dim_vector dv = dims (); | 581 dim_vector dv = dims (); |
579 int empty = save_hdf5_empty (loc_id, name, dv); | 582 int empty = save_hdf5_empty (loc_id, name, dv); |
580 if (empty) | 583 if (empty) |
581 return (empty > 0); | 584 return (empty > 0); |
582 | 585 |
583 int rank = dv.length (); | 586 int rank = dv.length (); |
584 hid_t space_hid, data_hid; | 587 hid_t space_hid, data_hid; |
585 space_hid = data_hid = -1; | 588 space_hid = data_hid = -1; |
586 bool retval = true; | |
587 charNDArray m = char_array_value (); | 589 charNDArray m = char_array_value (); |
588 | 590 |
589 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank); | 591 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank); |
590 | 592 |
591 // Octave uses column-major, while HDF5 uses row-major ordering | 593 // Octave uses column-major, while HDF5 uses row-major ordering |
617 H5P_DEFAULT, s) >= 0; | 619 H5P_DEFAULT, s) >= 0; |
618 | 620 |
619 H5Dclose (data_hid); | 621 H5Dclose (data_hid); |
620 H5Sclose (space_hid); | 622 H5Sclose (space_hid); |
621 | 623 |
624 #else | |
625 gripe_save ("hdf5"); | |
626 #endif | |
627 | |
622 return retval; | 628 return retval; |
623 } | 629 } |
624 | 630 |
625 bool | 631 bool |
626 octave_char_matrix_str::load_hdf5 (hid_t loc_id, const char *name) | 632 octave_char_matrix_str::load_hdf5 (octave_hdf5_id loc_id, const char *name) |
627 { | 633 { |
628 bool retval = false; | 634 bool retval = false; |
635 | |
636 #if defined (HAVE_HDF5) | |
629 | 637 |
630 dim_vector dv; | 638 dim_vector dv; |
631 int empty = load_hdf5_empty (loc_id, name, dv); | 639 int empty = load_hdf5_empty (loc_id, name, dv); |
632 if (empty > 0) | 640 if (empty > 0) |
633 matrix.resize (dv); | 641 matrix.resize (dv); |
786 H5Dclose (data_hid); | 794 H5Dclose (data_hid); |
787 return false; | 795 return false; |
788 } | 796 } |
789 } | 797 } |
790 | 798 |
799 #else | |
800 gripe_load ("hdf5"); | |
801 #endif | |
802 | |
791 return retval; | 803 return retval; |
792 } | 804 } |
793 | |
794 #endif |