classtk_1_1_event_hub.tex 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. \doxysection{tk::Event\+Hub$<$ Msg\+Type, Max\+Subscribers $>$ クラステンプレート}
  2. \label{classtk_1_1_event_hub}\index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  3. メッセージ型ごとの超軽量 Pub/\+\+Sub ディスパッチャ
  4. {\ttfamily \+\#include $<$actor.\+hpp$>$}
  5. \doxysubsubsection*{静的公開メンバ関数}
  6. \begin{DoxyCompactItemize}
  7. \item
  8. static bool \textbf{ subscribe} (void $\ast$actor, bool($\ast$post\+\_\+fn)(void $\ast$, const Msg\+Type \&))
  9. \begin{DoxyCompactList}\small\item\em \doxyref{Actor}{p.}{classtk_1_1_actor} をこのメッセージ型の購読者として登録します \end{DoxyCompactList}\item
  10. static bool \textbf{ unsubscribe} (void $\ast$actor)
  11. \begin{DoxyCompactList}\small\item\em \doxyref{Actor}{p.}{classtk_1_1_actor} の購読登録を解除します \end{DoxyCompactList}\item
  12. static size\+\_\+t \textbf{ publish} (const Msg\+Type \&msg)
  13. \begin{DoxyCompactList}\small\item\em このメッセージ型を購読しているすべての \doxyref{Actor}{p.}{classtk_1_1_actor} へ同報配信します \end{DoxyCompactList}\item
  14. static size\+\_\+t \textbf{ subscriber\+\_\+count} ()
  15. \end{DoxyCompactItemize}
  16. \doxysubsection{詳解}
  17. \subsubsection*{template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$\newline
  18. class tk::\+\+Event\+Hub$<$ Msg\+Type, Max\+Subscribers $>$}
  19. メッセージ型ごとの超軽量 Pub/\+\+Sub ディスパッチャ
  20. テンプレート引数 {\ttfamily Msg\+Type} ごとにコンパイル時解決される静的レジストリです。 実行時の型検索オーバーヘッドゼロ、動的メモリ確保ゼロで動作します。
  21. \begin{DoxyTemplParams}{テンプレート引数}
  22. {\em Msg\+Type} & 配信するメッセージの型 \\
  23. \hline
  24. {\em Max\+Subscribers} & 同一メッセージ型を購読できる最大 \doxyref{Actor}{p.}{classtk_1_1_actor} 数 (デフォルト: 4) \\
  25. \hline
  26. \end{DoxyTemplParams}
  27. \label{classtk_1_1_event_hub_doc-func-members}
  28. \doxysubsection{関数詳解}
  29. \index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!publish@{publish}}
  30. \index{publish@{publish}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  31. \doxysubsubsection{publish()}
  32. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_a3a59a641ad3fe121c0da7e1c81dc300b}
  33. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  34. size\+\_\+t \textbf{ tk::\+\+Event\+Hub}$<$ Msg\+Type, Max\+Subscribers $>$::\+publish (\begin{DoxyParamCaption}\item[{const Msg\+Type \&}]{msg}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  35. このメッセージ型を購読しているすべての \doxyref{Actor}{p.}{classtk_1_1_actor} へ同報配信します
  36. \begin{DoxyParams}{引数}
  37. {\em msg} & 配信するメッセージ実体 (各 \doxyref{Actor}{p.}{classtk_1_1_actor} のキューへ値コピー) \\
  38. \hline
  39. \end{DoxyParams}
  40. \begin{DoxyReturn}{戻り値}
  41. size\+\_\+t 配信に成功した \doxyref{Actor}{p.}{classtk_1_1_actor} の数
  42. \end{DoxyReturn}
  43. \index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!subscribe@{subscribe}}
  44. \index{subscribe@{subscribe}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  45. \doxysubsubsection{subscribe()}
  46. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_a50ebe29eaa2657604a1c85bf5125d490}
  47. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  48. bool \textbf{ tk::\+\+Event\+Hub}$<$ Msg\+Type, Max\+Subscribers $>$::\+subscribe (\begin{DoxyParamCaption}\item[{void $\ast$}]{actor}{, }\item[{bool($\ast$}]{post\+\_\+fn~}{)(void $\ast$, const Msg\+Type \&)}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  49. \doxyref{Actor}{p.}{classtk_1_1_actor} をこのメッセージ型の購読者として登録します
  50. \begin{DoxyParams}{引数}
  51. {\em actor} & \doxyref{Actor}{p.}{classtk_1_1_actor} インスタンスポインタ \\
  52. \hline
  53. {\em post\+\_\+fn} & メッセージ投入関数ポインタ \\
  54. \hline
  55. \end{DoxyParams}
  56. \begin{DoxyReturn}{戻り値}
  57. true 登録成功, false 購読者上限に達した
  58. \end{DoxyReturn}
  59. \index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!subscriber\_count@{subscriber\_count}}
  60. \index{subscriber\_count@{subscriber\_count}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  61. \doxysubsubsection{subscriber\_count()}
  62. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_ac4cd6ce4e37b74385c7f4352a5516930}
  63. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  64. size\+\_\+t \textbf{ tk::\+\+Event\+Hub}$<$ Msg\+Type, Max\+Subscribers $>$::\+subscriber\+\_\+count (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  65. 現在の購読者数を取得 \index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!unsubscribe@{unsubscribe}}
  66. \index{unsubscribe@{unsubscribe}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  67. \doxysubsubsection{unsubscribe()}
  68. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_a09c779ce8c594ea44c831adfd7e287f8}
  69. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  70. bool \textbf{ tk::\+\+Event\+Hub}$<$ Msg\+Type, Max\+Subscribers $>$::\+unsubscribe (\begin{DoxyParamCaption}\item[{void $\ast$}]{actor}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  71. \doxyref{Actor}{p.}{classtk_1_1_actor} の購読登録を解除します
  72. \begin{DoxyParams}{引数}
  73. {\em actor} & 解除する \doxyref{Actor}{p.}{classtk_1_1_actor} インスタンスポインタ \\
  74. \hline
  75. \end{DoxyParams}
  76. \begin{DoxyReturn}{戻り値}
  77. true 解除成功, false 未登録
  78. \end{DoxyReturn}
  79. このクラス詳解は次のファイルから抽出されました:\begin{DoxyCompactItemize}
  80. \item
  81. C:\+/\+\+Users/\+yoneda/\+\+Documents/\+\+Pico\+\_\+\+Projects/\+tinykernel/\+tinykernel/\+include/\+tinykernel/\textbf{ actor.\+hpp}\end{DoxyCompactItemize}