CTR Pia  4.11.3
Game Communication Engine
transport_StationConnectionInfo.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: transport_StationConnectionInfo.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/transport/transport_definitions.h>
18 #include <pia/transport/transport_StationLocation.h>
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace transport
25 {
26 
27 /*!
28 @brief Represents an address used to uniquely identify stations.
29 
30 @details This class includes two instances of <tt>StationLocation</tt>. One is for the main address and one is for a sub-address.
31 
32 @date 2012-04-16 Added a serialized group of API functions for streamlining size during serialization.
33 @date 2012-04-06 Initial version.
34 */
36 {
37 public:
38 /*!
39 @brief Instantiates the object.
40 */
42 
43 /*!
44 @brief This is the copy constructor.
45 @param[in] o Specifies the argument to the copy constructor.
46 */
48 
49 /*!
50 @brief Destroys the object.
51 */
52  virtual ~StationConnectionInfo(void);
53 
54  void SetStationConnectionInfo(const StationConnectionInfo& o);
55 
56 /*!
57 @brief This is the assignment operator.
58 
59 @param[in] o The <tt>StationConnectionInfo</tt> object to assign.
60 @return Returns a reference to the <tt>this</tt> object.
61 */
63 
64  bool operator==(const StationConnectionInfo& o) const;
65 
66  bool operator!=(const StationConnectionInfo& o) const
67  {
68  return !(*this == o);
69  }
70 
71  bool HasPrivateAddress() const
72  {
73  return m_SubLocation.GetStationAddress().GetInetAddress().IsValid();
74  }
75 
76  bool IsSamePublicAddress(const StationConnectionInfo& o) const
77  {
78  return m_MainLocation.IsSameAddress(o.m_MainLocation);
79  }
80 
81 /*!
82 @brief Gets a <tt>const</tt> reference to the <tt>StationLocation</tt> (main address).
83 
84 @returns Returns a <tt>const</tt> reference to the <tt>StationLocation</tt> (main address).
85 */
86  const StationLocation& GetMainLocation(void) const
87  {
88  return m_MainLocation;
89  }
90 
91 /*!
92 @brief Gets a reference to the <tt>StationLocation</tt> (main address).
93 
94 @returns Returns a reference to the <tt>StationLocation</tt> (main address).
95 */
97  {
98  return m_MainLocation;
99  }
100 
101 /*!
102 @brief Sets the <tt>StationLocation</tt> (main address).
103 
104 @param[in] o Specifies the <tt>StationLocation</tt> to set.
105 */
107  {
108  m_MainLocation.SetStationLocation(o);
109  }
110 
111 /*!
112 @brief Gets a <tt>const</tt> reference to the <tt>StationLocation</tt> (sub-address).
113 
114 @returns Returns a <tt>const</tt> reference to the <tt>StationLocation</tt> (sub-address).
115 */
116  const StationLocation& GetSubLocation(void) const
117  {
118  return m_SubLocation;
119  }
120 
121 /*!
122 @brief Gets a reference to the <tt>StationLocation</tt> (sub-address).
123 
124 @returns Returns a reference to the <tt>StationLocation</tt> (sub-address).
125 */
127  {
128  return m_SubLocation;
129  }
130 
131 /*!
132 @brief Sets the <tt>StationLocation</tt> (sub-address).
133 
134 @param[in] o Specifies the <tt>StationLocation</tt> to set.
135 */
137  {
138  m_SubLocation.SetStationLocation(o);
139  }
140 
141 /*!
142 @brief Gets a <tt>const</tt> reference to the main address of the <tt>StationLocation</tt>.
143 The main address is intended to be used for public addresses.
144 
145 @return Returns a <tt>const</tt> reference to the main address of the <tt>StationLocation</tt>.
146 */
148  {
149  return m_MainLocation;
150  }
151 
152 /*!
153 @brief Gets a reference to the main address of the <tt>StationLocation</tt>.
154 The main address is intended to be used for public addresses.
155 
156 @return Returns a reference to the main address of the <tt>StationLocation</tt>.
157 */
159  {
160  return m_MainLocation;
161  }
162 
163 /*!
164 @brief Gets a <tt>const</tt> reference to the sub-address of the <tt>StationLocation</tt>.
165 The sub-address is intended to be used for private addresses.
166 
167 @return Returns a <tt>const</tt> reference to the sub-address of the <tt>StationLocation</tt>.
168 */
170  {
171  return m_SubLocation;
172  }
173 
174 /*!
175 @brief Gets a reference to the sub-address of the <tt>StationLocation</tt>.
176 The sub-address is intended to be used for private addresses.
177 
178 @return Returns a reference to the sub-address of the <tt>StationLocation</tt>.
179 */
181  {
182  return m_SubLocation;
183  }
184 
185  virtual size_t GetSerializedSize(void) const;
186  virtual nn::Result Serialize(bit8* pBuffer, size_t* pSerializedSize, size_t bufferSize) const;
187  virtual nn::Result Deserialize(const bit8* pData);
188 
189  virtual size_t GetStreamlinedSerializedSize(void) const;
190  virtual nn::Result StreamlinedSerialize(bit8* pBuffer, size_t* pSerializedSize, size_t bufferSize) const;
191  virtual nn::Result StreamlinedDeserialize(const bit8* pData);
192 
193 /*!
194 @brief Prints information that is useful for debugging.
195 
196 @param[in] flag Specifies the bitwise OR of trace flags. For more information, see the <tt>@ref TraceFlag</tt> type.
197 */
198  virtual void Trace(u64 flag) const;
199 
200 private:
201  size_t LittleMembersSerialize(bit8* pBuffer, const StationLocation& src) const;
202  size_t LittleMembersDeserialize(StationLocation* pDest, const bit8* pData);
203 
204  StationLocation m_MainLocation;
205  StationLocation m_SubLocation;
206 };
207 }
208 }
209 }
StationConnectionInfo(void)
Instantiates the object.
const StationLocation & GetPublicLocation(void) const
Gets a const reference to the main address of the StationLocation. The main address is intended to be...
Definition: transport_StationConnectionInfo.h:147
const StationLocation & GetMainLocation(void) const
Gets a const reference to the StationLocation (main address).
Definition: transport_StationConnectionInfo.h:86
Definition: assert.h:115
StationLocation & GetSubLocation(void)
Gets a reference to the StationLocation (sub-address).
Definition: transport_StationConnectionInfo.h:126
const nn::pia::common::StationAddress & GetStationAddress(void) const
Gets a const reference to the nn::pia::common::StationAddress instance.
Definition: transport_StationLocation.h:139
StationLocation & GetPublicLocation(void)
Gets a reference to the main address of the StationLocation. The main address is intended to be used ...
Definition: transport_StationConnectionInfo.h:158
void SetMainLocation(const StationLocation &o)
Sets the StationLocation (main address).
Definition: transport_StationConnectionInfo.h:106
const StationLocation & GetSubLocation(void) const
Gets a const reference to the StationLocation (sub-address).
Definition: transport_StationConnectionInfo.h:116
StationLocation & GetPrivateLocation(void)
Gets a reference to the sub-address of the StationLocation. The sub-address is intended to be used fo...
Definition: transport_StationConnectionInfo.h:180
StationConnectionInfo & operator=(const StationConnectionInfo &o)
This is the assignment operator.
virtual ~StationConnectionInfo(void)
Destroys the object.
virtual void Trace(u64 flag) const
Prints information that is useful for debugging.
const nn::pia::common::InetAddress & GetInetAddress(void) const
Gets a const reference to an nn::pia::common::InetAddress instance.
Definition: common_StationAddress.h:132
Represents an address used to uniquely identify stations.
Definition: transport_StationConnectionInfo.h:35
const StationLocation & GetPrivateLocation(void) const
Gets a const reference to the sub-address of the StationLocation. The sub-address is intended to be u...
Definition: transport_StationConnectionInfo.h:169
StationLocation & GetMainLocation(void)
Gets a reference to the StationLocation (main address).
Definition: transport_StationConnectionInfo.h:96
Represents an address used to uniquely identify stations.
Definition: transport_StationLocation.h:59
This is the common base class used inside the Pia library.
Definition: common_RootObject.h:40
void SetSubLocation(const StationLocation &o)
Sets the StationLocation (sub-address).
Definition: transport_StationConnectionInfo.h:136