tinyrpc/includes/net/tinypb/tinypb_dispatcher.hpp

25 lines
686 B
C++
Raw Normal View History

2025-01-21 16:35:26 +08:00
#pragma once
#include "abstract_dispatcher.hpp"
#include <unordered_map>
#include <google/protobuf/message.h>
#include <google/protobuf/service.h>
#include <google/protobuf/descriptor.h>
namespace tinyrpc {
class TinypbDispatcher : public AbstractDispatcher {
using Service = google::protobuf::Service;
public:
TinypbDispatcher();
~TinypbDispatcher();
void dispatcher(TcpConnection& conn, AbstractData& data, AbstractData& respond) override;
bool parseServiceFullName(const std::string& name, std::string& serviceName, std::string& methodName);
private:
std::unordered_map<std::string, Service*> m_service_map;
};
}