|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2021 nono project
4: // Licensed under nono-license.txt
5: //
6:
1.1.1.2 ! root 7: //
! 8: // UI スレッドへのメッセージ機構 (CLI 側)
! 9: //
! 10:
1.1 root 11: #pragma once
12:
13: #include "uimessage.h"
1.1.1.2 ! root 14: #include "autofd.h"
1.1 root 15: #include <array>
16: #include <functional>
17:
18: class CUIMessage
19: {
20: using Func = std::function<void(const UIMessage&)>;
21: public:
1.1.1.2 ! root 22: // CUIMessage を初期化する
! 23: static int Init();
! 24:
1.1 root 25: // UIMessage を func に接続する
26: static void Connect(UIMessage::ID id, Func func);
27:
1.1.1.2 ! root 28: // UIMessage を処理する (VM スレッドで呼ばれる)
1.1 root 29: static void Process(UIMessage::Queue& queue);
30:
1.1.1.2 ! root 31: // UIMessage をディスパッチする (メインスレッドで呼ばれる)
! 32: static void Dispatch(const UIMessage& m);
! 33:
1.1 root 34: private:
35: static std::array<Func, UIMessage::ID_MAX> func_table;
1.1.1.2 ! root 36:
! 37: static autofd wpipe;
! 38: static autofd rpipe;
1.1 root 39: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.