25 lines
686 B
C++
25 lines
686 B
C++
|
#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;
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
}
|