CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
transport_SequenceIdController.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/transport/transport_Definitions.h>
17 
18 
19 namespace nn
20 {
21 namespace pia
22 {
23 namespace transport
24 {
25 
26 
27 /*!
28  @brief パケットのシーケンス ID を管理します。
29  それに伴い、パケットロスをプロファイリングする機能も持ちます。
30 
31  */
33 {
34 public:
35  /*!
36  @cond PRIVATE
37  @brief デフォルトコンストラクタです。
38  */
40  //! @endcond
41 
42 
43  /*!
44  @cond PRIVATE
45  @brief デストラクタです。
46  */
47  virtual ~SequenceIdController(void);
48  //! @endcond
49 
50 
51  /*!
52  @cond PRIVATE
53  @brief 通信開始
54  @return ResultSuccess を返します。
55  */
56  Result Startup();
57  //! @endcond
58 
59 
60  /*!
61  @cond PRIVATE
62  @brief 通信終了
63  */
64  void Cleanup();
65  //! @endcond
66 
67 
68  /*!
69  @cond PRIVATE
70  @brief 次の送信シーケンス ID を取得
71  @return 次の送信シーケンス ID です。
72  */
73  uint16_t GetNextSendSequenceId();
74  //! @endcond
75 
76 
77  /*!
78  @cond PRIVATE
79  @brief 受信シーケンス ID をチェック
80  @return 有効なシーケンス ID なら true 、無効なシーケンス ID なら false を返します。
81  */
82  bool CheckReceivedSequenceId(uint16_t sequenceId);
83  //! @endcond
84 
85 
86  /*!
87  @cond PRIVATE
88  @brief StationIndex_All 宛パケットを計測
89  */
90  void CountReceivedToAllPacket();
91  //! @endcond
92 
93 
94  /*!
95  @brief プロファイリングを開始します。
96  */
97  void StartProfile();
98 
99 
100  /*!
101  @brief プロファイリングを終了します。
102  */
103  void StopProfile();
104 
105 
106  /*!
107  @brief プロファイルした総パケット数を取得します。
108  この関数はスレッドセーフです。
109  @return プロファイルした総パケット数です。
110  */
111  uint16_t GetProfiledTotalPacketNum() const
112  {
113  return m_ProfileTotalPacketCount;
114  }
115 
116 
117  /*!
118  @brief プロファイルしたパケットロス数を取得します。
119  この関数はスレッドセーフです。
120  @return プロファイルしたパケットロス数です。
121  */
122  uint16_t GetProfiledPacketLossNum() const
123  {
124  return m_ProfilePacketLossCount;
125  }
126 
127 
128  /*!
129  @brief プロファイルしたマルチキャストのパケット数を取得します。
130  この関数はスレッドセーフです。
131  @return プロファイルしたマルチキャストのパケット数です。
132  */
134  {
135  return m_ProfileMulticastPacketCount;
136  }
137 
138 
139  /*!
140  @brief デバッグに有用な情報をプリントします。
141 
142  @param[in] flag トレースフラグの論理和。詳細は@ref TraceFlag 型を参照してください。
143  */
144  virtual void Trace(uint64_t flag) const;
145 
146 
147  /*!
148  @cond PRIVATE
149  @brief シーケンスIDの無効値
150  @return シーケンスIDの無効値
151  */
152  static uint16_t GetInvalidSequenceId()
153  {
154  return InvalidSequenceId;
155  }
156  //! @endcond
157 
158 
159  /*!
160  @cond PRIVATE
161  @brief プロファイルした総パケット数を取得します。(TransportAnalyzer用)
162  @return プロファイルした総パケット数です。
163  */
164  uint32_t GetProfiledTotalPacketNumForTransportAnalyzer() const
165  {
166  return m_ProfileTotalPacketCountForTransportAnalyzer;
167  }
168  //! @endcond
169 
170 
171  /*!
172  @cond PRIVATE
173  @brief プロファイルしたパケットロス数を取得します。(TransportAnalyzer用)
174  @return プロファイルしたパケットロス数です。
175  */
176  uint32_t GetProfiledPacketLossNumForTransportAnalyzer() const
177  {
178  return m_ProfilePacketLossCountForTransportAnalyzer;
179  }
180  //! @endcond
181 
182 private:
183  // 実装しない
184  SequenceIdController(const SequenceIdController& rhs);
185  bool operator==(const SequenceIdController& rhs) const;
186  bool operator!=(const SequenceIdController& rhs) const;
187  SequenceIdController& operator=(const SequenceIdController& rhs);
188 
189 
190  uint16_t m_SendSequenceId;
191  uint16_t m_LastReceiveSequenceId;
192 
193  uint16_t m_ProfileTotalPacketCount;
194  uint16_t m_ProfilePacketLossCount;
195  uint16_t m_ProfileMulticastPacketCount;
196  bool m_IsProfiling;
197 
198  uint32_t m_ProfileTotalPacketCountForTransportAnalyzer;
199  uint32_t m_ProfilePacketLossCountForTransportAnalyzer;
200 
201  static const uint16_t InvalidSequenceId = 0;
202 };
203 }
204 }
205 } // end of namespace nn::pia::transport