CTR-Pia
5.4.3
Game Communication Engine
メインページ
ネームスペース一覧
クラス構成
クラス索引
関連ページ
Result 検索
全て
クラス
ネームスペース
関数
変数
型定義
列挙型
列挙型の値
ページ
clone_ReliableCloneElement.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_ReliableCloneElementBase.h>
18
19
namespace
nn
20
{
21
namespace
pia
22
{
23
namespace
clone
24
{
25
26
27
/*!
28
@brief 到達保証された値の送受信を管理します。
29
30
@tparam Value_ 管理する値の型です。
31
*/
32
template
<
typename
Value_>
33
class
ReliableCloneElement
:
public
ReliableCloneElementBase
34
{
35
public
:
36
/*!
37
@brief このオブジェクトが管理する値の型です。
38
*/
39
typedef
Value_
Value
;
40
41
42
/*!
43
@brief Value をシリアライズするためのアルゴリズムです。
44
*/
45
typedef
SerializePolicy<Value>
ValueSerializePolicy
;
46
47
48
/*!
49
@brief デフォルトコンストラクタです。
50
*/
51
ReliableCloneElement
()
52
:
ReliableCloneElementBase
(), m_Value()
53
{
54
}
55
56
57
/*!
58
@brief デストラクタです。
59
*/
60
virtual
~ReliableCloneElement
()
61
{
62
}
63
64
65
/*!
66
@brief 値を設定します。
67
@param[in] value 設定する値です。
68
@return 成功すれば、IsSuccess() が true を返す Result が返されます。
69
@retval ResultInvalidState 登録している CloneBase が送信可能状態ではありません。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
70
@retval ResultTemporaryUnavailable 値を設定できるタイミングではありません。値を設定するためには時刻を進める必要があります。アプリケーションで適切にハンドリングしてください。
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
private
:
106
Value
m_Value;
107
NN_PIA_DISALLOW_COPY(
ReliableCloneElement
);
108
//! @endcond
109
};
110
111
112
//! @cond
113
template
<
typename
Value>
114
Result
ReliableCloneElement<Value>::SetValue
(
const
Value& value)
115
{
116
Result r = SetValueCore();
117
if
(r.IsSuccess())
118
{
119
m_Value = value;
120
}
121
return
r;
122
}
123
//! @endcond
124
}
125
}
126
}
// end of namespace nn::pia::clone
Include
nn
pia
clone
clone_ReliableCloneElement.h
© 2016 Nintendo Co., Ltd. All rights reserved. 記載されている会社名、製品名等は、各社の登録商標または商標です。