Go to the documentation of this file.00001
00002
00003
00004 #ifndef clusterTree01_hh
00005 #define clusterTree01_hh
00006
00007 #include "cluster/tree.hh"
00008
00009 namespace cluster {
00010
00011
00012
00017 template<class Node>
00018 class TreeTraits01 : public TreeTraits<Node> {
00019 public:
00020 typedef typename TreeTraits<Node>::F F;
00021
00022 static Node* newNode(const concepts::Element<F>& elm, const BBall<F>& ball,
00023 Node* lnk) {return new Node(elm, ball, lnk);}
00024 static Node* newNode(uint idx, Node& chld, const concepts::Real3d& c,
00025 concepts::Real r, uint nlf = 0) {
00026 return new Node(idx, chld, c, r, nlf);
00027 }
00028
00029 static Node* child(const Node* nd) {return nd->child();}
00030 static Node* link(const Node* nd) {return nd->link();}
00031 static Node*& link(Node* nd) {return nd->link();}
00032 };
00033
00034
00035
00041 template<class CNode>
00042 class Tree01 : public Tree<CNode> {
00043 public:
00045 typedef TreeTraits01<CNode> Traits;
00046 typedef typename Traits::F F;
00047
00053 Tree01(const concepts::Space<F>& spc, const BBall<F>& ball,
00054 uint nlfmin = 1);
00055 inline ~Tree01() {destructor_(root_); delete root_;}
00056
00058 inline uint nclst() const {return nclst_;}
00060 inline uint nleaf() const {return nlf_;}
00062 inline const CNode* root() const {return root_;}
00063
00069 void sketch(std::ostream& os, const CNode* lnk = 0, uint l = 0);
00070
00071 private:
00073 uint nlfmin_;
00075 uint nlf_;
00077 uint nclst_;
00079 CNode* root_;
00080
00082 CNode* constructor_(CNode* lfset);
00084 void destructor_(CNode* clst);
00086 CNode* concat_(CNode* a, CNode* b);
00087 };
00088
00089 }
00090
00091 #endif // clusterTree01_hh