Mercurial > octave-nkf
comparison src/oct-stream.cc @ 4946:48a39e2b2ab7
[project @ 2004-08-31 17:27:04 by jwe]
author | jwe |
---|---|
date | Tue, 31 Aug 2004 17:27:05 +0000 |
parents | 44046bbaa52c |
children | 25c2664861bc |
comparison
equal
deleted
inserted
replaced
4945:4bd917f8a4a7 | 4946:48a39e2b2ab7 |
---|---|
2768 { | 2768 { |
2769 if (stream_ok ("close")) | 2769 if (stream_ok ("close")) |
2770 rep->close (); | 2770 rep->close (); |
2771 } | 2771 } |
2772 | 2772 |
2773 // XXX FIXME XXX -- these trait classes probably belong somehwere else... | |
2774 | |
2775 template <typename T> | |
2776 class | |
2777 octave_type_traits | |
2778 { | |
2779 public: | |
2780 typedef T val_type; | |
2781 }; | |
2782 | |
2783 #define OCTAVE_TYPE_TRAIT(T, VAL_T) \ | |
2784 template <> \ | |
2785 class \ | |
2786 octave_type_traits<T> \ | |
2787 { \ | |
2788 public: \ | |
2789 typedef VAL_T val_type; \ | |
2790 } | |
2791 | |
2792 OCTAVE_TYPE_TRAIT (octave_int8, octave_int8::val_type); | |
2793 OCTAVE_TYPE_TRAIT (octave_uint8, octave_uint8::val_type); | |
2794 OCTAVE_TYPE_TRAIT (octave_int16, octave_int16::val_type); | |
2795 OCTAVE_TYPE_TRAIT (octave_uint16, octave_uint16::val_type); | |
2796 OCTAVE_TYPE_TRAIT (octave_int32, octave_int32::val_type); | |
2797 OCTAVE_TYPE_TRAIT (octave_uint32, octave_uint32::val_type); | |
2798 OCTAVE_TYPE_TRAIT (octave_int64, octave_int64::val_type); | |
2799 OCTAVE_TYPE_TRAIT (octave_uint64, octave_uint64::val_type); | |
2800 | |
2801 template <typename T> | |
2802 class octave_array_type_traits | |
2803 { | |
2804 public: | |
2805 typedef T element_type; | |
2806 }; | |
2807 | |
2808 #define OCTAVE_ARRAY_TYPE_TRAIT(T, ELT_T) \ | |
2809 template <> \ | |
2810 class \ | |
2811 octave_array_type_traits<T> \ | |
2812 { \ | |
2813 public: \ | |
2814 typedef ELT_T element_type; \ | |
2815 } | |
2816 | |
2817 OCTAVE_ARRAY_TYPE_TRAIT (charNDArray, char); | |
2818 OCTAVE_ARRAY_TYPE_TRAIT (int8NDArray, octave_int8); | |
2819 OCTAVE_ARRAY_TYPE_TRAIT (uint8NDArray, octave_uint8); | |
2820 OCTAVE_ARRAY_TYPE_TRAIT (int16NDArray, octave_int16); | |
2821 OCTAVE_ARRAY_TYPE_TRAIT (uint16NDArray, octave_uint16); | |
2822 OCTAVE_ARRAY_TYPE_TRAIT (int32NDArray, octave_int32); | |
2823 OCTAVE_ARRAY_TYPE_TRAIT (uint32NDArray, octave_uint32); | |
2824 OCTAVE_ARRAY_TYPE_TRAIT (int64NDArray, octave_int64); | |
2825 OCTAVE_ARRAY_TYPE_TRAIT (uint64NDArray, octave_uint64); | |
2826 OCTAVE_ARRAY_TYPE_TRAIT (NDArray, double); | |
2827 | |
2828 template <class RET_T, class READ_T> | 2773 template <class RET_T, class READ_T> |
2829 octave_value | 2774 octave_value |
2830 do_read (octave_stream& strm, int nr, int nc, int block_size, | 2775 do_read (octave_stream& strm, int nr, int nc, int block_size, |
2831 int skip, bool do_float_fmt_conv, | 2776 int skip, bool do_float_fmt_conv, |
2832 oct_mach_info::float_format from_flt_fmt, int& count) | 2777 oct_mach_info::float_format from_flt_fmt, int& count) |