CTR-Pia
5.4.3
Game Communication Engine
メインページ
ネームスペース一覧
クラス構成
クラス索引
関連ページ
Result 検索
全て
クラス
ネームスペース
関数
変数
型定義
列挙型
列挙型の値
ページ
clone_UnreliableCloneElement.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/clone/clone_Definitions.h>
17
#include <nn/pia/clone/clone_UnreliableCloneElementBase.h>
18
#include <nn/pia/clone/clone_SerializePolicyDefinition.h>
19
20
namespace
nn
21
{
22
namespace
pia
23
{
24
namespace
clone
25
{
26
27
28
/*!
29
@brief 到達保証されない値の送受信を管理します。
30
31
@tparam Value_ 管理する値の型です。
32
*/
33
template
<
typename
Value_>
34
class
UnreliableCloneElement
:
public
UnreliableCloneElementBase
35
{
36
public
:
37
/*!
38
@brief このオブジェクトが管理する値の型です。
39
*/
40
typedef
Value_
Value
;
41
42
43
/*!
44
@brief Value をシリアライズするためのアルゴリズムです。
45
*/
46
typedef
SerializePolicy<Value>
ValueSerializePolicy
;
47
48
49
/*!
50
@brief デフォルトコンストラクタです。
51
*/
52
UnreliableCloneElement
()
53
:
UnreliableCloneElementBase
(), m_Value()
54
{
55
}
56
57
58
/*!
59
@brief デストラクタです。
60
*/
61
virtual
~UnreliableCloneElement
()
62
{
63
}
64
65
66
/*!
67
@brief 値を設定します。
68
@param[in] value 設定する値です。
69
@return 成功すれば、IsSuccess() が true を返す Result が返されます。
70
@retval ResultInvalidState 登録している CloneBase が送信可能状態ではありません。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
71
*/
72
Result
SetValue
(
const
Value
& value);
73
74
75
/*!
76
@brief 値を取得します。
77
@return このオブジェクトが管理する値です。IsValidValue() が false の場合に取得できる値は不定です。
78
*/
79
const
Value
&
GetValue
()
const
80
{
81
return
m_Value;
82
}
83
84
85
//! @cond PRIVATE
86
87
protected
:
88
virtual
uint32_t GetSize()
const
89
{
90
return
ValueSerializePolicy::GetSerializedSize
();
91
}
92
virtual
void
Serialize(
void
* pBuffer)
const
93
{
94
ValueSerializePolicy::Serialize
(pBuffer, m_Value);
95
}
96
virtual
void
Deserialize(
const
void
* cpData)
97
{
98
ValueSerializePolicy::Deserialize
(&m_Value, cpData);
99
}
100
virtual
void
ClearValue()
101
{
102
m_Value =
Value
();
103
}
104
105
106
private
:
107
Value
m_Value;
108
NN_PIA_DISALLOW_COPY(
UnreliableCloneElement
);
109
//! @endcond
110
};
111
112
113
//! @cond
114
template
<
typename
Value>
115
Result
UnreliableCloneElement<Value>::SetValue
(
const
Value& value)
116
{
117
bool
isCopyValue;
118
Result r = SetValueCore(&isCopyValue);
119
if
(isCopyValue)
120
{
121
m_Value = value;
122
}
123
return
r;
124
}
125
//! @endcond
126
}
127
}
128
}
// end of namespace nn::pia::clone
Include
nn
pia
clone
clone_UnreliableCloneElement.h
© 2016 Nintendo Co., Ltd. All rights reserved. 記載されている会社名、製品名等は、各社の登録商標または商標です。