CTR Pia  4.11.3
Game Communication Engine
clone_CloneBase.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: clone_CloneBase.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/clone/clone_definitions.h>
18 #include <pia/clone/clone_CloneElementBase.h>
19 #include <pia/common/common_TreeMapNode.h>
20 #include <pia/common/common_OffsetTreeMap.h>
21 #include <pia/common/common_OffsetList.h>
22 
23 namespace nn
24 {
25 namespace pia
26 {
27 namespace clone
28 {
29 
30 class CloneProtocol;
31 
32 /*!
33 @brief This is the base class for managing sending and receiving.
34 @date 2013-11-25 Added a profiling feature.
35 @date 2013-07-18 Initial version.
36 
37 */
38 class CloneBase
39 {
40 public:
41 protected:
42 /*!
43 @brief Instantiates the object with default parameters (default constructor).
44 */
45  CloneBase();
46 
47 
48 public:
49 /*!
50 @brief Destroys the object.
51 */
52  virtual ~CloneBase();
53 
54 
55 /*!
56 @brief Gets the <tt>CloneProtocol</tt> this object is registered to.
57 @return Returns the <tt>CloneProtocol</tt> this object is registered to.
58 */
59  const CloneProtocol* GetProtocol() const
60  {
61  return m_pProtocol;
62  }
63 
64 
65 /*!
66 @brief Specifies the type of the ID for identifying clones.
67 */
68  typedef u32 Id;
69 
70 
71 /*!
72 @brief Gets the ID.
73 @return Returns the ID specified when registering the object with <tt>CloneProtocol</tt>. Returns <tt>0</tt> if not registered with <tt>CloneProtocol</tt>.
74 */
75  Id GetId() const
76  {
77  return static_cast<Id>(m_TreeMapNode.GetKey() & 0xffffffff);
78  }
79 
80 
81 /*!
82 @brief Determines whether the object is registered with <tt>CloneProtocol</tt>.
83 @return Returns <tt>true</tt> if it is registered with <tt>CloneProtocol</tt>.
84 */
86  {
87  return m_pProtocol != NULL;
88  }
89 
90 
91 /*!
92 @brief Registers a clone element.
93 @details This function must be called while the object is not registered with <tt>CloneProtocol</tt>.
94 @param[in] pElement Specifies the clone element to register.
95 @param[in] elementId Specifies the ID of the clone element to register.
96 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds.
97 @retval ResultInvalidState Indicates that this object is already registered with <tt>CloneProtocol</tt>. Programming error. Fix your program so that this error is not returned.
98 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
99 @retval ResultAlreadyExists Indicates that a clone element is already registered to the specified ID. Programming error. Fix your program so that this error is not returned.
100 */
101  nn::Result RegisterElement(CloneElementBase* pElement, CloneElementBase::Id elementId);
102 
103 
104 /*!
105 @brief Unregisters a clone element.
106 @details This function must be called while the object is not registered with <tt>CloneProtocol</tt>.
107 @param[in] pElement Specifies the clone element to unregister.
108 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
109 @retval ResultInvalidState Indicates that this object is already registered with <tt>CloneProtocol</tt>. Programming error. Fix your program so that this error is not returned.
110 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
111 */
112  nn::Result UnregisterElement(CloneElementBase* pElement);
113 
114 
115 /*!
116 @brief Unregisters a clone element.
117 @details This function must be called while the object is not registered with <tt>CloneProtocol</tt>.
118 @param[in] elementId Specifies the ID of the clone element to unregister.
119 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
120 @retval ResultInvalidState Indicates that this object is already registered with <tt>CloneProtocol</tt>. Programming error. Fix your program so that this error is not returned.
121 @retval ResultNotSet Indicates that a clone element is not registered to the specified ID. Programming error. Fix your program so that this error is not returned.
122 */
123  nn::Result UnregisterElement(CloneElementBase::Id elementId);
124 
125 
126 /*!
127 @brief Searches for the clone element of the specified ID.
128 @param[in] elementId Specifies the clone element to search for.
129 @return Returns the clone element with the specified ID. Returns <tt>NULL</tt> if it does not exist.
130 */
132  {
133  return m_ElementCollection.Find(elementId);
134  }
135 
136 
137 /*!
138 @brief Searches for the clone element of the specified ID.
139 @param[in] elementId Specifies the clone element to search for.
140 @return Returns the clone element with the specified ID. Returns <tt>NULL</tt> if it does not exist.
141 */
143  {
144  return m_ElementCollection.Find(elementId);
145  }
146 
147 
148 /*!
149 @brief Determines whether this object is active.
150 @details An object is treated as active when it is registered with <tt>CloneProtocol</tt> and can actually send and receive data.
151 An object is not active when it is in the process of being registered or unregistered with <tt>CloneProtocol</tt>, or when <tt>CloneProtocol</tt> is starting up or being finalized.
152 @return Returns <tt>true</tt> if active.
153 */
154  bool IsActive() const
155  {
156  return (m_State == STATE_ACTIVE);
157  }
158 
159 
160  //! @name Profiling
161  //! @{
162 
163 /*!
164 @brief Sets an object to manage send/receive profiling.
165 @details Send/receive tasks carried out by registered clone elements and clones themselves can be profiled by configuring <tt>CloneProfiler</tt>.
166 This calculation includes all exchanges of data between this clone and other clones, so the data exchanges between clones on the local station are also included in the value.
167 @details When multiple clone elements are sending data at the same time, it gets calculated on a per-clone basis. In most cases, the total send/receive count of the clones is less than that of the clone elements.
168 @details When compression is enabled, the compressed size is used in the calculation.
169 For this reason, calculations may result in a value that is small relative to the total amount of data sent or received that was measured for registered clone elements.
170 @details A <tt>CloneProfiler</tt> instance that is already configured can be released by specifying <tt>NULL</tt> in the arguments.
171 @param[in] pSendProfiler Specifies the <tt>CloneProfiler</tt> that manages the send profiling.
172 Specify <tt>NULL</tt> if not necessary.
173 @param[in] pReceiveProfiler Specifies the <tt>CloneProfiler</tt> that manages the receive profiling.
174 Specify <tt>NULL</tt> if not necessary.
175 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
176 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
177 
178 
179 */
180  nn::Result SetProfiler(CloneProfilerBase* pSendProfiler, CloneProfilerBase* pReceiveProfiler);
181 
182 
183 /*!
184 @brief Gets the object configured to manage send profiling.
185 @return The object configured to manage send profiling. Returns <tt>NULL</tt> if nothing has been set.
186 @see SetProfiler
187 */
189  {
190  return m_pSendProfiler;
191  }
192 
193 
194 /*!
195 @brief Gets the object configured to manage receive profiling.
196 @return The object configured to manage receive profiling. Returns <tt>NULL</tt> if nothing has been set.
197 @see SetProfiler
198 */
200  {
201  return m_pReceiveProfiler;
202  }
203 
204 
205 /*!
206 @brief Resets the results of send/receive profiling.
207 @see SetProfiler
208 */
209  void ResetProfiler();
210 
211 
212 /*!
213 @brief Gets the send count for the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times <tt>common::Scheduler::Dispatch</tt> was called.
214 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
215 @return The send count for the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times <tt>common::Scheduler::Dispatch</tt> was called.
216 Returns <tt>0</tt> if no object is configured to manage send profiling.
217 @see SetProfiler
218 */
219  u32 GetProfiledLatestSendCount(StationIndex stationIndex) const;
220 
221 
222 /*!
223 @brief Gets the total amount of data, in bytes, sent during the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times of <tt>common::Scheduler::Dispatch</tt> being called.
224 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
225 @return The total amount of data, in bytes, sent during the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times of <tt>common::Scheduler::Dispatch</tt> being called.
226 Returns <tt>0</tt> if no object is configured to manage send profiling.
227 @see SetProfiler
228 */
229  u32 GetProfiledLatestSendSize(StationIndex stationIndex) const;
230 
231 
232 /*!
233 @brief Gets the number of times sent since <tt>ResetProfiler</tt> was called.
234 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
235 @return The number of times sent since <tt>ResetProfiler</tt> was called.
236 Returns <tt>0</tt> if no object is configured to manage send profiling.
237 @see SetProfiler, ResetProfiler
238 */
239  u32 GetProfiledTotalSendCount(StationIndex stationIndex) const;
240 
241 
242 /*!
243 @brief Gets the amount of data, in bytes, sent since <tt>ResetProfiler</tt> was called.
244 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
245 @return The amount of data, in bytes, sent since <tt>ResetProfiler</tt> was called.
246 Returns <tt>0</tt> if no object is configured to manage send profiling.
247 @see SetProfiler, ResetProfiler
248 */
249  u32 GetProfiledTotalSendSize(StationIndex stationIndex) const;
250 
251 
252 /*!
253 @brief Gets the receive count for the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times <tt>common::Scheduler::Dispatch</tt> was called.
254 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
255 @return The receive count for the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times <tt>common::Scheduler::Dispatch</tt> was called.
256 Returns <tt>0</tt> if no object is configured to manage receive profiling.
257 @see SetProfiler
258 */
259  u32 GetProfiledLatestReceiveCount(StationIndex stationIndex) const;
260 
261 
262 /*!
263 @brief Gets the total amount of data, in bytes, received during the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times of <tt>common::Scheduler::Dispatch</tt> being called.
264 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
265 @return The total amount of data, in bytes, received during the last <tt>@ref CloneProfiler "CloneProfiler::LATEST_BUFFER_SIZE"</tt> times of <tt>common::Scheduler::Dispatch</tt> being called.
266 Returns <tt>0</tt> if no object is configured to manage receive profiling.
267 @see SetProfiler
268 */
269  u32 GetProfiledLatestReceiveSize(StationIndex stationIndex) const;
270 
271 
272 /*!
273 @brief Gets the number of times received since <tt>ResetProfiler</tt> was called.
274 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
275 @return The number of times received since <tt>ResetProfiler</tt> was called.
276 Returns <tt>0</tt> if no object is configured to manage receive profiling.
277 @see SetProfiler, ResetProfiler
278 */
279  u32 GetProfiledTotalReceiveCount(StationIndex stationIndex) const;
280 
281 
282 /*!
283 @brief Gets the amount of data, in bytes, received since <tt>ResetProfiler</tt> was called.
284 @param[in] stationIndex The <tt>StationIndex</tt> that is subject to profiling.
285 @return The amount of data, in bytes, received since <tt>ResetProfiler</tt> was called.
286 Returns <tt>0</tt> if no object is configured to manage receive profiling.
287 @see SetProfiler, ResetProfiler
288 */
289  u32 GetProfiledTotalReceiveSize(StationIndex stationIndex) const;
290 
291  //! @}
292 
293  virtual void Trace(u64 flag) const;
294 
295  //! @cond PRIVATE
296 
297 public:
298  enum Type
299  {
300  TYPE_SEND = 0x01,
301  TYPE_RECEIVE = 0x02,
302  TYPE_ATOMIC = 0x03,
303  TYPE_SEQUENTIAL = 0x04
304  };
305 
306  virtual Type GetTypeVirtual() const = 0;
307 
308 
309  typedef u64 Key;
310 
311 
312  static s32 GetTreeMapNodeOffset()
313  {
314  return offsetof(CloneBase, m_TreeMapNode);
315  }
316 
317  void UnregisterElementForce(CloneElementBase* pElement);
318 
319  bool CheckElementSize(size_t sizeMax);
320  void AttachProtocol(CloneProtocol* pProtocol);
321  void DetachProtocol();
322 
323  Type GetType() const
324  {
325  return static_cast<Type>(m_TreeMapNode.GetKey() >> 48);
326  }
327  StationIndex GetStationIndex() const
328  {
329  return static_cast<StationIndex>((m_TreeMapNode.GetKey() >> 32) & 0xff);
330  }
331  Key GetKey() const
332  {
333  return m_TreeMapNode.GetKey();
334  }
335  static Key ToKey(Type type, StationIndex stationId, Id id)
336  {
337  return (static_cast<u64>(type) << 48) | (static_cast<u64>(stationId) << 32) | id;
338  }
339 
340 
341  enum State
342  {
343  STATE_INACTIVE = 0,
344  STATE_ACTIVE,
345  STATE_COMPLETE,
346  STATE_ENDING,
347  STATE_ENDED,
348  STATE_COMPLETE_FOR_UNREGISTER,
349  STATE_ENDING_FOR_UNREGISTER,
350  STATE_ENDED_FOR_UNREGISTER
351  };
352 
353  State GetState() const
354  {
355  return m_State;
356  }
357 
358  CloneProfilerBase* GetSendProfilerPtr()
359  {
360  return m_pSendProfiler;
361  }
362  CloneProfilerBase* GetReceiveProfilerPtr()
363  {
364  return m_pReceiveProfiler;
365  }
366 
367 public:
368  void Startup();
369  void Cleanup();
370  void End();
371  void Unregister();
372  void ClearData();
373 
374  void Enter(StationIndex stationId)
375  {
376  OnEnter(stationId);
377  }
378  void Exit(StationIndex stationId)
379  {
380  OnExit(stationId);
381  }
382  void Disconnect(StationIndex stationId, bool isValid)
383  {
384  OnDisconnect(stationId, isValid);
385  }
386 
387  void UpdateState();
388  bool IsReceiveData() const
389  {
390  return m_State != STATE_INACTIVE;
391  }
392 
393  bool IsSendingData(StationIndex stationId, bool isDebug = false) const;
394 
395 protected:
396  virtual void OnStartup()
397  {
398  }
399  virtual void OnCleanup()
400  {
401  }
402  virtual void OnEnd()
403  {
404  }
405  virtual void OnComplete()
406  {
407  }
408  virtual bool OnCheckEnd()
409  {
410  return true;
411  }
412 
413  virtual void OnEnter(StationIndex stationId)
414  {
415  (void)stationId;
416  }
417  virtual void OnExit(StationIndex stationId)
418  {
419  (void)stationId;
420  }
421  virtual void OnDisconnect(StationIndex stationId, bool isValid)
422  {
423  (void)stationId;
424  (void)isValid;
425  }
426  virtual void OnRegister()
427  {
428  }
429 
430 public:
431  virtual bool IsReadyToSetValue() const
432  {
433  return false;
434  }
435  virtual u32 GetDestBitmap() const = 0;
436  virtual bool IsInRequest() const
437  {
438  return false;
439  }
440 
441  virtual u8 GetLocalRegisterCount() const
442  {
443  return 0;
444  }
445  virtual u64 GetRegisterCountAll() const
446  {
447  return 0;
448  }
449  virtual bool IsMatchLocalRegisterCount(u64 registerCountAll) const
450  {
451  NN_PIA_DUMMY_PARAM(registerCountAll);
452  return true;
453  }
454 
455  void AddSendData(CloneElementBase::ISendToken* pToken);
456  void AddSendDelayData(CloneElementBase::ResendableSendToken* pToken);
457  void CancelSendData(CloneElementBase::ISendToken* pToken);
458  void ErrorDropEvent();
459 
460 
461 private:
462  typedef common::OffsetList<CloneElementBase::ISendToken> SendDataList;
463  typedef common::OffsetList<CloneElementBase::ResendableSendToken> ResendableDataList;
464 
465 public:
466  class DataTokenAccessor
467  {
468  public:
469  DataTokenAccessor(CloneBase* pClone, SystemTime time, SystemTime resendSpan, SystemTime maxSendDelay, bool isUnicast, StationIndex stationIndex);
470  CloneElementBase::ISendToken* Get() const
471  {
472  return m_pToken;
473  }
474  void Reset(bool isUnicast, StationIndex stationIndex, SystemTime resendSpan);
475  void Next();
476  void Commit(u32 dispatchCount, u32 destBitmap);
477 
478  private:
479  void NextToken(bool isFirst);
480  void NextUnicastToken();
481 
482  private:
483  CloneBase* m_pClone;
484  SystemTime m_Time;
485  SystemTime m_ResendSpan;
486  SystemTime m_MaxSendDelay;
487  CloneElementBase::ISendToken* m_pToken;
488  bool m_IsUnicast;
489  StationIndex m_TargetStationIndex;
490  u32 m_TargetBitmap;
491 
492  enum ListState
493  {
494  eLSFirst,
495  eLSResend,
496  eLSDeferment,
497  eLSEnd,
498  eLSNoData,
499  eLSComitted
500  };
501  ListState m_ListState;
502  };
503 
504 protected:
505  void AddDataDest(StationIndex stationId);
506  void RemoveDataDest(StationIndex stationId);
507  void AddDataParticipant(StationIndex stationId);
508  void ComplementData(StationIndex stationId);
509  void LockData();
510 
511 public:
512  enum CommandType
513  {
514  COMMAND_ANNOUNCE,
515  COMMAND_REQUEST,
516  COMMAND_END,
517  COMMAND_LOCK
518  };
519 
520  enum
521  {
522  INVALID_COMMAND_INDEX = 0
523  };
524 
525  class CommandToken
526  {
527  protected:
528  explicit CommandToken(CloneBase* pClone)
529  : m_ListNode(), m_pClone(pClone), m_LastSendTime(INVALID_SYSTEM_TIME)
530  {
531  }
532 
533  public:
534  bool IsInList() const
535  {
536  return m_ListNode.IsFreeListNode() == false;
537  }
538  virtual CommandType GetType() const = 0;
539  virtual u32 GetDestStationBitmap() const = 0;
540  Id GetCloneId() const
541  {
542  return m_pClone->GetId();
543  }
544  SystemTime GetLastSendTime(StationIndex stationIndex) const
545  {
546  if (stationIndex == STATION_INDEX_INVALID)
547  {
548  return m_LastSendTime;
549  }
550  else
551  {
552  PIA_ASSERT(IsUnicast());
553  PIA_ASSERT(stationIndex < MAX_STATION_NUM);
554  return m_LastSendTimeArray[stationIndex];
555  }
556  }
557  void SetLastSendTime(SystemTime time, StationIndex stationIndex)
558  {
559  if (stationIndex == STATION_INDEX_INVALID)
560  {
561  m_LastSendTime = time;
562  }
563  else
564  {
565  PIA_ASSERT(IsUnicast());
566  PIA_ASSERT(stationIndex < MAX_STATION_NUM);
567  m_LastSendTimeArray[stationIndex] = time;
568  }
569  }
570  const CloneBase* GetClone() const
571  {
572  return m_pClone;
573  }
574  static s32 GetListNodeOffset()
575  {
576  return offsetof(CommandToken, m_ListNode);
577  }
578  CloneBase* GetClonePtr()
579  {
580  return m_pClone;
581  }
582  // Overridden to return <tt>true</tt> in token classes that resend using unicast.
583  virtual bool IsUnicast() const
584  {
585  return false;
586  }
587 
588  private:
589  common::ListNode m_ListNode;
590  CloneBase* m_pClone;
591  SystemTime m_LastSendTime;
592  SystemTime m_LastSendTimeArray[MAX_STATION_NUM];
593  };
594 
595 
596  class ClockCommandToken : public CommandToken
597  {
598  protected:
599  ClockCommandToken(CloneBase* pClone)
600  : CommandToken(pClone)
601  {
602  }
603 
604  public:
605  virtual ClockValue GetClock() const = 0;
606  };
607 
608 
609  class DataToken
610  {
611  public:
612  explicit DataToken(CloneBase* pClone)
613  : m_ListNode(), m_pClone(pClone)
614  {
615  }
616  bool IsInList() const
617  {
618  return m_ListNode.IsFreeListNode() == false;
619  }
620  CloneBase* GetClone()
621  {
622  return m_pClone;
623  }
624  bool CheckEraseFromList() const
625  {
626  return m_pClone->IsSendDataEmpty();
627  }
628  static s32 GetListNodeOffset()
629  {
630  return offsetof(DataToken, m_ListNode);
631  }
632 
633  private:
634  common::ListNode m_ListNode;
635  CloneBase* m_pClone;
636  };
637 
638 
639 private:
640  // Copying is prohibited.
641  CloneBase(const CloneBase& rhs);
642  CloneBase& operator=(const CloneBase& rhs);
643 
644 
645 protected:
646  CloneProtocol* GetProtocolPtr()
647  {
648  return m_pProtocol;
649  }
650 
651  void RequestInitialData();
652 
653 
654 protected:
655  bool IsSendDataEmpty() const
656  {
657  return m_SendDataList.IsEmpty() && m_SendDelayDataList.IsEmpty() && m_ResendDataList.IsEmpty();
658  }
659 
660 private:
661  common::TreeMapNode<Key> m_TreeMapNode;
662  CloneProtocol* m_pProtocol;
663 
664  State m_State;
665 
666  typedef common::OffsetTreeMap<CloneElementBase::Id, CloneElementBase> ElementCollection;
667  ElementCollection m_ElementCollection;
668 
669 
670  SendDataList m_SendDataList;
671  ResendableDataList m_ResendDataList;
672  ResendableDataList m_SendDelayDataList;
673 
674  DataToken m_DataToken;
675 
676 private:
677  CloneProfilerBase* m_pSendProfiler;
678  CloneProfilerBase* m_pReceiveProfiler;
679 
680 public:
681  template <int TEST_ID, typename Arg>
682  static void Test(const CloneBase& obj, Arg* pArg = NULL);
683 
684 private:
685  // n2920: For the client-monitoring feature.
686  void SetElementNumToMonitoringData();
687  //! @endcond
688 };
689 }
690 }
691 } // end of namespace nn::pia::clone
u32 GetProfiledTotalReceiveCount(StationIndex stationIndex) const
Gets the number of times received since ResetProfiler was called.
u32 GetProfiledLatestSendCount(StationIndex stationIndex) const
Gets the send count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch ...
This is the base class for managing data that is sent and received. .
Definition: clone_CloneElementBase.h:40
u32 GetProfiledTotalSendCount(StationIndex stationIndex) const
Gets the number of times sent since ResetProfiler was called.
const CloneElementBase * SearchElement(CloneElementBase::Id elementId) const
Searches for the clone element of the specified ID.
Definition: clone_CloneBase.h:142
u32 ClockValue
Defines a type that holds a clock value.
Definition: clone_definitions.h:44
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
bool IsRegisteredWithProtocol() const
Determines whether the object is registered with CloneProtocol.
Definition: clone_CloneBase.h:85
Definition: assert.h:115
const CloneProfilerBase * GetSendProfiler() const
Gets the object configured to manage send profiling.
Definition: clone_CloneBase.h:188
ID indicating a station that is not present in the session.
Definition: platformCtr.h:59
Id GetId() const
Gets the ID.
Definition: clone_CloneBase.h:75
u32 GetProfiledLatestReceiveCount(StationIndex stationIndex) const
Gets the receive count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispat...
nn::Result RegisterElement(CloneElementBase *pElement, CloneElementBase::Id elementId)
Registers a clone element.
Represents a protocol for sharing values between stations.
Definition: clone_CloneProtocol.h:51
u32 GetProfiledTotalReceiveSize(StationIndex stationIndex) const
Gets the amount of data, in bytes, received since ResetProfiler was called.
bool IsActive() const
Determines whether this object is active.
Definition: clone_CloneBase.h:154
u32 GetProfiledTotalSendSize(StationIndex stationIndex) const
Gets the amount of data, in bytes, sent since ResetProfiler was called.
This base class manages PiaClone profiling.
Definition: clone_CloneProfilerBase.h:33
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
CloneElementBase * SearchElement(CloneElementBase::Id elementId)
Searches for the clone element of the specified ID.
Definition: clone_CloneBase.h:131
u32 GetProfiledLatestReceiveSize(StationIndex stationIndex) const
Gets the total amount of data, in bytes, received during the last CloneProfiler::LATEST_BUFFER_SIZE t...
virtual ~CloneBase()
Destroys the object.
nn::Result UnregisterElement(CloneElementBase *pElement)
Unregisters a clone element.
u32 GetProfiledLatestSendSize(StationIndex stationIndex) const
Gets the total amount of data, in bytes, sent during the last CloneProfiler::LATEST_BUFFER_SIZE times...
const CloneProfilerBase * GetReceiveProfiler() const
Gets the object configured to manage receive profiling.
Definition: clone_CloneBase.h:199
nn::Result SetProfiler(CloneProfilerBase *pSendProfiler, CloneProfilerBase *pReceiveProfiler)
Sets an object to manage send/receive profiling.
u32 Id
Specifies the type of the ID for identifying clones.
Definition: clone_CloneBase.h:68
const CloneProtocol * GetProtocol() const
Gets the CloneProtocol this object is registered to.
Definition: clone_CloneBase.h:59
void ResetProfiler()
Resets the results of send/receive profiling.
u16 Id
Specifies the type of the ID for identifying clone elements.
Definition: clone_CloneElementBase.h:59