#include #include "spir.hpp" #include "spir_ffi.h" void SPIR::init(uint32_t num_threads) { spir_init(num_threads); } SPIR_Client::SPIR_Client(uint8_t r, string &pub_params) { ClientNewRet ret = spir_client_new(r); pub_params.assign(ret.pub_params.data, ret.pub_params.len); spir_vecdata_free(ret.pub_params); this->client = ret.client; } SPIR_Client::~SPIR_Client() { spir_client_free(this->client); } string SPIR_Client::preproc_PIRs(uint32_t num_preproc) { VecData msg = spir_client_preproc_PIRs(this->client, num_preproc); string ret(msg.data, msg.len); spir_vecdata_free(msg); return ret; } SPIR_Server::SPIR_Server(uint8_t r, const string &pub_params) { this->server = spir_server_new(r, pub_params.data(), pub_params.length()); } SPIR_Server::~SPIR_Server() { spir_server_free(this->server); } string SPIR_Server::preproc_PIRs(const string &msg) { VecData retmsg = spir_server_preproc_PIRs(this->server, msg.data(), msg.length()); string ret(retmsg.data, retmsg.len); spir_vecdata_free(retmsg); return ret; }