17 #include <pia/clone/clone_definitions.h> 18 #include <pia/common/common_TreeMapNode.h> 19 #include <pia/common/common_ListNode.h> 32 class CloneProfilerBase;
69 return m_TreeMapNode.GetKey();
96 return m_pCloneBase != NULL;
141 return m_pSendProfiler;
152 return m_pReceiveProfiler;
248 static s32 GetTreeMapNodeOffset()
253 virtual bool IsSupportedClone(
int cloneType)
const 255 NN_PIA_DUMMY_PARAM(cloneType);
258 void AttachCloneBase(
CloneBase* pCloneBase);
259 void DetachCloneBase();
263 return m_pSendProfiler;
267 return m_pReceiveProfiler;
272 TYPE_UNRELIABLE = 0x1000,
273 TYPE_RELIABLE = 0x2000,
275 TYPE_RECKONING = 0x4000,
276 TYPE_RELIABLE_LARGE = 0x5000
279 virtual u16 GetType()
const = 0;
280 virtual size_t GetSize()
const = 0;
287 virtual void ClearData() = 0;
290 NN_PIA_DUMMY_PARAM(stationId);
294 NN_PIA_DUMMY_PARAM(stationId);
298 NN_PIA_DUMMY_PARAM(stationId);
302 NN_PIA_DUMMY_PARAM(stationId);
308 virtual void RequestInitialData()
312 u32 GetStationNum()
const;
322 bool IsInList()
const 324 return m_ListNode.IsFreeListNode() ==
false;
326 virtual Type GetElementType()
const = 0;
327 virtual u32 GetDestBitmap()
const = 0;
328 virtual bool IsResend()
const 332 virtual size_t GetChunkSize()
const = 0;
333 virtual void WriteChunk(
void* pChunkBuffer)
const = 0;
335 static s32 GetListNodeOffset()
337 return offsetof(ISendToken, m_ListNode);
341 common::ListNode m_ListNode;
345 class ResendableSendToken :
public ISendToken
348 ResendableSendToken()
349 : ISendToken(), m_LastSendTime(INVALID_SYSTEM_TIME), m_IsSendDelay(
false), m_SendCount(0)
353 m_LastSendTimeArray[i] = INVALID_SYSTEM_TIME;
354 m_SendCountArray[i] = 0;
357 virtual bool IsResend()
const 361 SystemTime GetLastSendTime(
StationIndex stationIndex)
const 365 return m_LastSendTime;
369 PIA_ASSERT(IsUnicast());
371 return m_LastSendTimeArray[stationIndex];
374 bool IsSendDelay()
const 376 return m_IsSendDelay;
378 void SetLastSendTime(SystemTime time,
StationIndex stationIndex)
382 m_LastSendTime = time;
386 PIA_ASSERT(IsUnicast());
388 m_LastSendTimeArray[stationIndex] = time;
391 void EnableSendDelay(
bool isSendDelay)
393 m_IsSendDelay = isSendDelay;
396 virtual bool IsUnicast()
const 400 void SetSendCount(u32 sendCount,
StationIndex stationIndex)
404 m_SendCount = sendCount;
408 PIA_ASSERT(IsUnicast());
410 m_SendCountArray[stationIndex] = sendCount;
421 PIA_ASSERT(IsUnicast());
423 ++m_SendCountArray[stationIndex];
434 PIA_ASSERT(IsUnicast());
436 return m_SendCountArray[stationIndex];
441 SystemTime m_LastSendTime;
449 class ConversibleResendableSendToken :
public ResendableSendToken
452 ConversibleResendableSendToken()
453 : ResendableSendToken(), m_IsResend(
false)
456 virtual bool IsResend()
const 460 void SetResend(
bool isResend)
462 m_IsResend = isResend;
470 void AddSendData(ISendToken* pToken);
471 void AddSendDelayData(ResendableSendToken* pToken);
472 void CancelSendData(ISendToken* pToken);
475 void ErrorDropEvent();
483 common::TreeMapNode<Id> m_TreeMapNode;
487 template <
typename Element,
typename CP>
493 CP::GetElementDefinition()->Register(Element::GetTypeStatic(), Element::Receive, Element::GetDataChunkHeaderSize());
497 template <
typename Element>
498 class Definition :
public DefinitionBase<Element, CloneProtocol>
502 : DefinitionBase<Element, CloneProtocol>()
512 template <
int TEST_ID,
typename Arg>
u32 GetProfiledTotalReceiveSize(StationIndex stationIndex) const
Gets the amount of data, in bytes, received since ResetProfiler was called.
This is the base class for managing data that is sent and received. .
Definition: clone_CloneElementBase.h:40
u32 GetProfiledLatestSendSize(StationIndex stationIndex) const
Gets the total amount of data, in bytes, sent during the last CloneProfiler::LATEST_BUFFER_SIZE times...
u32 GetProfiledTotalReceiveCount(StationIndex stationIndex) const
Gets the number of times received since ResetProfiler was called.
void ResetProfiler()
Resets the results of send/receive profiling.
const CloneProfilerBase * GetSendProfiler() const
Gets the object configured to manage send profiling.
Definition: clone_CloneElementBase.h:139
u32 GetProfiledLatestSendCount(StationIndex stationIndex) const
Gets the send count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch ...
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
ID indicating a station that is not present in the session.
Definition: platformCtr.h:59
Represents a protocol for sharing values between stations.
Definition: clone_CloneProtocol.h:51
bool IsInitialized(void)
Gets whether the clone module is initialized.
u32 GetProfiledLatestReceiveSize(StationIndex stationIndex) const
Gets the total amount of data, in bytes, received during the last CloneProfiler::LATEST_BUFFER_SIZE t...
This base class manages PiaClone profiling.
Definition: clone_CloneProfilerBase.h:33
u32 GetProfiledTotalSendSize(StationIndex stationIndex) const
Gets the amount of data, in bytes, sent since ResetProfiler was called.
This is the base class for managing sending and receiving. .
Definition: clone_CloneBase.h:38
const size_t MAX_STATION_NUM
The maximum value for the number of stations that can participate in a Pia session.
Definition: platformCtr.h:64
const CloneBase * GetCloneBase() const
Gets the CloneBase this object is registered to.
Definition: clone_CloneElementBase.h:77
bool IsRegisteredWithProtocol() const
Determines whether the object is registered with CloneProtocol.
nn::Result SetProfiler(CloneProfilerBase *pSendProfiler, CloneProfilerBase *pReceiveProfiler)
Sets an object to manage send/receive profiling.
bool IsReadyToSetValue() const
Determines whether a value can be set.
virtual ~CloneElementBase()
Destroys the object.
const CloneProfilerBase * GetReceiveProfiler() const
Gets the object configured to manage receive profiling.
Definition: clone_CloneElementBase.h:150
u32 GetProfiledTotalSendCount(StationIndex stationIndex) const
Gets the number of times sent since ResetProfiler was called.
bool IsRegisteredWithCloneBase() const
Determines whether the object is registered with CloneBase.
Definition: clone_CloneElementBase.h:94
u32 GetProfiledLatestReceiveCount(StationIndex stationIndex) const
Gets the receive count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispat...
u16 Id
Specifies the type of the ID for identifying clone elements.
Definition: clone_CloneElementBase.h:59
const CloneProtocol * GetProtocol() const
Gets the CloneProtocol of the CloneBase this object is registered to.
Id GetId() const
Gets the ID.
Definition: clone_CloneElementBase.h:67