2 #ifndef vsl_block_binary_rle_h_ 3 #define vsl_block_binary_rle_h_ 12 # include <vcl_msvc_warnings.h> 24 if (nelems==0)
return;
27 const T* current=begin+1;
29 std::size_t block_count=1;
57 if (nelems==0)
return;
63 std::size_t block_count;
65 if (block_count > nelems)
67 std::cerr <<
"I/O ERROR: vsl_block_binary_rle_read(&is, T* begin, std::size_t nelems)\n" 68 <<
" Too many elements in stream.\n";
69 is.
is().clear(std::ios::badbit);
72 std::fill(last+1, last+block_count, *last);
79 std::cerr <<
"I/O ERROR: vsl_block_binary_rle_read(&is, T* begin, std::size_t nelems)\n" 80 <<
" Unknown version number "<< ver <<
'\n';
81 is.
is().clear(std::ios::badbit);
86 #endif // vsl_block_binary_rle_h_ A binary output adaptor for any std::ostream.
void vsl_b_write(vsl_b_ostream &os, char n)
Write char to vsl_b_ostream.
void vsl_block_binary_rle_write(vsl_b_ostream &os, const T *begin, std::size_t nelems)
Write a block of values to a vsl_b_ostream, as (value count) pairs.
Byte-swapping, arbitrary length integer conversion, and explicit I/O.
std::istream & is() const
A reference to the adaptor's stream.
void vsl_block_binary_rle_read(vsl_b_istream &is, T *begin, std::size_t nelems)
Read a block of values from a vsl_b_ostream, potentially very efficiently for fundamental types.
void vsl_b_read(vsl_b_istream &is, char &n)
Read char from vsl_b_istream.
An adaptor for any std::istream to make it suitable for binary input.
Set of functions, and objects to perform binary IO.