Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008 #include "vnl_io_real_npolynomial.h"
00009 #include <vsl/vsl_binary_io.h>
00010 #include <vnl/vnl_real_npolynomial.h>
00011 #include <vnl/io/vnl_io_vector.h>
00012 #include <vnl/io/vnl_io_matrix.h>
00013
00014
00015
00016
00017 void vsl_b_write(vsl_b_ostream & os, const vnl_real_npolynomial & p)
00018 {
00019 const short io_version_no = 1;
00020 vsl_b_write(os, io_version_no);
00021
00022 vsl_b_write(os, p.coefficients());
00023 vsl_b_write(os, p.polyn());
00024 }
00025
00026
00027
00028 void vsl_b_read(vsl_b_istream &is, vnl_real_npolynomial & p)
00029 {
00030 if (!is) return;
00031
00032 short ver;
00033 vnl_vector<double> coeffs;
00034 vnl_matrix<unsigned int> polyn;
00035 vsl_b_read(is, ver);
00036 switch (ver)
00037 {
00038 case 1:
00039 vsl_b_read(is, coeffs);
00040 vsl_b_read(is, polyn);
00041 p.set(coeffs, polyn);
00042 break;
00043
00044 default:
00045 vcl_cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, vnl_real_npolynomial&)\n"
00046 << " Unknown version number "<< ver << '\n';
00047 is.is().clear(vcl_ios::badbit);
00048 return;
00049 }
00050 }
00051
00052
00053
00054 void vsl_print_summary(vcl_ostream & os,const vnl_real_npolynomial & p)
00055 {
00056 os<<"Coefficients: ";
00057 vsl_print_summary(os, p.coefficients());
00058 os<<"Polynomial: ";
00059 vsl_print_summary(os, p.polyn());
00060 }