CTR Pia  4.11.3
Game Communication Engine
common_TreeMapNode.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: common_TreeMapNode.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/common/common_definitions.h>
18 #include <pia/common/common_TreeMapNodeBase.h>
19 
20 
21 namespace nn
22 {
23 namespace pia
24 {
25 namespace common
26 {
27 
28 //! @cond PRIVATE
29 template <typename Key>
30 class TreeMap;
31 //! @endcond
32 
33 /*!
34 @cond PRIVATE
35 @brief Represents the class for treemap nodes.
36 */
37 template <typename Key_>
38 class TreeMapNode : public common::TreeMapNodeBase
39 {
40  friend class TreeMap<Key_>;
41 
42 public:
43  typedef Key_ Key;
44 
45 
46 /*!
47 @brief Instantiates the object with default parameters (default constructor).
48 */
49  TreeMapNode()
50  : TreeMapNodeBase(), m_Key()
51  {
52  }
53 
54 
55 /*!
56 @brief Gets the key value.
57 @return Returns the key value.
58 */
59  const Key& GetKey() const
60  {
61  return m_Key;
62  }
63 
64 
65 private:
66  void InitNode()
67  {
68  TreeMapNodeBase::InitNodeBase();
69  m_Key = Key();
70  }
71 
72 public:
73  TreeMapNode* Prev() const
74  {
75  return static_cast<TreeMapNode*>(PrevBase());
76  }
77  TreeMapNode* Next() const
78  {
79  return static_cast<TreeMapNode*>(NextBase());
80  }
81 
82 private:
83  TreeMapNode* GetLeft() const
84  {
85  return static_cast<TreeMapNode*>(GetLeftBase());
86  }
87  TreeMapNode* GetRight() const
88  {
89  return static_cast<TreeMapNode*>(GetRightBase());
90  }
91 
92 private:
93  Key m_Key;
94 };
95 //! @endcond
96 }
97 }
98 } // end of namespace nn::pia::common
Definition: assert.h:115