tk::EventHub actor.hpp tk::EventHub::Subscriber typename MsgType size_t MaxSubscribers MaxSubscribers 4 Subscriber Subscriber tk::EventHub< MsgType, MaxSubscribers >::subs_[MaxSubscribers] [MaxSubscribers] subs_ tk::EventHub::subs_ {} size_t size_t tk::EventHub< MsgType, MaxSubscribers >::count_ count_ tk::EventHub::count_ {0} bool static bool tk::EventHub< MsgType, MaxSubscribers >::subscribe (void *actor, bool(*post_fn)(void *, const MsgType &)) subscribe tk::EventHub::subscribe void * actor bool(*)(void *, const MsgType &) post_fn Actor をこのメッセージ型の購読者として登録します actor Actor インスタンスポインタ post_fn メッセージ投入関数ポインタ true 登録成功, false 購読者上限に達した bool static bool tk::EventHub< MsgType, MaxSubscribers >::unsubscribe (void *actor) unsubscribe tk::EventHub::unsubscribe void * actor Actor の購読登録を解除します actor 解除する Actor インスタンスポインタ true 解除成功, false 未登録 size_t static size_t tk::EventHub< MsgType, MaxSubscribers >::publish (const MsgType &msg) publish tk::EventHub::publish const MsgType & msg このメッセージ型を購読しているすべての Actor へ同報配信します msg 配信するメッセージ実体 (各 Actor のキューへ値コピー) size_t 配信に成功した Actor の数 size_t static size_t tk::EventHub< MsgType, MaxSubscribers >::subscriber_count () subscriber_count tk::EventHub::subscriber_count 現在の購読者数を取得 メッセージ型ごとの超軽量 Pub/Sub ディスパッチャ テンプレート引数 MsgType ごとにコンパイル時解決される静的レジストリです。 実行時の型検索オーバーヘッドゼロ、動的メモリ確保ゼロで動作します。 MsgType 配信するメッセージの型 MaxSubscribers 同一メッセージ型を購読できる最大 Actor 数 (デフォルト: 4) tk::EventHubcount_ tk::EventHubpublish tk::EventHubsubs_ tk::EventHubsubscribe tk::EventHubsubscriber_count tk::EventHubunsubscribe