ccls/src/ipc_manager.h

35 lines
924 B
C
Raw Normal View History

#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-09-22 01:14:57 +00:00
enum class Destination { Client, Server };
2017-09-22 01:14:57 +00:00
ThreadedQueue<std::unique_ptr<BaseIpcMessage>>* GetThreadedQueue(
Destination destination);
void SendOutMessageToClient(IpcId id, lsBaseOutMessage& response);
2017-09-22 01:14:57 +00:00
void SendMessage(Destination destination,
std::unique_ptr<BaseIpcMessage> message);
2017-09-22 01:14:57 +00:00
std::vector<std::unique_ptr<BaseIpcMessage>> GetMessages(
Destination destination);
2017-09-22 01:14:57 +00:00
private:
IpcManager(MultiQueueWaiter* waiter);
};