2 #ifndef vsl_vector_io_hxx_ 3 #define vsl_vector_io_hxx_ 15 # include <vcl_msvc_warnings.h> 25 std::size_t n = v.size();
30 assert(n == 0 || &v[n-1] + 1 == &v[0] + n);
46 template <
class T>
bool vsl_is_char(
const T&) {
return false; }
67 assert(n == 0 || &v[n-1] + 1 == &v[0] + n);
98 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, std::vector<T>&)\n" 99 <<
" Unknown version number "<< ver <<
'\n';
100 is.is().clear(std::ios::badbit);
110 os <<
vsl_indent() <<
"Vector length: " << v.size() <<
'\n';
111 for (
unsigned int i=0; i<v.size() && i<5; i++)
124 #define VSL_VECTOR_IO_INSTANTIATE(T) \ 125 template void vsl_print_summary(std::ostream& s, const std::vector<T >& v); \ 126 template void vsl_b_write(vsl_b_ostream& s, const std::vector<T >& v); \ 127 template void vsl_b_read(vsl_b_istream& s, std::vector<T >& v) 129 #endif // vsl_vector_io_hxx_ A binary output adaptor for any std::ostream.
Set of functions to do binary IO on a block of values.
void vsl_b_read(vsl_b_istream &is, std::vector< T > &v)
Read vector from binary stream.
unsigned short version_no() const
Return the version number of the IO format of the file being read.
void vsl_block_binary_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.
std::istream & is() const
A reference to the adaptor's stream.
void vsl_block_binary_read_confirm_specialisation(vsl_b_istream &is, bool specialised)
Error checking.
void vsl_indent_inc(std::ostream &os)
Increments current indent for given stream.
Backwards compatibility support only.
void vsl_b_write(vsl_b_ostream &s, const std::vector< T > &v)
Write vector to binary stream.
void vsl_b_read_block_old(vsl_b_istream &is, T *begin, std::size_t nelems)
Read a block of values from a vsl_b_istream.
bool vsl_is_char(const T &)
Put indents into output streams, to produce more legible printed output.
void vsl_indent_dec(std::ostream &os)
Decrements current indent for given stream.
void vsl_print_summary(std::ostream &os, const std::vector< T > &v)
Output a human readable summary to the stream.
An adaptor for any std::istream to make it suitable for binary input.
void vsl_block_binary_write(vsl_b_ostream &os, const T *begin, std::size_t nelems)
Write a block of values to a vsl_b_ostream, potentially very efficiently for fundamental types.
Set of functions, and objects to perform binary IO.
binary IO functions for std::vector<T>