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 00008 #ifndef TREE_POINT_TREE_NODE_H 00009 #define TREE_POINT_TREE_NODE_H 00010 00011 #include <iostream> 00012 #include "tree/tree-node.h" 00013 #include "point_set/point.h" 00014 00015 using namespace std; 00016 00017 namespace libpmk { 00018 00020 00043 class PointTreeNode : public TreeNode { 00044 public: 00045 PointTreeNode(); 00046 PointTreeNode(int node_id); 00047 00049 PointTreeNode(const PointTreeNode& other); 00050 00051 const Point& point() const { return *(point_.get()); } 00052 Point* mutable_point() { return point_.get(); } 00053 void set_point(const Point& point) { point_.reset(new Point(point)); } 00054 bool has_point() const { return point_.get() != NULL; } 00055 00056 virtual ~PointTreeNode() { } 00057 00060 virtual void Combine(const TreeNode& other); 00061 00062 protected: 00064 virtual void ReadData(istream& input_stream); 00065 00067 virtual void WriteData(ostream& output_stream) const; 00068 00069 private: 00070 auto_ptr<Point> point_; 00071 }; 00072 } // namespace libpmk 00073 00074 #endif // TREE_TREE_NODE_H