2 #ifndef vbl_io_array_2d_hxx_ 3 #define vbl_io_array_2d_hxx_ 10 #include <vsl/vsl_binary_io.h> 18 constexpr
short io_version_no = 1;
22 size_type array_rows = p.
rows();
23 size_type array_cols = p.
cols();
26 for (size_type i=0; i<array_rows; i++)
28 for (size_type j=0; j<array_cols; j++)
42 size_type array_rows, array_cols;
49 p.
resize(array_rows, array_cols);
50 for (size_type i=0; i<array_rows; i++)
52 for (size_type j=0; j<array_cols; j++)
58 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vbl_array_2d<T>&)\n" 59 <<
" Unknown version number "<< ver <<
'\n';
60 is.is().clear(std::ios::badbit);
70 os <<
"Rows: " << p.
rows() << std::endl
71 <<
"Columns: " << p.
cols() << std::endl;
73 for (size_type i =0; i<p.
rows() && i<5; i++)
75 for (size_type j=0; j<p.
cols() && j<5; j++)
88 #define VBL_IO_ARRAY_2D_INSTANTIATE(T) \ 89 template void vsl_print_summary(std::ostream &, const vbl_array_2d<T > &); \ 90 template void vsl_b_read(vsl_b_istream &, vbl_array_2d<T > &); \ 91 template void vsl_b_write(vsl_b_ostream &, const vbl_array_2d<T > &) 93 #endif // vbl_io_array_2d_hxx_
void vsl_b_read(vsl_b_istream &is, vbl_array_2d< T > &p)
Binary load self from stream.
void vsl_b_write(vsl_b_ostream &os, const vbl_array_2d< T > &p)
Binary save self to stream.
size_type rows() const
Return number of rows.
size_type cols() const
Return number of columns.
void vsl_print_summary(std::ostream &os, const vbl_array_2d< T > &p)
Output a human readable summary to the stream.
void resize(size_type m, size_type n)
change size.
Contains class for a templated 2d array.