/** \file default_data_set.hpp */ #ifndef SHARED_TABLE_DATA_SET #define SHARED_TABLE_DATA_SET #define OPT_HEADER #include "core/fitter.hpp" #include namespace opt_utilities { /** \brief shared_table implement of the data set \tparam Ty type of y \tparam Tx type of x */ template class shared_table_data_set :public data_set { // private: public: std::vector > data_vec; data_set* do_clone()const { return (data_set*)(this); } void do_destroy() { } const data& do_get_data(size_t i)const { return data_vec.at(i); } void do_set_data(size_t i,const data& d) { data_vec.at(i)=d; } size_t do_size()const { return data_vec.size(); } void do_add_data(const data& d) { data_vec.push_back(d); } void do_clear() { data_vec.clear(); } bool insert_data(size_t idx,const data& d) { if(idx<0||idx>data_vec.size()) { return false; } data_vec.insert(data_vec.begin()+idx,d); return true; } bool insert_data(size_t idx,size_t n,const data& d) { if(idx<0||idx>data_vec.size()) { return false; } data_vec.insert(data_vec.begin()+idx,n,d); return true; } bool erase_data(size_t idx) { if(idx>=0&&idx=0&&beg& rhs) :data_vec(rhs.data_vec) {} shared_table_data_set(const data_set& rhs) { data_vec.resize(rhs.size()); for(int i=0;i& rhs) { data_vec=rhs.data_vec; return *this; } shared_table_data_set& operator=(const data_set& rhs) { data_vec.resize(rhs.size()); for(int i=0;i