Mercurial > octave-nkf
comparison libinterp/corefcn/oct-stream.h @ 17416:6690dba6078a
improve efficiency of fwrite
* oct-stream.h, oct-stream.cc (write_int, do_write): Delete.
(convert_ints, convert_data, octave_stream::write_bytes
octave_stream::skip_bytes): New functions.
(octave_stream::write): Improve efficiency by writing data in larger
chunks.
* oct-stream.cc: Delete unnecessary template instantiations.
* data-conv.h, data-conv.cc (is_equivalent_type): New template.
Provide specializations for core Octave data types.
(oct_data_conv::data_type_size): New function.
(oct_data_conv::data_type_to_string): Correct spelling of unsigned.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 13 Sep 2013 23:31:11 -0400 |
parents | 68fc671a9339 |
children | 669ad11f282d |
comparison
equal
deleted
inserted
replaced
17415:3856298f1ff8 | 17416:6690dba6078a |
---|---|
35 | 35 |
36 #include "Array.h" | 36 #include "Array.h" |
37 #include "data-conv.h" | 37 #include "data-conv.h" |
38 #include "lo-utils.h" | 38 #include "lo-utils.h" |
39 #include "mach-info.h" | 39 #include "mach-info.h" |
40 #include "oct-locbuf.h" | |
40 #include "oct-refcount.h" | 41 #include "oct-refcount.h" |
41 | 42 |
42 class | 43 class |
43 OCTINTERP_API | 44 OCTINTERP_API |
44 scanf_format_elt | 45 scanf_format_elt |
537 oct_data_conv::data_type output_type, | 538 oct_data_conv::data_type output_type, |
538 octave_idx_type skip, oct_mach_info::float_format flt_fmt, | 539 octave_idx_type skip, oct_mach_info::float_format flt_fmt, |
539 octave_idx_type& count); | 540 octave_idx_type& count); |
540 | 541 |
541 octave_idx_type write (const octave_value& data, octave_idx_type block_size, | 542 octave_idx_type write (const octave_value& data, octave_idx_type block_size, |
542 oct_data_conv::data_type output_type, | 543 oct_data_conv::data_type output_type, |
543 octave_idx_type skip, oct_mach_info::float_format flt_fmt); | 544 octave_idx_type skip, |
545 oct_mach_info::float_format flt_fmt); | |
546 | |
547 bool write_bytes (const void *data, size_t n_elts); | |
548 | |
549 bool skip_bytes (size_t n_elts); | |
544 | 550 |
545 template <class T> | 551 template <class T> |
546 octave_idx_type write (const Array<T>&, octave_idx_type block_size, | 552 octave_idx_type write (const Array<T>& data, octave_idx_type block_size, |
547 oct_data_conv::data_type output_type, | 553 oct_data_conv::data_type output_type, |
548 octave_idx_type skip, oct_mach_info::float_format flt_fmt); | 554 octave_idx_type skip, |
555 oct_mach_info::float_format flt_fmt); | |
549 | 556 |
550 octave_value scanf (const std::string& fmt, const Array<double>& size, | 557 octave_value scanf (const std::string& fmt, const Array<double>& size, |
551 octave_idx_type& count, const std::string& who /* = "scanf" */); | 558 octave_idx_type& count, const std::string& who /* = "scanf" */); |
552 | 559 |
553 octave_value scanf (const octave_value& fmt, const Array<double>& size, | 560 octave_value scanf (const octave_value& fmt, const Array<double>& size, |