contrib/brl/bbas/bsta/io/bsta_io_gaussian_indep.h
Go to the documentation of this file.
00001 // This is brl/bbas/bsta/io/bsta_io_gaussian_indep.h
00002 #ifndef bsta_io_gaussian_indep_h_
00003 #define bsta_io_gaussian_indep_h_
00004 //:
00005 // \file
00006 // \brief Binary I/O for independent gaussians
00007 // \author Matt Leotta (mleotta@lems.brown.edu)
00008 // \date March 28, 2006
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   <none yet>
00013 // \endverbatim
00014 
00015 #include <bsta/bsta_gaussian_indep.h>
00016 #include <vsl/vsl_binary_io.h>
00017 #include <vnl/io/vnl_io_vector_fixed.h>
00018 #include <vcl_iostream.h>
00019 
00020 //: Binary save bsta_gaussian_indep to stream.
00021 template <class T, unsigned n>
00022 void
00023 vsl_b_write(vsl_b_ostream &os, const bsta_gaussian_indep<T,n>& g)
00024 {
00025   vsl_b_write(os,g.mean());
00026   vsl_b_write(os,g.diag_covar());
00027 }
00028 
00029 //: Binary load bsta_gaussian_indep from stream.
00030 template <class T, unsigned n>
00031 void
00032 vsl_b_read(vsl_b_istream &is, bsta_gaussian_indep<T,n>& g)
00033 {
00034   vnl_vector_fixed<T,n> mean, diag_covar;
00035   vsl_b_read(is, mean);
00036   vsl_b_read(is, diag_covar);
00037   g.set_mean(mean);
00038   g.set_covar(diag_covar);
00039 }
00040 
00041 //: Print summary
00042 template <class T, unsigned n>
00043 void
00044 vsl_print_summary(vcl_ostream &os, const bsta_gaussian_indep<T,n>& g)
00045 {
00046   os << "Gaussian (indep) mean:"<<g.mean()<<" diag_covar:"<<g.diag_covar();
00047 }
00048 
00049 
00050 #endif // bsta_io_gaussian_indep_h_