00001
00002 #ifndef vpdfl_builder_base_h
00003 #define vpdfl_builder_base_h
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014 #include <vcl_vector.h>
00015 #include <vcl_string.h>
00016 #include <vcl_memory.h>
00017 #include <vnl/vnl_vector.h>
00018 #include <vsl/vsl_binary_io.h>
00019 #include <mbl/mbl_data_wrapper.h>
00020
00021
00022
00023 class vpdfl_pdf_base;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class vpdfl_builder_base
00035 {
00036 public:
00037
00038 vpdfl_builder_base() {}
00039
00040
00041 virtual ~vpdfl_builder_base() {}
00042
00043
00044 virtual vpdfl_pdf_base* new_model() const = 0;
00045
00046
00047 virtual void set_min_var(double min_var) =0;
00048
00049
00050 virtual double min_var() const =0;
00051
00052
00053 virtual void build(vpdfl_pdf_base& model,
00054 const vnl_vector<double>& mean) const = 0;
00055
00056
00057 virtual void build(vpdfl_pdf_base& model,
00058 mbl_data_wrapper<vnl_vector<double> >& data) const = 0;
00059
00060
00061 virtual void weighted_build(vpdfl_pdf_base& model,
00062 mbl_data_wrapper<vnl_vector<double> >& data,
00063 const vcl_vector<double>& wts) const = 0;
00064
00065
00066 short version_no() const;
00067
00068
00069 virtual vcl_string is_a() const;
00070
00071
00072 virtual bool is_class(vcl_string const& s) const;
00073
00074
00075 virtual vpdfl_builder_base* clone() const = 0;
00076
00077
00078 virtual void print_summary(vcl_ostream& os) const = 0;
00079
00080
00081 virtual void b_write(vsl_b_ostream& bfs) const = 0;
00082
00083
00084 virtual void b_read(vsl_b_istream& bfs) = 0;
00085
00086
00087
00088 static vcl_auto_ptr<vpdfl_builder_base> new_builder_from_stream(vcl_istream &is);
00089
00090
00091
00092 virtual void config_from_stream(vcl_istream & is);
00093
00094
00095
00096
00097 static vcl_auto_ptr<vpdfl_builder_base> new_pdf_builder_from_stream(vcl_istream &);
00098
00099 };
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 void vsl_add_to_binary_loader(const vpdfl_builder_base& b);
00111
00112
00113 void vsl_b_write(vsl_b_ostream& bfs, const vpdfl_builder_base& b);
00114
00115
00116 void vsl_b_read(vsl_b_istream& bfs, vpdfl_builder_base& b);
00117
00118
00119 void vsl_print_summary(vcl_ostream& os,const vpdfl_builder_base& b);
00120
00121
00122 void vsl_print_summary(vcl_ostream& os,const vpdfl_builder_base* b);
00123
00124
00125 vcl_ostream& operator<<(vcl_ostream& os,const vpdfl_builder_base& b);
00126
00127
00128 vcl_ostream& operator<<(vcl_ostream& os,const vpdfl_builder_base* b);
00129
00130 #endif // vpdfl_builder_base_h