00001
00002
00003 #ifndef DataAnyDim_h
00004 #define DataAnyDim_h
00005
00006 #include <vector>
00007
00008 namespace BIE {
00009
00013
00014 class Data {
00015
00016 private:
00017 double X, Y, wght;
00018 int len;
00019 vector<double> attrib;
00020
00021 public:
00022
00024 Data(int length) {
00025 len = length;
00026 wght = 1.0;
00027 attrib.resize(len);
00028 for (int i=0; i<len; i++)
00029 attrib[i] = 0.0;
00030 }
00031
00033
00034
00035 double &operator[] (int i) { return attrib[i]; }
00037 double operator[] (int i) const { return attrib[i]; }
00039
00040
00042
00043
00044 double &x() { return X; }
00046 double x() const { return X; }
00048
00050
00051
00052 double &y() { return Y; }
00054 double y() const { return Y; }
00056
00058 double &weight() { return wght; }
00059
00061 void resize(int size) { attrib.resize(size); }
00062
00064 vector<double> &attribute() { return attrib;}
00065
00067 void set_x(double x_in) {X = x_in;}
00069 void set_y(double y_in) {Y = y_in;}
00071 void set_w(double w_in) {wght = w_in;}
00072
00074 void set_attrib(int position, double value) { attrib[position] = value; }
00075
00076 };
00077 }
00078
00079 #endif
00080
00081