CellParentTreeStrategy.h
Go to the documentation of this file.
1 #ifndef GfxTL__CELLPARENTTREESTRATEGY_HEADER__
2 #define GfxTL__CELLPARENTTREESTRATEGY_HEADER__
3 
4 namespace GfxTL
5 {
6 
7  template< class InheritedStrategyT >
9  {
10  typedef typename InheritedStrategyT::value_type value_type;
11 
12  template< class BaseT >
13  class StrategyBase;
14 
15  class CellData
16  : public InheritedStrategyT::CellData
17  {
18  public:
19  template< class BaseT >
20  friend class StrategyBase;
21  typedef typename InheritedStrategyT::CellData BaseType;
22 
23  private:
24  CellData* m_parent;
25  };
26 
27  template< class BaseT >
28  class StrategyBase
29  : public InheritedStrategyT::template StrategyBase< BaseT >
30  {
31 public:
32  typedef typename InheritedStrategyT::template StrategyBase< BaseT > BaseType;
33  typedef typename BaseType::CellType CellType;
34 
35  const CellType* const CellParent(const CellType& c) const
36  {
37  return (const CellType * const)c.m_parent;
38  }
39 
41  {
42  return (CellType*)c.m_parent;
43  }
44 
45 protected:
47  : public BaseType::BuildInformation
48  {
49  public:
50  CellType* Parent() const
51  {
52  return m_parent;
53  }
54  void Parent(CellType* p)
55  {
56  m_parent = p;
57  }
58  private:
59  CellType* m_parent;
60  };
61 
62  template< class BuildInformationT >
63  void InitRootBuildInformation(BuildInformationT* bi)
64  {
65  BaseType::InitRootBuildInformation(bi);
66  bi->Parent(NULL);
67  }
68 
69  template< class BuildInformationT >
70  void InitBuildInformation(const CellType& parent,
71  const BuildInformationT& parentInfo, unsigned int childIdx,
72  BuildInformationT* bi)
73  {
74  BaseType::InitBuildInformation(parent, parentInfo, childIdx, bi);
75  bi->Parent(const_cast< CellType* >(&parent));
76  }
77 
78  template< class BuildInformationT >
79  void InitCell(const CellType& parent,
80  const BuildInformationT& parentInfo, unsigned int childIdx,
81  const BuildInformationT& bi, CellType* cell)
82  {
83  BaseType::InitCell(parent, parentInfo, childIdx, bi, cell);
84  cell->m_parent = bi.Parent();
85  }
86  };
87  };
88 
89 };
90 
91 #endif
GfxTL::CellParentTreeStrategy::StrategyBase::BuildInformation
Definition: CellParentTreeStrategy.h:46
GfxTL::CellParentTreeStrategy::StrategyBase::BuildInformation::Parent
void Parent(CellType *p)
Definition: CellParentTreeStrategy.h:54
GfxTL::CellParentTreeStrategy::StrategyBase::CellParent
CellType *const CellParent(CellType &c)
Definition: CellParentTreeStrategy.h:40
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
GfxTL::CellParentTreeStrategy::StrategyBase::InitRootBuildInformation
void InitRootBuildInformation(BuildInformationT *bi)
Definition: CellParentTreeStrategy.h:63
GfxTL::CellParentTreeStrategy::CellData
Definition: CellParentTreeStrategy.h:15
GfxTL::CellParentTreeStrategy::StrategyBase::InitBuildInformation
void InitBuildInformation(const CellType &parent, const BuildInformationT &parentInfo, unsigned int childIdx, BuildInformationT *bi)
Definition: CellParentTreeStrategy.h:70
GfxTL::CellParentTreeStrategy::StrategyBase::InitCell
void InitCell(const CellType &parent, const BuildInformationT &parentInfo, unsigned int childIdx, const BuildInformationT &bi, CellType *cell)
Definition: CellParentTreeStrategy.h:79
GfxTL::CellParentTreeStrategy::StrategyBase::BuildInformation::Parent
CellType * Parent() const
Definition: CellParentTreeStrategy.h:50
GfxTL::CellParentTreeStrategy::StrategyBase::CellParent
const CellType *const CellParent(const CellType &c) const
Definition: CellParentTreeStrategy.h:35
GfxTL::CellParentTreeStrategy
Definition: CellParentTreeStrategy.h:8
GfxTL
Definition: AABox.h:8
GfxTL::CellParentTreeStrategy::StrategyBase::BaseType
InheritedStrategyT::template StrategyBase< BaseT > BaseType
Definition: CellParentTreeStrategy.h:32
GfxTL::CellParentTreeStrategy::value_type
InheritedStrategyT::value_type value_type
Definition: CellParentTreeStrategy.h:10
GfxTL::CellParentTreeStrategy::StrategyBase::CellType
BaseType::CellType CellType
Definition: CellParentTreeStrategy.h:33
GfxTL::CellParentTreeStrategy::StrategyBase
Definition: CellParentTreeStrategy.h:13
GfxTL::CellParentTreeStrategy::CellData::BaseType
InheritedStrategyT::CellData BaseType
Definition: CellParentTreeStrategy.h:21