2024-01-04 18:35:15 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-11-14 12:35:46 +02:00
|
|
|
#include <string>
|
2024-01-04 18:35:15 +02:00
|
|
|
#include <thread>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
|
#include "MetaTraderHandler.h"
|
|
|
|
|
|
|
|
|
|
class MtServiceImpl;
|
|
|
|
|
|
|
|
|
|
class MtService
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
MtService();
|
|
|
|
|
~MtService();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static MtService& GetInstance();
|
|
|
|
|
|
|
|
|
|
void InitExpert(int port, int handle, std::unique_ptr<MetaTraderHandler> mt_handler);
|
|
|
|
|
void DeinitExpert(int handle);
|
|
|
|
|
|
|
|
|
|
void SendEvent(int handle, int event_type, const std::string& payload);
|
|
|
|
|
void SendResponse(int handle, const std::string& payload);
|
|
|
|
|
|
|
|
|
|
int GetCommandType(int handle);
|
|
|
|
|
std::string GetCommandPayload(int handle);
|
|
|
|
|
|
|
|
|
|
void LogError(const std::string& error);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::unique_ptr<MtServiceImpl> impl_;
|
|
|
|
|
};
|