CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
lan_LanSessionSearchCriteria.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/lan/lan_LanSessionTypes.h>
17 #include <nn/pia/session/session_SessionSearchCriteria.h>
18 
19 namespace nn
20 {
21 namespace pia
22 {
23 namespace lan
24 {
25 class LanSessionInfo;
26 /*!
27  @brief LAN マッチメイクのセッションを検索する際に使用する検索条件のクラスです。
28  @details 検索結果として得られるセッションの最大数は nn::pia::session::Session::CreateInstance 呼び出し時に
29  指定する nn::pia::session::Session::Setting 構造体の browsedSessionInfoListNum の値になります。
30 
31  @see nn::pia::session::SessionSearchCriteria
32  */
34 {
35 public:
36  /*!
37  @brief デフォルトコンストラクタ。
38  */
40 
41  /*!
42  @brief デストラクタ。
43  */
44  virtual ~LanSessionSearchCriteria();
45 
46  /*!
47  @cond PRIVATE
48  @brief 検索条件として指定した項目の示すビットマスクの各ビットに対応する項目
49  */
50  enum LanCondMask
51  {
52  LanCondMask_MinParticipation = 0, //!< 最小参加人数
53  LanCondMask_MaxParticipation, //!< 最大参加人数
54  LanCondMask_OpenedOnly, //!< 参加受付状態のセッションのみかどうか
55  LanCondMask_VacantOnly, //!< 空きがあるセッションのみかどうか
56  LanCondMask_GameMode, //!< ゲームモード
57  LanCondMask_SessionType, //!< セッションタイプ
58  LanCondMask_Attribute //!< 属性
59  };
60  //! @endcond
61 
62  /*!
63  @brief 検索条件に最小参加人数を指定します。
64  @param[in] min 検索条件に指定する最小参加人数。
65  */
66  void SetMinParticipantNum(uint16_t min);
67 
68  /*!
69  @brief 検索条件に最小参加人数を範囲指定します。
70  @param[in] min 検索条件に指定する最小参加人数の範囲の下限。
71  @param[in] max 検索条件に指定する最小参加人数の範囲の上限。
72  */
73  void SetMinParticipantNumRange(uint16_t min, uint16_t max);
74 
75  /*!
76  @brief 検索条件に最大参加人数を指定します。
77  @param[in] max 検索条件に指定する最大参加人数。
78  */
79  void SetMaxParticipantNum(uint16_t max);
80 
81  /*!
82  @brief 検索条件に最大参加人数を範囲指定します。
83  @param[in] min 検索条件に指定する最大参加人数の範囲の下限。
84  @param[in] max 検索条件に指定する最大参加人数の範囲の上限。
85  */
86  void SetMaxParticipantNumRange(uint16_t min, uint16_t max);
87 
88  /*!
89  @brief 検索条件に参加受付状態のセッションのみを検索するか指定します。
90  @param[in] bOpenedOnly 参加受付状態のセッションのみを検索する場合は true を指定します。
91  */
92  void SetOpenedOnly(bool bOpenedOnly);
93 
94  /*!
95  @brief 検索条件に空きがあるセッションのみを検索するか指定します。
96  @param[in] bVacantOnly 空きがあるセッションのみを検索する場合は true を指定します。
97  */
98  void SetVacantOnly(bool bVacantOnly);
99 
100  /*!
101  @brief 検索条件にゲームモードを指定します。
102  @param[in] gameMode 検索条件に指定するゲームモード。
103  */
104  void SetGameMode(uint32_t gameMode);
105 
106  /*!
107  @brief 検索条件にセッションタイプを指定します。
108  @param[in] sessionType 検索条件に指定するセッションタイプ。
109  */
110  void SetSessionType(LanSessionType sessionType);
111 
112  /*!
113  @brief 1つの属性に対して検索時に使用する値を指定します。
114  @param[in] index 指定する属性のインデックス。LanAttributeSizeMax 以下である必要があります。
115  @param[in] value 指定する属性の値。
116  @return セッションの属性の指定に成功すれば、成功の Result が返されます。
117  @retval nn::pia::ResultInvalidArgument 属性のインデックスが範囲外です。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
118  */
119  Result SetAttribute(uint32_t index, uint32_t value);
120 
121  /*!
122  @brief 1つの属性に対して検索時に使用する値を複数指定します。
123  @param[in] index 指定する属性のインデックス。LanAttributeSizeMax 以下である必要があります。
124  @param[in] value 指定する属性の値のリスト。
125  @param[in] attributeNum 指定する属性の値の個数。LanAttributeArraySizeMax 以下である必要があります。
126  @return セッションの属性の指定に成功すれば、成功の Result が返されます。
127  @retval nn::pia::ResultInvalidArgument 属性のインデックスが範囲外、値のリストが NULL、または値の個数が多すぎます。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
128  */
129  Result SetAttribute(uint32_t index, const uint32_t* value, uint32_t attributeNum);
130 
131  /*!
132  @brief 1つの属性に対して検索時に使用する値を範囲指定します。
133  @param[in] index 指定する属性のインデックス。LanAttributeSizeMax 以下である必要があります。
134  @param[in] min 指定する属性の値の下限。
135  @param[in] max 指定する属性の値の上限。
136  @return セッションの属性の指定に成功すれば、成功の Result が返されます。
137  @retval nn::pia::ResultInvalidArgument 属性のインデックスが範囲外、または下限値が上限値よりも大きい値になっています。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
138  */
139  Result SetAttributeRange(uint32_t index, uint32_t min, uint32_t max);
140 
141  /*!
142  @cond PRIVATE
143  @brief 指定したマッチメイクセッションが検索条件に合致するか判定します。
144  @param[in] pInfo 検索条件に合致するか判定するマッチメイクセッション
145  */
146  bool IsHit(const LanSessionInfo* pInfo);
147  //! @endcond
148 
149  /*!
150  @cond PRIVATE
151  @brief LanSessionSearchCriteria をシリアライズします。
152  */
153  Result Serialize(uint8_t* pBuffer, uint32_t* pDataSize, uint32_t bufferSize) const;
154  //! @endcond
155 
156  /*!
157  @cond PRIVATE
158  @brief LanSessionSearchCriteria をデシリアライズします。
159  */
160  Result Deserialize(const uint8_t* pData, uint32_t dataSize);
161  //! @endcond
162 
163  /*!
164  @cond PRIVATE
165  @brief LanSessionSearchCriteria のシリアライズ後のサイズを取得します。
166  */
167  uint32_t GetSerializedSize() const;
168  //! @endcond
169 
170  /*!
171  @cond PRIVATE
172  @brief デバッグに有用な情報をプリントします。
173  @param[in] flag トレースフラグです。詳細は @ref TraceFlag 型を参照してください。
174  */
175  virtual void Trace(uint64_t flag) const;
176  //! @endcond
177 
178  /*!
179  @brief 設定をリセットします。
180  */
181  virtual void Reset();
182 
183  /*!
184  @brief 設定をコピーします。
185  @param[in] rhs コピー元のオブジェクトです。
186  */
187  void Copy(const LanSessionSearchCriteria& rhs);
188 
189  /*!
190  @brief 代入演算子です。
191  @param[in] rhs 代入するオブジェクトです。
192  @return 本オブジェクトへの参照。
193  */
195 
196  /*!
197  @brief コピーコンストラクタ。
198  @param[in] rhs コピー元のオブジェクトです。
199  */
201 
202  /*!
203  @cond PRIVATE
204  */
205  uint32_t GetGameMode() const;
206  bool IsSetGameMode() const;
207  LanSessionType GetSessionType() const;
208  bool IsSetSessionType() const;
209  const uint32_t* GetAttributeList(uint32_t index) const;
210  uint32_t GetAttributeListSize(uint32_t index) const;
211  uint32_t GetAttributeRangeMin(uint32_t index) const;
212  uint32_t GetAttributeRangeMax(uint32_t index) const;
213  bool IsAttributeRangeUsed(uint32_t index) const;
214  bool IsSetAttribute(uint32_t index) const;
215 
216  bool IsOpenedOnly() const;
217  bool IsSetOpenedOnly() const;
218  bool IsVacantOnly() const;
219  bool IsSetVacantOnly() const;
220 
221  uint16_t GetMinParticipantRangeMin() const;
222  uint16_t GetMinParticipantRangeMax() const;
223  bool IsSetMinParticipantNum() const;
224  uint16_t GetMaxParticipantRangeMin() const;
225  uint16_t GetMaxParticipantRangeMax() const;
226  bool IsSetMaxParticipantNum() const;
227  //! @endcond
228 
229 private:
230  uint32_t m_GameMode;
231  LanSessionType m_SessionType;
232  uint32_t m_AttributeList[LanAttributeSizeMax][LanAttributeArraySizeMax];
233  uint32_t m_AttributeSizeList[LanAttributeSizeMax];
234  uint32_t m_AttributeRangeMin[LanAttributeSizeMax];
235  uint32_t m_AttributeRangeMax[LanAttributeSizeMax];
236  bool m_bAttributeRangeUsed[LanAttributeSizeMax];
237 
238  uint16_t m_MinParticipantsRangeMax;
239  uint16_t m_MinParticipantsRangeMin;
240  uint16_t m_MaxParticipantsRangeMax;
241  uint16_t m_MaxParticipantsRangeMin;
242  bool m_bOpenedOnly;
243  bool m_bVacantOnly;
244  uint32_t m_SetCondMask;
245 };
246 }
247 }
248 } // end of namespace nn::pia::lan