00001 #ifndef mbl_data_collector_list_h_ 00002 #define mbl_data_collector_list_h_ 00003 //: 00004 // \file 00005 // \brief Collect data and store them in a list. 00006 // \author Tim Cootes 00007 00008 #include <mbl/mbl_data_collector.h> 00009 #include <mbl/mbl_data_array_wrapper.h> 00010 #include <vsl/vsl_binary_io.h> 00011 #include <vcl_string.h> 00012 #include <vcl_iosfwd.h> 00013 00014 //: Collect data and store them in a list. 00015 template<class T> 00016 class mbl_data_collector_list : public mbl_data_collector<T> 00017 { 00018 vcl_vector<T> data_; 00019 mbl_data_array_wrapper<T> wrapper_; 00020 00021 public: 00022 //: Dflt ctor 00023 mbl_data_collector_list(); 00024 00025 //: Destructor 00026 virtual ~mbl_data_collector_list(); 00027 00028 //: Clear any stored data 00029 virtual void clear(); 00030 00031 //: Hint about how many examples to expect 00032 virtual void set_n_samples(int n); 00033 00034 //: Record given object 00035 virtual void record(const T& v); 00036 00037 //: Return object describing stored data 00038 virtual mbl_data_wrapper<T >& data_wrapper(); 00039 00040 00041 //: Version number for I/O 00042 short version_no() const; 00043 00044 //: Name of the class 00045 virtual vcl_string is_a() const; 00046 00047 //: Does the name of the class match the argument? 00048 virtual bool is_class(vcl_string const& s) const; 00049 00050 //: Create a copy on the heap and return base class pointer 00051 virtual mbl_data_collector_base* clone() const; 00052 00053 //: Print class to os 00054 virtual void print_summary(vcl_ostream& os) const; 00055 00056 //: Save class to binary file stream 00057 virtual void b_write(vsl_b_ostream& bfs) const; 00058 00059 //: Load class from binary file stream 00060 virtual void b_read(vsl_b_istream& bfs); 00061 }; 00062 00063 #endif // mbl_data_collector_list_h_
1.7.5.1