00001 // Copyright 2007, Massachusetts Institute of Technology. 00002 // The use of this code is permitted for research only. There is 00003 // absolutely no warranty for this software. 00004 // 00005 // Author: John Lee (jjl@mit.edu) 00006 // 00007 #ifndef POINT_SET_POINT_SET_H 00008 #define POINT_SET_POINT_SET_H 00009 00010 #include <vector> 00011 #include "point_set/point.h" 00012 00013 using namespace std; 00014 00015 namespace libpmk { 00017 00027 class PointSet { 00028 public: 00030 PointSet(int point_dim); 00031 ~PointSet(); 00032 00033 PointSet(const PointSet& other); 00034 void CopyFrom(const PointSet& other); 00035 00036 int size() const { return points_.size(); } 00037 int point_dim() const { return point_dim_; } 00038 00040 void set_point_dim(int new_dim); 00041 00043 const Point& point(int index) const; 00044 Point* mutable_point(int index) const; 00045 const Point& operator[](int index) const { return point(index); } 00046 00048 00051 Point* add_point(const Point& point); 00052 00054 Point* add_point(); 00055 00057 void remove_point(int index); 00058 00060 void clear(); 00061 00062 00064 00075 void WriteToStream(ostream& output_stream) const; 00076 00078 00084 void ReadFromStream(istream& input_stream); 00085 00086 private: 00087 int point_dim_; 00088 vector<Point*> points_; 00089 }; 00090 } // namespace libpmk 00091 #endif // POINT_SET_POINT_SET_H