1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #pragma once
- #include <iostream>
- #include <memory>
- #include <string>
- #include <conio.h>
- #include <grpcpp/grpcpp.h>
- #include <grpc/grpc.h>
- #include <grpc++/channel.h>
- #include <grpc++/client_context.h>
- #include <grpc++/create_channel.h>
- #include "../pb/protobuf.grpc.pb.h"
- #include "opencv2/opencv.hpp"
- using grpc::Status;
- using grpc::Channel;
- using grpc::ClientContext;
- using grpc::ClientWriter;
- using grpc::ClientReader;
- using grpc::ClientReaderWriter;
- using namespace_uploadpic::Request;
- using namespace_uploadpic::Response;
- using namespace namespace_uploadpic;
- using grpc::ClientContext;
- class VisionClient;
- class rpcClient
- {
- public:
- //构造函数,创建一个频道,用于指向服务器
- rpcClient(std::shared_ptr<Channel>channl) :stu_(upload_pic_servicer::NewStub(channl)) {}
- bool upload(cv::Mat img ,std::string user, std::string id );
- void ListFeatures();
- int getClientTime();
- int getServerTime();
- private:
- //这个是远程方法(API)的一个指针
- std::unique_ptr<upload_pic_servicer::Stub>stu_;
- int m_nClientTime = 0;
- int m_nServerTime = 0;
- };
|