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