2017-05-22 05:54:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ipc.h"
|
|
|
|
#include "language_server_api.h"
|
|
|
|
#include "threaded_queue.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
struct IpcManager {
|
|
|
|
static IpcManager* instance_;
|
|
|
|
static IpcManager* instance();
|
|
|
|
static void CreateInstance(MultiQueueWaiter* waiter);
|
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
std::unique_ptr<ThreadedQueue<std::unique_ptr<BaseIpcMessage>>>
|
|
|
|
threaded_queue_for_client_;
|
|
|
|
std::unique_ptr<ThreadedQueue<std::unique_ptr<BaseIpcMessage>>>
|
|
|
|
threaded_queue_for_server_;
|
2017-05-22 05:54:27 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
enum class Destination { Client, Server };
|
2017-05-22 05:54:27 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
ThreadedQueue<std::unique_ptr<BaseIpcMessage>>* GetThreadedQueue(
|
|
|
|
Destination destination);
|
2017-05-22 05:54:27 +00:00
|
|
|
|
|
|
|
void SendOutMessageToClient(IpcId id, lsBaseOutMessage& response);
|
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
void SendMessage(Destination destination,
|
|
|
|
std::unique_ptr<BaseIpcMessage> message);
|
2017-05-22 05:54:27 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
std::vector<std::unique_ptr<BaseIpcMessage>> GetMessages(
|
|
|
|
Destination destination);
|
2017-05-22 05:54:27 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
private:
|
2017-05-22 05:54:27 +00:00
|
|
|
IpcManager(MultiQueueWaiter* waiter);
|
|
|
|
};
|