Skip to content

Commit

Permalink
Add facility to register methods in C++
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Apr 16, 2015
1 parent 53a38d4 commit 62d2896
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/grpc++/channel_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ChannelInterface : public CallHook {
public:
virtual ~ChannelInterface() {}

virtual void *RegisterMethod(const char *method_name) = 0;
virtual Call CreateCall(const RpcMethod& method, ClientContext* context,
CompletionQueue* cq) = 0;
};
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/client/channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@ void Channel::PerformOpsOnCall(CallOpBuffer* buf, Call* call) {
GRPC_TIMER_MARK(PERFORM_OPS_END, call->call());
}

void *Channel::RegisterMethod(const char *method) {
return grpc_channel_register_call(c_channel_, method, target_.c_str());
}

} // namespace grpc
1 change: 1 addition & 0 deletions src/cpp/client/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Channel GRPC_FINAL : public ChannelInterface {
Channel(const grpc::string& target, grpc_channel* c_channel);
~Channel() GRPC_OVERRIDE;

virtual void *RegisterMethod(const char *method) GRPC_OVERRIDE;
virtual Call CreateCall(const RpcMethod& method, ClientContext* context,
CompletionQueue* cq) GRPC_OVERRIDE;
virtual void PerformOpsOnCall(CallOpBuffer* ops, Call* call) GRPC_OVERRIDE;
Expand Down

0 comments on commit 62d2896

Please sign in to comment.