16 #include <nn/pia/clone/clone_Definitions.h>
17 #include <nn/pia/common/common_TreeMapNode.h>
18 #include <nn/pia/common/common_ListNode.h>
31 class CloneProfilerBase;
65 return m_TreeMapNode.GetKey();
101 return m_pCloneBase != NULL;
146 return m_pSendProfiler;
157 return m_pReceiveProfiler;
432 static int32_t GetTreeMapNodeOffset()
434 NN_PIA_PRAGMA_PUSH_WARNINGS
435 NN_PIA_DISABLE_WARNING_CLANG_INVALID_OFFSETOF
437 NN_PIA_PRAGMA_POP_WARNINGS
440 virtual bool IsCloneSupported(
int cloneType)
const
442 NN_PIA_UNUSED(cloneType);
445 void AttachCloneBase(CloneBase* pCloneBase);
446 void DetachCloneBase();
448 CloneProfilerBase* GetSendProfilerPtr()
450 return m_pSendProfiler;
452 CloneProfilerBase* GetReceiveProfilerPtr()
454 return m_pReceiveProfiler;
457 virtual uint32_t GetSize()
const = 0;
464 virtual void ClearData() = 0;
467 NN_PIA_UNUSED(stationIndex);
471 NN_PIA_UNUSED(stationIndex);
475 NN_PIA_UNUSED(stationIndex);
479 NN_PIA_UNUSED(stationIndex);
485 virtual void RequestInitialData()
489 uint32_t GetStationNum()
const;
499 bool IsInList()
const
501 return m_ListNode.IsFreeListNode() ==
false;
503 virtual Type GetElementType()
const = 0;
504 virtual uint32_t GetDestBitmap()
const = 0;
505 virtual bool IsResend()
const
509 virtual uint32_t GetChunkSize()
const = 0;
510 virtual void WriteChunk(
void* pChunkBuffer)
const = 0;
511 virtual CloneElementBase* GetElement() = 0;
512 static int32_t GetListNodeOffset()
514 NN_PIA_PRAGMA_PUSH_WARNINGS
515 NN_PIA_DISABLE_WARNING_CLANG_INVALID_OFFSETOF
516 return offsetof(ISendToken, m_ListNode);
517 NN_PIA_PRAGMA_POP_WARNINGS
519 virtual void TraceTokenType()
525 common::ListNode m_ListNode;
529 class ResendableSendToken :
public ISendToken
532 ResendableSendToken()
533 : ISendToken(), m_LastSendTime(InvalidSystemTime), m_SendCount(0)
537 m_LastSendTimeArray[i] = InvalidSystemTime;
538 m_SendCountArray[i] = 0;
541 virtual bool IsResend()
const
545 SystemTime GetLastSendTime(
StationIndex stationIndex)
const
549 return m_LastSendTime;
553 PIA_ASSERT(IsUnicast());
555 return m_LastSendTimeArray[stationIndex];
558 void SetLastSendTime(SystemTime time,
StationIndex stationIndex)
562 m_LastSendTime = time;
566 PIA_ASSERT(IsUnicast());
568 m_LastSendTimeArray[stationIndex] = time;
572 virtual bool IsUnicast()
const
576 void SetSendCount(uint32_t sendCount,
StationIndex stationIndex)
580 m_SendCount = sendCount;
584 PIA_ASSERT(IsUnicast());
586 m_SendCountArray[stationIndex] = sendCount;
597 PIA_ASSERT(IsUnicast());
599 ++m_SendCountArray[stationIndex];
610 PIA_ASSERT(IsUnicast());
612 return m_SendCountArray[stationIndex];
617 SystemTime m_LastSendTime;
619 uint32_t m_SendCount;
624 class ConversibleResendableSendToken :
public ResendableSendToken
627 ConversibleResendableSendToken()
628 : ResendableSendToken(), m_IsResend(false)
631 virtual bool IsResend()
const
635 void SetResend(
bool isResend)
637 m_IsResend = isResend;
645 void AddSendData(ISendToken* pToken);
646 void CancelSendData(ISendToken* pToken);
649 void ErrorEventDropped();
652 common::TreeMapNode<Id> m_TreeMapNode;
653 CloneBase* m_pCloneBase;
656 template <
typename Element,
typename CP>
662 CP::GetElementDefinition()->Register(Element::GetTypeStatic(), Element::Receive, Element::GetDataChunkHeaderSize());
666 template <
typename Element>
667 class Definition :
public DefinitionBase<Element, CloneProtocol>
671 : DefinitionBase<Element, CloneProtocol>()
677 CloneProfilerBase* m_pSendProfiler;
678 CloneProfilerBase* m_pReceiveProfiler;
681 template <
int TEST_ID,
typename Arg>
682 static void Test(
const CloneElementBase& obj, Arg* pArg = NULL);
684 NN_PIA_DISALLOW_COPY(CloneElementBase);