CellLevelTreeStrategy.h
Go to the documentation of this file.
1 #ifndef GfxTL__CELLLEVELTREESTRATEGY_HEADER__
2 #define GfxTL__CELLLEVELTREESTRATEGY_HEADER__
3 
4 namespace GfxTL
5 {
6  template< class InheritedStrategyT >
8  {
9  typedef typename InheritedStrategyT::value_type value_type;
10  class CellData
11  : public InheritedStrategyT::CellData
12  {
13  public:
14  const size_t Level() const
15  {
16  return m_level;
17  }
18  void Level(size_t l)
19  {
20  m_level = l;
21  }
22 
23  private:
24  size_t m_level;
25  };
26 
27  template< class BaseT >
29  : public InheritedStrategyT::template StrategyBase< BaseT >
30  {
31 public:
32  typedef typename InheritedStrategyT::template StrategyBase< BaseT >
34  typedef typename BaseType::CellType CellType;
35 
36 protected:
38  : public BaseType::BuildInformation
39  {
40  public:
41  size_t Level() const
42  {
43  return m_level;
44  }
45  void Level(size_t l)
46  {
47  m_level = l;
48  }
49  private:
50  size_t m_level;
51  };
52 
53  template< class BaseTraversalT >
55  : public BaseTraversalT
56  {};
57 
58  template< class BuildInformationT >
59  void InitRootBuildInformation(BuildInformationT* bi)
60  {
61  BaseType::InitRootBuildInformation(bi);
62  bi->Level(0);
63  }
64 
65  template< class BuildInformationT >
66  void InitBuildInformation(const CellType& parent,
67  const BuildInformationT& parentInfo, unsigned int childIdx,
68  BuildInformationT* bi) const
69  {
70  BaseType::InitBuildInformation(parent, parentInfo, childIdx,
71  bi);
72  bi->Level(parentInfo.Level() + 1);
73  }
74 
75  template< class BuildInformationT >
76  void InitRoot(const BuildInformationT& bi, CellType* root)
77  {
78  BaseType::InitRoot(bi, root);
79  root->Level(bi.Level());
80  }
81 
82  template< class BuildInformationT >
83  void InitCell(const CellType& parent, const BuildInformationT& pbi,
84  unsigned int child, const BuildInformationT& bi,
85  CellType* cell)
86  {
87  BaseType::InitCell(parent, pbi, child, bi, cell);
88  cell->Level(bi.Level());
89  }
90 
91  template< class TraversalInformationT >
92  const size_t CellLevel(const CellType& cell,
93  const TraversalInformationT&) const
94  {
95  return cell.Level();
96  }
97  };
98  };
99 };
100 
101 #endif
GfxTL::CellLevelTreeStrategy::StrategyBase
Definition: CellLevelTreeStrategy.h:28
GfxTL::CellLevelTreeStrategy::StrategyBase::BuildInformation::Level
size_t Level() const
Definition: CellLevelTreeStrategy.h:41
GfxTL::CellLevelTreeStrategy::CellData::Level
void Level(size_t l)
Definition: CellLevelTreeStrategy.h:18
GfxTL::CellLevelTreeStrategy::StrategyBase::CellType
BaseType::CellType CellType
Definition: CellLevelTreeStrategy.h:34
GfxTL::CellLevelTreeStrategy::StrategyBase::BaseType
InheritedStrategyT::template StrategyBase< BaseT > BaseType
Definition: CellLevelTreeStrategy.h:33
GfxTL::CellLevelTreeStrategy::StrategyBase::CellLevelTraversalInformation
Definition: CellLevelTreeStrategy.h:54
GfxTL::CellLevelTreeStrategy::StrategyBase::InitBuildInformation
void InitBuildInformation(const CellType &parent, const BuildInformationT &parentInfo, unsigned int childIdx, BuildInformationT *bi) const
Definition: CellLevelTreeStrategy.h:66
GfxTL::CellLevelTreeStrategy::value_type
InheritedStrategyT::value_type value_type
Definition: CellLevelTreeStrategy.h:9
GfxTL::CellLevelTreeStrategy::CellData
Definition: CellLevelTreeStrategy.h:10
GfxTL
Definition: AABox.h:8
GfxTL::CellLevelTreeStrategy::StrategyBase::InitCell
void InitCell(const CellType &parent, const BuildInformationT &pbi, unsigned int child, const BuildInformationT &bi, CellType *cell)
Definition: CellLevelTreeStrategy.h:83
GfxTL::CellLevelTreeStrategy::StrategyBase::InitRoot
void InitRoot(const BuildInformationT &bi, CellType *root)
Definition: CellLevelTreeStrategy.h:76
GfxTL::CellLevelTreeStrategy
Definition: CellLevelTreeStrategy.h:7
GfxTL::CellLevelTreeStrategy::StrategyBase::CellLevel
const size_t CellLevel(const CellType &cell, const TraversalInformationT &) const
Definition: CellLevelTreeStrategy.h:92
GfxTL::CellLevelTreeStrategy::CellData::Level
const size_t Level() const
Definition: CellLevelTreeStrategy.h:14
GfxTL::CellLevelTreeStrategy::StrategyBase::InitRootBuildInformation
void InitRootBuildInformation(BuildInformationT *bi)
Definition: CellLevelTreeStrategy.h:59
GfxTL::CellLevelTreeStrategy::StrategyBase::BuildInformation::Level
void Level(size_t l)
Definition: CellLevelTreeStrategy.h:45
GfxTL::CellLevelTreeStrategy::StrategyBase::BuildInformation
Definition: CellLevelTreeStrategy.h:37