classtk_1_1_event_hub.tex 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. \doxysection{tk::Event\+Hub\texorpdfstring{$<$}{<} Msg\+Type, Max\+Subscribers \texorpdfstring{$>$}{>} Class Template Reference}
  2. \hypertarget{classtk_1_1_event_hub}{}\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*{Static Public Member Functions}
  6. \begin{DoxyCompactItemize}
  7. \item
  8. static bool \doxymbox{\hyperlink{classtk_1_1_event_hub_a50ebe29eaa2657604a1c85bf5125d490}{subscribe}} (void \texorpdfstring{$\ast$}{*}actor, bool(\texorpdfstring{$\ast$}{*}post\+\_\+fn)(void \texorpdfstring{$\ast$}{*}, const Msg\+Type \&))
  9. \begin{DoxyCompactList}\small\item\em \doxylink{classtk_1_1_actor}{Actor} をこのメッセージ型の購読者として登録します \end{DoxyCompactList}\item
  10. static bool \doxymbox{\hyperlink{classtk_1_1_event_hub_a09c779ce8c594ea44c831adfd7e287f8}{unsubscribe}} (void \texorpdfstring{$\ast$}{*}actor)
  11. \begin{DoxyCompactList}\small\item\em \doxylink{classtk_1_1_actor}{Actor} の購読登録を解除します \end{DoxyCompactList}\item
  12. static size\+\_\+t \doxymbox{\hyperlink{classtk_1_1_event_hub_a3a59a641ad3fe121c0da7e1c81dc300b}{publish}} (const Msg\+Type \&msg)
  13. \begin{DoxyCompactList}\small\item\em このメッセージ型を購読しているすべての \doxylink{classtk_1_1_actor}{Actor} へ同報配信します \end{DoxyCompactList}\item
  14. static size\+\_\+t \doxymbox{\hyperlink{classtk_1_1_event_hub_ac4cd6ce4e37b74385c7f4352a5516930}{subscriber\+\_\+count}} ()
  15. \end{DoxyCompactItemize}
  16. \doxysubsection{Detailed Description}
  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}{Template Parameters}
  22. {\em Msg\+Type} & 配信するメッセージの型 \\
  23. \hline
  24. {\em Max\+Subscribers} & 同一メッセージ型を購読できる最大 \doxylink{classtk_1_1_actor}{Actor} 数 (デフォルト: 4) \\
  25. \hline
  26. \end{DoxyTemplParams}
  27. \label{classtk_1_1_event_hub_doc-func-members}
  28. \Hypertarget{classtk_1_1_event_hub_doc-func-members}
  29. \doxysubsection{Member Function Documentation}
  30. \Hypertarget{classtk_1_1_event_hub_a3a59a641ad3fe121c0da7e1c81dc300b}\index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!publish@{publish}}
  31. \index{publish@{publish}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  32. \doxysubsubsection{\texorpdfstring{publish()}{publish()}}
  33. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_a3a59a641ad3fe121c0da7e1c81dc300b}
  34. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  35. size\+\_\+t \doxymbox{\hyperlink{classtk_1_1_event_hub}{tk::\+\+Event\+Hub}}$<$ Msg\+Type, Max\+Subscribers $>$::\+publish (\begin{DoxyParamCaption}\item[{const Msg\+Type \&}]{msg}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  36. このメッセージ型を購読しているすべての \doxylink{classtk_1_1_actor}{Actor} へ同報配信します
  37. \begin{DoxyParams}{Parameters}
  38. {\em msg} & 配信するメッセージ実体 (各 \doxylink{classtk_1_1_actor}{Actor} のキューへ値コピー) \\
  39. \hline
  40. \end{DoxyParams}
  41. \begin{DoxyReturn}{Returns}
  42. size\+\_\+t 配信に成功した \doxylink{classtk_1_1_actor}{Actor} の数
  43. \end{DoxyReturn}
  44. \Hypertarget{classtk_1_1_event_hub_a50ebe29eaa2657604a1c85bf5125d490}\index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!subscribe@{subscribe}}
  45. \index{subscribe@{subscribe}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  46. \doxysubsubsection{\texorpdfstring{subscribe()}{subscribe()}}
  47. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_a50ebe29eaa2657604a1c85bf5125d490}
  48. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  49. bool \doxymbox{\hyperlink{classtk_1_1_event_hub}{tk::\+\+Event\+Hub}}$<$ Msg\+Type, Max\+Subscribers $>$::\+subscribe (\begin{DoxyParamCaption}\item[{void \texorpdfstring{$\ast$}{*}}]{actor}{, }\item[{bool(\texorpdfstring{$\ast$}{*}}]{post\+\_\+fn~}{)(void \texorpdfstring{$\ast$}{*}, const Msg\+Type \&)}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  50. \doxylink{classtk_1_1_actor}{Actor} をこのメッセージ型の購読者として登録します
  51. \begin{DoxyParams}{Parameters}
  52. {\em actor} & \doxylink{classtk_1_1_actor}{Actor} インスタンスポインタ \\
  53. \hline
  54. {\em post\+\_\+fn} & メッセージ投入関数ポインタ \\
  55. \hline
  56. \end{DoxyParams}
  57. \begin{DoxyReturn}{Returns}
  58. true 登録成功, false 購読者上限に達した
  59. \end{DoxyReturn}
  60. \Hypertarget{classtk_1_1_event_hub_ac4cd6ce4e37b74385c7f4352a5516930}\index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!subscriber\_count@{subscriber\_count}}
  61. \index{subscriber\_count@{subscriber\_count}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  62. \doxysubsubsection{\texorpdfstring{subscriber\_count()}{subscriber\_count()}}
  63. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_ac4cd6ce4e37b74385c7f4352a5516930}
  64. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  65. size\+\_\+t \doxymbox{\hyperlink{classtk_1_1_event_hub}{tk::\+\+Event\+Hub}}$<$ Msg\+Type, Max\+Subscribers $>$::\+subscriber\+\_\+count (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  66. 現在の購読者数を取得 \Hypertarget{classtk_1_1_event_hub_a09c779ce8c594ea44c831adfd7e287f8}\index{tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}!unsubscribe@{unsubscribe}}
  67. \index{unsubscribe@{unsubscribe}!tk::EventHub$<$ MsgType, MaxSubscribers $>$@{tk::EventHub$<$ MsgType, MaxSubscribers $>$}}
  68. \doxysubsubsection{\texorpdfstring{unsubscribe()}{unsubscribe()}}
  69. {\footnotesize\ttfamily \label{classtk_1_1_event_hub_a09c779ce8c594ea44c831adfd7e287f8}
  70. template$<$typename Msg\+Type, size\+\_\+t Max\+Subscribers = 4$>$ \\
  71. bool \doxymbox{\hyperlink{classtk_1_1_event_hub}{tk::\+\+Event\+Hub}}$<$ Msg\+Type, Max\+Subscribers $>$::\+unsubscribe (\begin{DoxyParamCaption}\item[{void \texorpdfstring{$\ast$}{*}}]{actor}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}
  72. \doxylink{classtk_1_1_actor}{Actor} の購読登録を解除します
  73. \begin{DoxyParams}{Parameters}
  74. {\em actor} & 解除する \doxylink{classtk_1_1_actor}{Actor} インスタンスポインタ \\
  75. \hline
  76. \end{DoxyParams}
  77. \begin{DoxyReturn}{Returns}
  78. true 解除成功, false 未登録
  79. \end{DoxyReturn}
  80. The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
  81. \item
  82. C:\+/\+\+Users/\+yoneda/\+\+Documents/\+\+Pico\+\_\+\+Projects/\+tinykernel/\+tinykernel/\+include/\+tinykernel/\doxymbox{\hyperlink{actor_8hpp}{actor.\+hpp}}\end{DoxyCompactItemize}