CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
common_StationAddress.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 
17 #include <nn/pia/common/common_Definitions.h>
18 
19 #include <nn/pia/common/common_InetAddress.h>
20 
21 
22 namespace nn
23 {
24 namespace pia
25 {
26 namespace common
27 {
28 
29 /*!
30  @brief ステーションを一意に識別するためのアドレスです。
31  */
33 {
34 public:
35  static const uint32_t SerializeSizeMax = common::InetAddress::SerializeSizeMax; // m_Extension
36 
37  /*!
38  @brief コンストラクタです。
39  */
40  StationAddress(void);
41 
42 
43  /*!
44  @brief デストラクタです。
45  */
46  virtual ~StationAddress(void)
47  {
48  }
49 
50 
51  /*!
52  @brief コピーコンストラクタです。
53  */
54  StationAddress(const StationAddress& rhs);
55 
56  /*!
57  @brief nn::pia::common::InetAddress の const 参照を得ます。
58 
59  @return nn::pia::common::InetAddress の const 参照が返ります。
60  */
62  {
63  return m_Address;
64  }
65 
66 
67  /*!
68  @brief nn::pia::common::InetAddress の参照を得ます。
69 
70  @return nn::pia::common::InetAddress の参照が返ります。
71  */
73  {
74  return m_Address;
75  }
76 
77 
78  /*!
79  @brief nn::pia::common::InetAddress を設定します。
80 
81  @param[in] addr 設定するインターネットアドレス。
82  @return この関数は必ず成功します。
83  */
85 
86 
87  /*!
88  @brief StationAddress の内容をクリアします。
89  */
90  void Clear(void);
91 
92 
93  /*!
94  @brief オブジェクトをシリアライズしたデータの長さを得ます。単位はバイトです。
95 
96  @return シリアライズされたデータの長さが返ります。単位はバイトです。
97  @see Serialize, Deserialize
98  */
99  uint32_t GetSerializedSize(void) const;
100 
101 
102  /*!
103  @brief オブジェクトをシリアライズします。
104 
105  @param[out] pBuffer シリアライズされたデータを書き込むバッファを指すポインタ。
106  @param[out] pDataLen シリアライズされたデータの長さが書き込まれます。単位はバイトです。
107  @param[in] bufferSize pBuffer で指定されたバッファのサイズを指定します。
108  @return 成功すれば、IsSuccess() が true を返す Result が返ります。この関数がエラーを返さないようにアプリケーションを実装する必要があります。
109  @retval ResultInvalidArgument 引数が誤っています( NULL ポインタであるなど )。pBuffer, bufferSize で指定されたバッファのサイズが不足していた場合も、このエラーが返されます。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
110  @see Deserialize, GetSerializedSize
111  */
112  Result Serialize(uint8_t* pBuffer, uint32_t* pDataLen, uint32_t bufferSize) const;
113 
114 
115  /*!
116  @brief シリアライズされたデータから、オブジェクトを復元します。
117 
118  @param[in] pData シリアライズされたデータを指すポインタ。
119 
120  @return 成功すれば、IsSuccess() が true を返す Result が返ります。この関数がエラーを返さないようにアプリケーションを実装する必要があります。
121  @retval ResultInvalidArgument 引数が誤っています( NULL ポインタであるなど)。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
122  @see Serialize, GetSerializedSize
123  */
124  Result Deserialize(const uint8_t* pData);
125 
126 
127  /*!
128  @cond PRIVATE
129  @brief 有効なアドレスがセットされているかどうかを判定します。
130 
131  @return 有効なアドレスであれば true が、無効なアドレスであれば false が返されます。
132  */
133  bool IsValid(void) const;
134  //! @endcond
135 
136  /*!
137  @cond PRIVATE
138  @brief 無効化します。
139  */
140  void Invalidate()
141  {
142  m_Address.Invalidate();
143  }
144  //! @endcond
145 
146  /*!
147  @brief 等値演算子です。二つの StationAddress オブジェクトが同等と見なせるかどうかを判定します。
148 
149  @return 両者の内容が同等であれば true を、そうでなければ false を返します。
150  */
151  bool operator==(const StationAddress& rhs) const;
152 
153 
154  /*!
155  @brief 等値演算子です。二つの StationAddress オブジェクトが異なるかどうかを判定します。
156 
157  @return 両者の内容が異なれば true を、そうでなければ false を返します。
158  */
159  bool operator!=(const StationAddress& rhs) const
160  {
161  return !(*this == rhs);
162  }
163 
164 
165  /*!
166  @brief 代入演算子です。
167 
168  @return 本オブジェクトの参照が返ります。
169  */
171 
172 
173  /*!
174  @brief 比較演算子です。
175 
176  @return このオブジェクトの方が小さければ true を返します。
177  */
178  bool operator<(const StationAddress& rhs) const;
179 
180 
181  /*!
182  @brief 比較演算子です。
183 
184  @return このオブジェクトの方が大きければ true を返します。
185  */
186  bool operator>(const StationAddress& rhs) const;
187 
188 
189  /*!
190  @brief 大小比較関数です。
191  @param[in] a 比較するオブジェクトです。
192  @param[in] b 比較するオブジェクトです。
193  @return a より b が小さければ -1 、大きければ 1 、等しければ 0 を返します。
194  */
195  static int Compare(const StationAddress& a, const StationAddress& b);
196 
197  /*!
198  @cond PRIVATE
199  @brief アドレスの文字列を取得します。
200 
201  @param[in] pString 文字列クラス。
202  */
203  void GetAddressString(String* pString) const;
204  //! @endcond
205 
206  /*!
207  @brief デバッグに有用な情報をプリントします。
208 
209  @param[in] flag トレースフラグの論理和。詳細は@ref TraceFlag 型を参照してください。
210  */
211  virtual void Trace(uint64_t flag) const;
212 
213 private:
214  common::InetAddress m_Address;
215 };
216 }
217 }
218 } // end of namespace nn::pia::common