BaseTree.hpp
Go to the documentation of this file.
1
2namespace GfxTL
3{
4 template <class Cell>
5 BaseTree<Cell>::BaseTree() : _root(NULL)
6 {
7 }
8
9 template <class Cell>
10 BaseTree<Cell>::BaseTree(const BaseTree<Cell>& bt) : _root(NULL)
11 {
12 if (bt._root)
13 {
14 _root = new Cell(*bt._root);
15 }
16 }
17
18 template <class Cell>
19 BaseTree<Cell>::~BaseTree()
20 {
21 Clear();
22 }
23
24 template <class Cell>
25 void
26 BaseTree<Cell>::Clear()
27 {
28 if (_root)
29 {
30 delete _root;
31 _root = NULL;
32 }
33 }
34
35 template <class Cell>
36 void
37 BaseTree<Cell>::Init()
38 {
39 }
40
41 template <class Cell>
42 typename BaseTree<Cell>::CellType*
43 BaseTree<Cell>::Root()
44 {
45 return _root;
46 }
47
48 template <class Cell>
49 const typename BaseTree<Cell>::CellType*
50 BaseTree<Cell>::Root() const
51 {
52 return _root;
53 }
54
55 template <class Cell>
56 void
57 BaseTree<Cell>::Root(Cell* root)
58 {
59 _root = root;
60 }
61
62 template <class Cell>
63 bool
64 BaseTree<Cell>::IsLeaf(const CellType* cell) const
65 {
66 return (*cell)[0] == NULL;
67 }
68
69 template <class Cell>
70 BaseTree<Cell>&
71 BaseTree<Cell>::operator=(const BaseTree<Cell>& bt)
72 {
73 Clear();
74 if (bt._root)
75 {
76 _root = new Cell(*bt._root);
77 }
78 return *this;
79 }
80}; // namespace GfxTL
Definition AABox.h:10