CTR Pia  4.11.3
Game Communication Engine
local_LocalSessionSearchCriteria.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: local_LocalSessionSearchCriteria.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 
19 namespace nn
20 {
21 namespace pia
22 {
23 namespace local
24 {
25 // Forward declarations.
26 class LocalNetworkDescription;
27 
28 /*!
29  @brief The search condition class used when searching for a matchmaking session using <tt>LocalNetwork</tt>.
30 
31  @date 2014-03-03 Initial version.
32 
33  @see nn::pia::session::SessionSearchCriteria
34  */
36 {
37 public:
38  // The constructor.
41  m_MaxParticipantsRangeMax(INVALID_PARICIPANTS_NUM),
42  m_MaxParticipantsRangeMin(INVALID_PARICIPANTS_NUM),
43  m_bOpenedOnly(true),
44  m_bVacantOnly(false),
45  m_LocalCommunicationId(0),
46  m_SubId(0)
47  {
48  }
49 
50  // The destructor.
52  {
53  }
54 
55 /*!
56  @brief Sets the maximum participants in the search criteria.
57  @param[in] max The maximum participants value to set in the search criteria.
58 */
59  void SetMaxParticipants(u16 max)
60  {
61  m_MaxParticipantsRangeMax = max;
62  m_MaxParticipantsRangeMin = max;
63  }
64 
65 /*!
66  @brief Sets a range of maximum participants in the search criteria.
67  @param[in] min The minimum value of the range to set for maximum participants in the search criteria.
68  @param[in] max The maximum value of the range to set for maximum participants in the search criteria.
69 */
70  void SetMaxParticipantsRange(u16 min, u16 max)
71  {
72  m_MaxParticipantsRangeMax = max;
73  m_MaxParticipantsRangeMin = min;
74  };
75 
76 /*!
77  @brief Gets the minimum value of the range of maximum participants set by the search criteria.
78  @return Returns the minimum value of the range of maximum participants set by the search criteria.
79 */
81  {
82  return m_MaxParticipantsRangeMin;
83  }
84 
85 /*!
86  @brief Gets the maximum value of the range of maximum participants set by the search criteria.
87  @return Returns the maximum value of the range of maximum participants set by the search criteria.
88 */
90  {
91  return m_MaxParticipantsRangeMax;
92  }
93 
94 /*!
95  @brief Sets whether to search only for sessions that are open to participants in the search criteria.
96  @param[in] bOpenedOnly Specify <tt>true</tt> to search only for sessions that are open to participants.
97 */
98  void SetOpenedOnly(bool bOpenedOnly)
99  {
100  m_bOpenedOnly = bOpenedOnly;
101  }
102 
103 /*!
104  @brief Sets whether to search only for sessions that have openings in the search criteria.
105  @param[in] bVacantOnly Specify <tt>true</tt> to search only for sessions that have openings.
106 */
107  void SetVacantOnly(bool bVacantOnly)
108  {
109  m_bVacantOnly = bVacantOnly;
110  }
111 
112 /*!
113  @brief Sets the local communication ID.
114 
115  @details Specifies the value generated by <tt>@ref LocalNetwork::CreateLocalCommunicationId</tt>.
116 
117  @param[in] localCommunicationId Specifies the local communication ID.
118  */
119  void SetLocalCommunicationId(u32 localCommunicationId)
120  {
121  m_LocalCommunicationId = localCommunicationId;
122  }
123 
124 /*!
125  @cond PRIVATE
126  */
127  u32 GetLocalCommunicationId() const
128  {
129  return m_LocalCommunicationId;
130  }
131  //! @endcond
132 
133 /*!
134  @brief Sets the ID for identifying the communication mode. To search all IDs, specify <tt>0xff</tt>.
135 
136  @param[in] subId Specifies an ID for identifying the communication mode.
137  */
138  void SetSubId(u8 subId)
139  {
140  m_SubId = subId;
141  }
142 
143 /*!
144  @cond PRIVATE
145  */
146  u8 GetSubId() const
147  {
148  return m_SubId;
149  }
150  //! @endcond
151 
152 /*!
153  @cond PRIVATE
154  */
155  bool IsHit(LocalNetworkDescription* pDescription);
156  //! @endcond
157 
159  {
161  m_MaxParticipantsRangeMax = r.m_MaxParticipantsRangeMax;
162  m_MaxParticipantsRangeMin = r.m_MaxParticipantsRangeMin;
163  m_bOpenedOnly = r.m_bOpenedOnly;
164  m_bVacantOnly = r.m_bVacantOnly;
165  m_LocalCommunicationId = r.m_LocalCommunicationId;
166  m_SubId = r.m_SubId;
167  return *this;
168  }
169 
170  // Prints information that is useful for debugging.
171  virtual void Trace(u64 flag) const
172  {
173  NN_PIA_DUMMY_PARAM(flag);
174  }
175 
176 
177 private:
178  // The copy constructor is sealed.
180 
181  // Invalid number of participants setting.
182  static const u16 INVALID_PARICIPANTS_NUM = 0xffff;
183 
184  // Maximum participants range.
185  u16 m_MaxParticipantsRangeMax;
186  u16 m_MaxParticipantsRangeMin;
187 
188  // Whether to list only open sessions.
189  bool m_bOpenedOnly;
190  // Whether to remove full sessions from the results.
191  bool m_bVacantOnly;
192 
193  u32 m_LocalCommunicationId;
194  u8 m_SubId;
195 };
196 }
197 }
198 } // End of namespace nn::pia::local.
u16 GetMaxParticipantsRangeMin() const
Gets the minimum value of the range of maximum participants set by the search criteria.
Definition: local_LocalSessionSearchCriteria.h:80
Definition: assert.h:115
The base class for the search criteria used when searching for sessions.
Definition: session_SessionSearchCriteria.h:34
void SetLocalCommunicationId(u32 localCommunicationId)
Sets the local communication ID.
Definition: local_LocalSessionSearchCriteria.h:119
void SetVacantOnly(bool bVacantOnly)
Sets whether to search only for sessions that have openings in the search criteria.
Definition: local_LocalSessionSearchCriteria.h:107
The search condition class used when searching for a matchmaking session using LocalNetwork.
Definition: local_LocalSessionSearchCriteria.h:35
Class that holds information about a local network.
Definition: local_LocalNetworkSetting.h:121
void SetMaxParticipantsRange(u16 min, u16 max)
Sets a range of maximum participants in the search criteria.
Definition: local_LocalSessionSearchCriteria.h:70
SessionSearchCriteria & operator=(const SessionSearchCriteria &r)
Assignment operator.
Definition: session_SessionSearchCriteria.h:99
u16 GetMaxParticipantsRangeMax() const
Gets the maximum value of the range of maximum participants set by the search criteria.
Definition: local_LocalSessionSearchCriteria.h:89
void SetSubId(u8 subId)
Sets the ID for identifying the communication mode. To search all IDs, specify 0xff.
Definition: local_LocalSessionSearchCriteria.h:138
void SetMaxParticipants(u16 max)
Sets the maximum participants in the search criteria.
Definition: local_LocalSessionSearchCriteria.h:59
void SetOpenedOnly(bool bOpenedOnly)
Sets whether to search only for sessions that are open to participants in the search criteria...
Definition: local_LocalSessionSearchCriteria.h:98