Ferenc Szontágh
2024-06-25 e5f77bce96abea49d65ff25e41c9ce2dae01c8dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef IPC_H
#define IPC_H
 
#include <msgpack.h>
#include <optional>
#include <queue>
#include <mutex>
#include <condition_variable>
#include "Command.h"
#include "PluginInterface.h"
 
class IPC {
public:
    IPC();
    void registerHandler(std::shared_ptr<IPlugin> handler);
    void sendMessage(const Command& cmd);
    std::optional<Command> receiveMessage();
 
private:
    std::queue<Command> messageQueue;
    std::mutex queueMutex;
    std::condition_variable queueCondVar;
    std::vector<std::shared_ptr<IPlugin>> handlers;
};
 
#endif // IPC_H