vbl_io_triple.hxx
Go to the documentation of this file.
1 // This is core/vbl/io/vbl_io_triple.hxx
2 #ifndef vbl_io_triple_hxx_
3 #define vbl_io_triple_hxx_
4 //:
5 // \file
6 // \brief binary IO functions for vbl_triple<S, T, U>
7 // \author Ian Scott
8 
9 #include "vbl_io_triple.h"
10 #include <vsl/vsl_binary_io.h>
11 
12 //====================================================================================
13 //: Write pair to binary stream
14 template <class S, class T, class U>
15 void vsl_b_write(vsl_b_ostream& s, const vbl_triple<S, T, U>& v)
16 {
17  // Do not write a version number here for space efficiency reasons.
18  // There is no reason to expect the format to change
19  vsl_b_write(s,v.first);
20  vsl_b_write(s,v.second);
21  vsl_b_write(s,v.third);
22 }
23 
24 //====================================================================================
25 //: Read pair from binary stream
26 template <class S, class T, class U>
27 void vsl_b_read(vsl_b_istream& s, vbl_triple<S, T, U>& v)
28 {
29  vsl_b_read(s,v.first);
30  vsl_b_read(s,v.second);
31  vsl_b_read(s,v.third);
32 }
33 
34 
35 //====================================================================================
36 //: Output a human readable summary to the stream
37 template <class S, class T, class U>
38 void vsl_print_summary(std::ostream& os, const vbl_triple<S, T, U> &v)
39 {
40  os << "(";
41  vsl_print_summary(os, v.first);
42  os << ", ";
44  os << ", ";
45  vsl_print_summary(os, v.third);
46  os << ")";
47 }
48 
49 
50 #undef VBL_IO_TRIPLE_INSTANTIATE
51 #define VBL_IO_TRIPLE_INSTANTIATE(S, T, U ) \
52 template void vsl_print_summary(std::ostream& s, const vbl_triple<S, T, U >& v); \
53 template void vsl_b_write(vsl_b_ostream& s, const vbl_triple<S, T, U > & v); \
54 template void vsl_b_read(vsl_b_istream& s, vbl_triple<S, T, U > & v)
55 
56 #endif // vbl_io_triple_hxx_
a templated 3-tuple.
Definition: vbl_fwd.h:22
binary IO functions for vbl_triple<S, T, U>
void vsl_b_write(vsl_b_ostream &s, const vbl_triple< S, T, U > &v)
Write pair to binary stream.
void vsl_b_read(vsl_b_istream &s, vbl_triple< S, T, U > &v)
Read pair from binary stream.
void vsl_print_summary(std::ostream &os, const vbl_triple< S, T, U > &v)
Output a human readable summary to the stream.