00001 // This is mul/pdf1d/pdf1d_exponential_builder.h 00002 #ifndef pdf1d_exponential_builder_h 00003 #define pdf1d_exponential_builder_h 00004 00005 //: 00006 // \file 00007 // \author Tim Cootes 00008 // \brief Class to build pdf1d_exponential objects 00009 00010 #include <pdf1d/pdf1d_builder.h> 00011 #include <vcl_iosfwd.h> 00012 00013 //======================================================================= 00014 00015 class pdf1d_exponential; 00016 00017 //: Class to build pdf1d_exponential objects 00018 class pdf1d_exponential_builder : public pdf1d_builder 00019 { 00020 double min_var_; 00021 00022 pdf1d_exponential& exponential(pdf1d_pdf& model) const; 00023 public: 00024 00025 //: Dflt ctor 00026 pdf1d_exponential_builder(); 00027 00028 //: Destructor 00029 virtual ~pdf1d_exponential_builder(); 00030 00031 //: Create empty model 00032 virtual pdf1d_pdf* new_model() const; 00033 00034 //: Name of the model class returned by new_model() 00035 virtual vcl_string new_model_type() const; 00036 00037 //: Define lower threshold on variance for built models 00038 virtual void set_min_var(double min_var); 00039 00040 //: Get lower threshold on variance for built models 00041 virtual double min_var() const; 00042 00043 //: Build exponential from n elements in data[i] 00044 virtual void build_from_array(pdf1d_pdf& model, const double* data, int n) const; 00045 00046 //: Build default model with given mean 00047 virtual void build(pdf1d_pdf& model, double mean) const; 00048 00049 //: Build model from data 00050 virtual void build(pdf1d_pdf& model, 00051 mbl_data_wrapper<double>& data) const; 00052 00053 //: Build model from weighted data 00054 virtual void weighted_build(pdf1d_pdf& model, 00055 mbl_data_wrapper<double>& data, 00056 const vcl_vector<double>& wts) const; 00057 00058 //: Version number for I/O 00059 short version_no() const; 00060 00061 //: Name of the class 00062 virtual vcl_string is_a() const; 00063 00064 //: Does the name of the class match the argument? 00065 virtual bool is_class(vcl_string const& s) const; 00066 00067 //: Create a copy on the heap and return base class pointer 00068 virtual pdf1d_builder* clone() const; 00069 00070 //: Print class to os 00071 virtual void print_summary(vcl_ostream& os) const; 00072 00073 //: Save class to binary file stream 00074 virtual void b_write(vsl_b_ostream& bfs) const; 00075 00076 //: Load class from binary file stream 00077 virtual void b_read(vsl_b_istream& bfs); 00078 }; 00079 00080 #endif // pdf1d_exponential_builder_h