40 lines
830 B
C++
40 lines
830 B
C++
//
|
|
// Created by dongl on 23-4-21.
|
|
//
|
|
|
|
#ifndef IM2_ANALYSIS_H
|
|
#define IM2_ANALYSIS_H
|
|
|
|
#include <any>
|
|
#include <variant>
|
|
#include "proto/mp.request.pb.h"
|
|
#include "agreement.h"
|
|
|
|
|
|
class analysis {
|
|
public:
|
|
analysis(std::shared_ptr<mp::mph>& mph, char* data) : m_mph(mph), m_data(data) {
|
|
|
|
}
|
|
|
|
std::shared_ptr<agreement_request> operator () (bufferevent* bev, sockaddr_in* addr) {
|
|
// agreement_request
|
|
auto agreementRequest = std::make_shared<agreement_request>(agreement_request());
|
|
|
|
// request
|
|
auto request = std::make_shared<mp::request>(mp::request());
|
|
|
|
request->ParseFromString(m_data);
|
|
agreementRequest->set(m_mph, request, bev, addr);
|
|
|
|
return agreementRequest;
|
|
}
|
|
private:
|
|
std::shared_ptr<mp::mph> m_mph;
|
|
char* m_data;
|
|
};
|
|
|
|
|
|
|
|
#endif //IM2_ANALYSIS_H
|