CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
common_TreeMapBase.h
1 /*--------------------------------------------------------------------------------*
2  Copyright (C)Nintendo All rights reserved.
3 
4  These coded instructions, statements, and computer programs contain proprietary
5  information of Nintendo and/or its licensed developers and are protected by
6  national and international copyright laws. They may not be disclosed to third
7  parties or copied or duplicated in any form, in whole or in part, without the
8  prior written consent of Nintendo.
9 
10  The content herein is highly confidential and should be handled accordingly.
11  *--------------------------------------------------------------------------------*/
12 
13 
14 #pragma once
15 
16 #include <nn/pia/common/common_Definitions.h>
17 #include <nn/pia/common/common_TreeMapNodeBase.h>
18 
19 namespace nn
20 {
21 namespace pia
22 {
23 namespace common
24 {
25 
26 /*!
27  @cond PRIVATE
28  @brief ツリーマップの既定クラスです。
29  */
30 class TreeMapBase : public common::RootObject
31 {
32  typedef TreeMapNodeBase Node;
33 
34 protected:
35  TreeMapBase()
36  : m_pRoot(NULL)
37  {
38  }
39 
40 
41 public:
42  /*!
43  @brief 空かどうかを判定します。
44  @return 空ならtrueを返します。
45  */
46  bool IsEmpty() const
47  {
48  return m_pRoot == NULL;
49  }
50 
51 
52  /*!
53  @brief 要素数を数えます。
54  @return 要素数です。
55  */
56  uint32_t Count() const;
57 
58 
59 protected:
60  bool IsIncludeNodeBase(const Node* cpNode) const;
61 
62  void ClearNodeBase();
63 
64  Node* FrontNodeBase() const;
65  Node* BackNodeBase() const;
66 
67  void InsertNodeRoot(Node* pNode);
68  void InsertNodeLeft(Node* pNode, Node* pUp);
69  void InsertNodeRight(Node* pNode, Node* pUp);
70  void ReplaceNode(Node* pNode, Node* pOld);
71 
72  void EraseNodeBase(Node* pNode);
73 
74  Node* RotateRight(Node* pNode);
75  Node* RotateLeft(Node* pNode);
76 
77 protected:
78  Node* GetRootBase() const
79  {
80  return m_pRoot;
81  }
82 
83 private:
84  // コピー禁止
85  TreeMapBase(const TreeMapBase& rhs);
86  TreeMapBase& operator=(const TreeMapBase& rhs);
87 
88  uint32_t CountImpl(const Node* cpNode) const;
89 
90  void ClearNodeBaseImpl(Node* pNode);
91 
92  void UpdateBalanceInsert(Node* pNode);
93 
94 private:
95  Node* m_pRoot;
96 };
97 //! @endcond
98 }
99 }
100 } // end of namespace nn::pia::common