CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
common_StatisticValue.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 
18 namespace nn
19 {
20 namespace pia
21 {
22 namespace common
23 {
24 
25 
26 /*!
27 @cond PRIVATE
28  @brief 統計量のクラスです。
29  */
30 class StatisticValue : public nn::pia::common::RootObject
31 {
32 public:
33  uint32_t m_Value;
34  uint32_t m_ValueMax;
35  uint32_t m_ValueMaxResult;
36  uint32_t m_ValueMin;
37  uint32_t m_ValueMinResult;
38  uint32_t m_ValueSum;
39  uint32_t m_Count;
40  uint32_t m_Average;
41 
42  /*!
43  @brief コンストラクタです。
44  */
45  StatisticValue(void)
46  {
47  ResetValue();
48  }
49 
50  void ResetValue()
51  {
52  m_Value = 0;
53  m_ValueMax = 0;
54  m_ValueMaxResult = 0;
55  m_ValueMin = 0xFFFFFFFF;
56  m_ValueMinResult = 0;
57  m_ValueSum = 0;
58  m_Count = 0;
59  m_Average = 0;
60  }
61 
62  void AddValue(uint32_t value)
63  {
64  m_Value = value;
65  m_ValueSum += m_Value;
66  m_Count++;
67  if (m_Value > m_ValueMax)
68  {
69  m_ValueMax = m_Value;
70  }
71  if (m_Value < m_ValueMin)
72  {
73  m_ValueMin = m_Value;
74  }
75  }
76 
77  void CalcAverage()
78  {
79  m_Average = m_ValueSum / m_Count;
80  m_ValueMaxResult = m_ValueMax;
81  m_ValueMinResult = m_ValueMin;
82  }
83 };
84 //! @endcond
85 }
86 }
87 } // end of namespace nn::pia::common