2 #ifndef vsl_stack_io_hxx_ 3 #define vsl_stack_io_hxx_ 23 std::stack<T> tmp_stack = v;
25 unsigned int stack_size = (
unsigned int)(v.size());
27 for (
unsigned int i=0; i<stack_size; i++)
41 while (!v.empty()) v.pop();
43 unsigned int stack_size;
44 std::stack<T> tmp_stack;
54 for (
unsigned int i=0; i<stack_size; i++)
60 for (
unsigned int i=0; i<stack_size; i++)
62 v.push(tmp_stack.top());
67 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, std::stack<T>&)\n" 68 <<
" Unknown version number "<< ver <<
'\n';
69 is.is().clear(std::ios::badbit);
79 std::stack<T> tmp_stack = v;
80 os <<
"Stack length: " << v.size() <<
'\n';
82 unsigned int stack_size = (
unsigned int)(v.size());
83 for (
unsigned int i=0; i<stack_size && i<5; i++)
97 #define VSL_STACK_IO_INSTANTIATE(T) \ 98 template void vsl_print_summary(std::ostream& s, const std::stack<T >& v); \ 99 template void vsl_b_write(vsl_b_ostream& s, const std::stack<T >& v); \ 100 template void vsl_b_read(vsl_b_istream& s, std::stack<T >& v) 102 #endif // vsl_stack_io_hxx_ A binary output adaptor for any std::ostream.
void vsl_print_summary(std::ostream &os, const std::stack< T > &v)
Output a human readable summary to the stream.
void vsl_b_write(vsl_b_ostream &s, const std::stack< T > &v)
Write stack to binary stream.
unsigned short version_no() const
Return the version number of the IO format of the file being read.
std::istream & is() const
A reference to the adaptor's stream.
void vsl_indent_inc(std::ostream &os)
Increments current indent for given stream.
Put indents into output streams, to produce more legible printed output.
void vsl_indent_dec(std::ostream &os)
Decrements current indent for given stream.
An adaptor for any std::istream to make it suitable for binary input.
void vsl_b_read(vsl_b_istream &is, std::stack< T > &v)
Read stack from binary stream.
binary IO functions for std::stack<T>
Set of functions, and objects to perform binary IO.