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