core/vsl/vsl_pair_io.txx
Go to the documentation of this file.
00001 // This is core/vsl/vsl_pair_io.txx
00002 #ifndef vsl_pair_io_txx_
00003 #define vsl_pair_io_txx_
00004 //:
00005 // \file
00006 // \brief  binary IO functions for vcl_pair<T>
00007 // \author Ian Scott
00008 //
00009 // Implementation
00010 
00011 #include "vsl_pair_io.h"
00012 #include <vsl/vsl_binary_io.h>
00013 
00014 //====================================================================================
00015 //: Write pair to binary stream
00016 template <class S, class T>
00017 void vsl_b_write(vsl_b_ostream& s, const vcl_pair<S, T>& v)
00018 {
00019   // Do not write a version number here for space efficiency reasons.
00020   // There is no reason to expect the format to change
00021   vsl_b_write(s,v.first);
00022   vsl_b_write(s,v.second);
00023 }
00024 
00025 //====================================================================================
00026 //: Read pair from binary stream
00027 template <class S, class T>
00028 void vsl_b_read(vsl_b_istream& s, vcl_pair<S, T>& v)
00029 {
00030   vsl_b_read(s,v.first);
00031   vsl_b_read(s,v.second);
00032 }
00033 
00034 
00035 //====================================================================================
00036 //: Output a human readable summary to the stream
00037 template <class S, class T>
00038 void vsl_print_summary(vcl_ostream& os, const vcl_pair<S, T> &v)
00039 {
00040   os << "(";
00041   vsl_print_summary(os, v.first);
00042   os << ", ";
00043   vsl_print_summary(os, v.second);
00044   os << ")";
00045 }
00046 
00047 
00048 #undef VSL_PAIR_IO_INSTANTIATE
00049 #define VSL_PAIR_IO_INSTANTIATE(S, T ) \
00050 template void vsl_print_summary(vcl_ostream& s, const vcl_pair<S, T >& v); \
00051 template void vsl_b_write(vsl_b_ostream& s, const vcl_pair<S, T > & v); \
00052 template void vsl_b_read(vsl_b_istream& s, vcl_pair<S, T > & v)
00053 
00054 #endif // vsl_pair_io_txx_