CTR Pia  4.11.3
Game Communication Engine
inet_LanSessionSearchCriteria.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: inet_LanSessionSearchCriteria.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/session/session_SessionSearchCriteria.h>
18 #include <pia/inet/inet_LanSessionTypes.h>
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace session
25 {
26 class ISessionInfo;
27 }
28 }
29 }
30 
31 
32 namespace nn
33 {
34 namespace pia
35 {
36 namespace inet
37 {
38 //! @cond CAFE_DOC
39 
40 class LanMatchmakeSessionInfo;
41 /*!
42  @brief The search condition class used when searching for a LAN matchmaking session.
43 
44  @date 2014-02-03 Initial version.
45 
46  @see nn::pia::session::SessionSearchCriteria
47 */
48 class LanSessionSearchCriteria : public nn::pia::session::SessionSearchCriteria
49 {
50 public:
51 /*!
52  @brief The default constructor.
53 */
54  LanSessionSearchCriteria();
55 
56 /*!
57  @brief The destructor.
58 */
59  virtual ~LanSessionSearchCriteria();
60 
61 /*!
62  @brief Sets the minimum participants in the search criteria.
63  @param[in] min The minimum participants value to set in the search criteria.
64 */
65  void SetMinParticipants(u16 min)
66  {
67  m_MinParticipantsRangeMax = min;
68  m_MinParticipantsRangeMin = min;
69  }
70 
71 /*!
72  @brief Sets a range of minimum participants in the search criteria.
73  @param[in] min The minimum value of the range to set for minimum participants in the search criteria.
74  @param[in] max The maximum value of the range to set for minimum participants in the search criteria.
75 */
76  void SetMinParticipantsRange(u16 min, u16 max)
77  {
78  m_MinParticipantsRangeMax = max;
79  m_MinParticipantsRangeMin = min;
80  };
81 
82 /*!
83  @brief Sets the maximum participants in the search criteria.
84  @param[in] max The maximum participants value to set in the search criteria.
85 */
86  void SetMaxParticipants(u16 max)
87  {
88  m_MaxParticipantsRangeMax = max;
89  m_MaxParticipantsRangeMin = max;
90  }
91 
92 /*!
93  @brief Sets a range of maximum participants in the search criteria.
94  @param[in] min The minimum value of the range to set for maximum participants in the search criteria.
95  @param[in] max The maximum value of the range to set for maximum participants in the search criteria.
96 */
97  void SetMaxParticipantsRange(u16 min, u16 max)
98  {
99  m_MaxParticipantsRangeMax = max;
100  m_MaxParticipantsRangeMin = min;
101  };
102 
103 /*!
104  @brief Sets whether to search only for sessions that are open to participants in the search criteria.
105  @param[in] bOpenedOnly Specify <tt>true</tt> to search only for sessions that are open to participants.
106 */
107  void SetOpenedOnly(bool bOpenedOnly)
108  {
109  m_bOpenedOnly = bOpenedOnly;
110  }
111 
112 /*!
113  @brief Sets whether to search only for sessions that have openings in the search criteria.
114  @param[in] bVacantOnly Specify <tt>true</tt> to search only for sessions that have openings.
115 */
116  void SetVacantOnly(bool bVacantOnly)
117  {
118  m_bVacantOnly = bVacantOnly;
119  }
120 
121 /*!
122  @brief Sets the search conditions to game mode.
123  @param[in] gameMode Specifies the game mode search conditions.
124 */
125  void SetGameMode(u32 gameMode)
126  {
127  m_GameMode = gameMode;
128  }
129 /*!
130  @brief Sets the session type search conditions.
131  @param[in] sessionType Specifies the session type search conditions.
132 */
133  void SetSessionType(LanSessionType sessionType)
134  {
135  m_SessionType = sessionType;
136  }
137 /*!
138  @brief Sets a value to use when searching for a single attribute.
139  @param[in] index Specifies the index of an attribute.
140  @param[in] value Specifies the value of an attribute.
141 */
142  void SetAttribute(u32 index, u32 value);
143 /*!
144  @brief Sets multiple values to use when searching for a single attribute.
145  @param[in] index Specifies the index of an attribute.
146  @param[in] value Specifies a list of values for an attribute.
147  @param[in] attributeNum Specifies the number of values for an attribute.
148 */
149  void SetAttribute(u32 index, u32* value, size_t attributeNum);
150 /*!
151  @brief Sets a range of values to use when searching for a single attribute.
152  @param[in] index Specifies the index of an attribute.
153  @param[in] min Specifies the minimum value of an attribute.
154  @param[in] max Specifies the maximum value of an attribute.
155 */
156  void SetAttributeRange(u32 index, u32 min, u32 max);
157 
158 /*!
159  @brief Sets the selection methods for joining sessions when random matchmaking is in effect.
160  @param[in] selectionMethod Specifies the selection method to set for the session.
161 */
162  void SetRandomSessionSelectionMethod(u32 selectionMethod);
163 
164 /*!
165  @cond PRIVATE
166  @brief Determines whether a specified matchmaking session matches the search conditions.
167  @param[in] pInfo Specifies the matchmaking session to check to determine whether it matches the search conditions.
168 */
169  bool IsHit(session::ISessionInfo* pInfo);
170  //! @endcond
171 
172 /*!
173  @cond PRIVATE
174  @brief Serializes <tt>LanSessionSearchCriteria</tt>.
175 */
176  nn::Result Serialize(bit8* pBuffer, size_t* pDataSize, size_t bufferSize) const;
177  //! @endcond
178 
179 /*!
180  @cond PRIVATE
181  @brief Deserializes <tt>LanSessionSearchCriteria</tt>.
182 */
183  nn::Result Deserialize(const bit8* pData, size_t dataSize);
184  //! @endcond
185 
186 /*!
187  @cond PRIVATE
188  @brief Gets the size of <tt>LanSessionSearchCriteria</tt> post-serialization.
189 */
190  size_t GetSerializedSize() const;
191  //! @endcond
192 
193 /*!
194  @cond PRIVATE
195  @brief Prints information that is useful for debugging.
196  @param[in] flag Specifies the trace flag. For more information, see the <tt>@ref TraceFlag</tt> API reference.
197 */
198  virtual void Trace(u64 flag) const;
199  //! @endcond
200 
201 /*!
202  @cond PRIVATE
203  @brief Resets the member variables.
204 */
205  void Clear();
206  //! @endcond
207 
208 /*!
209  @brief Assignment operator.
210  @param[in] r The object to assign.
211  @return See this object.
212 */
213  LanSessionSearchCriteria& operator=(const LanSessionSearchCriteria& r);
214 
215 private:
216  // The copy constructor is sealed.
217  LanSessionSearchCriteria(const LanSessionSearchCriteria&);
218 
219  // Invalid number of participants setting.
220  static const u16 INVALID_PARICIPANTS_NUM = 0xffff;
221 
222  // Minimum participants range.
223  u16 m_MinParticipantsRangeMax;
224  u16 m_MinParticipantsRangeMin;
225 
226  // Maximum participants range.
227  u16 m_MaxParticipantsRangeMax;
228  u16 m_MaxParticipantsRangeMin;
229 
230  // Whether to list only open sessions.
231  bool m_bOpenedOnly;
232  // Whether to remove full sessions from the results.
233  bool m_bVacantOnly;
234 
235  // Game mode.
236  u32 m_GameMode;
237 
238  // Session type.
239  LanSessionType m_SessionType;
240 
241  // Attributes.
242  u32 m_AttributeList[LAN_ATTRIBUTE_MAX_SIZE][LAN_ATTRIBUTE_ARRAY_MAX_SIZE];
243  size_t m_AttributeSizeList[LAN_ATTRIBUTE_MAX_SIZE];
244  u32 m_AttributeRangeMin[LAN_ATTRIBUTE_MAX_SIZE];
245  u32 m_AttributeRangeMax[LAN_ATTRIBUTE_MAX_SIZE];
246  bool m_bAttributeRangeUsed[LAN_ATTRIBUTE_MAX_SIZE];
247 };
248 
249 //! @endcond
250 }
251 }
252 } // End of namespace nn::pia::inet.
Definition: assert.h:115
The base class for the search criteria used when searching for sessions.
Definition: session_SessionSearchCriteria.h:34
An interface to the session&#39;s information.
Definition: session_ISessionInfo.h:32