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