49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#pragma once
|
||
#include <iostream>
|
||
#include <functional>
|
||
#include <cstddef>
|
||
|
||
#if defined(_WIN32)
|
||
#ifdef VR_MQSERVER_EXPORTS
|
||
#define VR_MQSERVER_API __declspec(dllexport)
|
||
#else
|
||
#define VR_MQSERVER_API __declspec(dllimport)
|
||
#pragma comment(lib, "ZeroMQServer.lib")
|
||
#endif
|
||
#else
|
||
#ifndef VR_MQSERVER_EXPORTS
|
||
#ifdef __cplusplus
|
||
#define VR_MQSERVER_API extern "C" __attribute__((visibility("default")))
|
||
#else
|
||
#define VR_MQSERVER_API __attribute__((visibility("default")))
|
||
#endif
|
||
#endif
|
||
#endif
|
||
|
||
enum MQEvent
|
||
{
|
||
MQ_EVENT_UNKOWN = 0,
|
||
MQ_EVENT_NEWLINK,
|
||
MQ_EVENT_DELINK,
|
||
};
|
||
|
||
typedef std::function<void(const MQEvent eEvent)> FunMQEvent;
|
||
typedef std::function<std::string(const char* pRecvData, const size_t nRecvLen)> FunServerRecvAndAck;
|
||
|
||
class IVrZeroMQServer
|
||
{
|
||
|
||
public:
|
||
virtual ~IVrZeroMQServer() = default;
|
||
|
||
static bool CreateObject(IVrZeroMQServer** ppMQServer);
|
||
|
||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
virtual int Init(int nPort, FunMQEvent funMQEvent, FunServerRecvAndAck funRecvAck, bool bMultitask = false) = 0;
|
||
|
||
/// <20><><EFBFBD>ٷ<EFBFBD><D9B7><EFBFBD>
|
||
virtual int UnInit() = 0;
|
||
|
||
};
|
||
|