CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
transport_ProtocolId.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/transport/transport_Definitions.h>
17 
18 
19 namespace nn
20 {
21 namespace pia
22 {
23 namespace transport
24 {
25 
26 
27 /*!
28 @cond PRIVATE
29  @brief プロトコルIDを表す構造体です。
30  */
31 struct ProtocolId
32 {
33 public:
34  struct Item
35  {
36 #if NN_PIA_ENDIAN_BIG
37  uint16_t m_Type;
38  uint16_t m_Port;
39 #else
40  uint16_t m_Port;
41  uint16_t m_Type;
42 #endif
43  };
44 
45  union
46  {
47  uint32_t m_Value;
48  Item m_Item;
49  };
50 
51 
52  /*!
53  @brief デフォルトコンストラクタです。
54  */
55  ProtocolId()
56  : m_Value(INVALID.m_Value)
57  {
58  }
59 
60 
61  /*!
62  @brief uint32_tの値からの変換
63  */
64  ProtocolId(uint32_t value)
65  : m_Value(value)
66  {
67  }
68 
69  /*!
70  @brief タイプの取得
71  */
72  uint16_t GetType()
73  {
74  return m_Item.m_Type;
75  }
76 
77  /*!
78  @brief タイプ、ポートから生成
79  */
80  ProtocolId(uint16_t type, uint16_t port)
81  {
82  m_Item.m_Type = type;
83  m_Item.m_Port = port;
84  }
85 
86 
87  /*!
88  @brief uint32_tの値への変換
89  */
90  operator uint32_t() const
91  {
92  return m_Value;
93  }
94 
95 
96  /*!
97  @brief 無効なプロトコルID
98  */
99  static const ProtocolId INVALID;
100 };
101 //! @endcond
102 }
103 }
104 } // end of namespace nn::pia::transport