00001
00007 #ifndef DATASTORE_H
00008 #define DATASTORE_H
00009
00010 #include <iostream>
00011
00012 #include "util.h"
00013 #include "hash_map.h"
00014 #include "hash_classes.h"
00015
00041 class DataStore
00042 {
00043 public:
00044 DataStore(PersistantStore&);
00045 ~DataStore() {}
00046 private:
00047
00048 DataStore(const DataStore &other);
00049 const DataStore operator=(const DataStore &other);
00050
00051 public:
00052 ControlPoint add_cp( const Point2D &p );
00053 void rem_cp(ControlPoint cp);
00054
00055 DataPoint add_dp(ControlPoint cp, const LinearData &data );
00056 void rem_dp(ControlPoint cp, DataPoint dp);
00057
00058 void replace_cp(const ControlPoint& old_cp, const ControlPoint& new_cp);
00059
00060
00061 DataPoint operator[](const ControlPoint& cp) const {
00062 return get_data(cp);
00063 }
00064
00065 void replace_dp(const ControlPoint& cp, const LinearData &new_ld);
00066
00067 DataPoint get_data(const ControlPoint&) const;
00068
00069 bool has_data(const ControlPoint&) const;
00070 unsigned num_control_points() const;
00071 unsigned num_data_points() const;
00072 unsigned data_length() const;
00073
00074
00075
00076 void add_channels(unsigned num_new_channels);
00077
00078 void print() const;
00079 friend std::ostream& operator<<(std::ostream &stream, const DataStore &ds);
00080
00081
00082
00083 void write_geo_into(unsigned indexX, unsigned indexY);
00084 void read_geo_from(unsigned indexX, unsigned indexY);
00085 void swap_geo_with(unsigned indexX, unsigned indexY);
00086
00087 void copy_data(unsigned indexFrom, unsigned indexTo);
00088 void copy_data_2(unsigned indexAx, unsigned indexAy, unsigned indexBx, unsigned indexBy);
00089 void swap_data(unsigned indexFrom, unsigned indexTo);
00090 void swap_data_2(unsigned indexAx, unsigned indexAy, unsigned indexBx, unsigned indexBy);
00091
00092
00093 void write_geo_into(unsigned indexV) { write_geo_into(indexV, indexV + 1); }
00094 void read_geo_from(unsigned indexV) { read_geo_from(indexV, indexV + 1); }
00095 void swap_geo_with(unsigned indexV) { swap_geo_with(indexV, indexV + 1); }
00096 void copy_data_2(unsigned indexAv, unsigned indexBv)
00097 {
00098 copy_data_2(indexAv, indexAv + 1, indexBv, indexBv + 1);
00099 }
00100 void swap_data_2(unsigned indexAv, unsigned indexBv)
00101 {
00102 swap_data_2(indexAv, indexAv + 1, indexBv, indexBv + 1);
00103 }
00104
00105
00106 private:
00107
00108 typedef PersistantHashMap<ControlPoint,DataPoint,ControlPointHasher>
00109 Data_Hash_T;
00110
00111 Data_Hash_T data_hash;
00113 PersistantList<Point2D> control_points;
00114 PersistantList<LinearData> data_points;
00116 };
00117
00118
00119 #endif
00120