diff options
author | Vijay Pai <vpai@google.com> | 2016-08-29 16:59:21 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-08-29 16:59:21 -0700 |
commit | d4d5f4cd53a74f7618f720bffa176b05834eb3ac (patch) | |
tree | f93489652e447801ce7442356416649801e3c6d8 /include/grpc++/impl/codegen | |
parent | a9c0d7f88b213d9a5e41808fd5d1eceaff1a034f (diff) |
clang-format
Diffstat (limited to 'include/grpc++/impl/codegen')
-rw-r--r-- | include/grpc++/impl/codegen/method_handler_impl.h | 48 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/service_type.h | 2 |
2 files changed, 31 insertions, 19 deletions
diff --git a/include/grpc++/impl/codegen/method_handler_impl.h b/include/grpc++/impl/codegen/method_handler_impl.h index 3a671fe830..ef803483ea 100644 --- a/include/grpc++/impl/codegen/method_handler_impl.h +++ b/include/grpc++/impl/codegen/method_handler_impl.h @@ -178,9 +178,8 @@ template <class Streamer, bool WriteNeeded> class TemplatedBidiStreamingHandler : public MethodHandler { public: TemplatedBidiStreamingHandler( - std::function<Status(ServerContext*, Streamer*)> - func) - : func_(func), write_needed_(WriteNeeded) {} + std::function<Status(ServerContext*, Streamer*)> func) + : func_(func), write_needed_(WriteNeeded) {} void RunHandler(const HandlerParameter& param) GRPC_FINAL { Streamer stream(param.call, param.server_context); @@ -194,10 +193,10 @@ class TemplatedBidiStreamingHandler : public MethodHandler { ops.set_compression_level(param.server_context->compression_level()); } if (write_needed_ && status.ok()) { - // If we needed a write but never did one, we need to mark the - // status as a fail - status = Status(IMPROPER_IMPLEMENTATION, - "Service did not provide response message"); + // If we needed a write but never did one, we need to mark the + // status as a fail + status = Status(IMPROPER_IMPLEMENTATION, + "Service did not provide response message"); } } ops.ServerSendStatus(param.server_context->trailing_metadata_, status); @@ -206,24 +205,37 @@ class TemplatedBidiStreamingHandler : public MethodHandler { } private: - std::function<Status(ServerContext*, Streamer*)> - func_; + std::function<Status(ServerContext*, Streamer*)> func_; const bool write_needed_; }; template <class ServiceType, class RequestType, class ResponseType> - class BidiStreamingHandler : public TemplatedBidiStreamingHandler<ServerReaderWriter<ResponseType, RequestType>, false> { +class BidiStreamingHandler + : public TemplatedBidiStreamingHandler< + ServerReaderWriter<ResponseType, RequestType>, false> { public: - BidiStreamingHandler(std::function<Status(ServiceType*, ServerContext*, - ServerReaderWriter<ResponseType,RequestType>*)> func, ServiceType* service): TemplatedBidiStreamingHandler<ServerReaderWriter<ResponseType, RequestType>,false>(std::bind(func, service, std::placeholders::_1, std::placeholders::_2)) {} - }; + BidiStreamingHandler( + std::function<Status(ServiceType*, ServerContext*, + ServerReaderWriter<ResponseType, RequestType>*)> + func, + ServiceType* service) + : TemplatedBidiStreamingHandler< + ServerReaderWriter<ResponseType, RequestType>, false>(std::bind( + func, service, std::placeholders::_1, std::placeholders::_2)) {} +}; - template <class RequestType, class ResponseType> - class StreamedUnaryHandler : public TemplatedBidiStreamingHandler<ServerUnaryStreamer<RequestType, ResponseType>, true> { +template <class RequestType, class ResponseType> +class StreamedUnaryHandler + : public TemplatedBidiStreamingHandler< + ServerUnaryStreamer<RequestType, ResponseType>, true> { public: - explicit StreamedUnaryHandler(std::function<Status(ServerContext*, - ServerUnaryStreamer<RequestType,ResponseType>*)> func): TemplatedBidiStreamingHandler<ServerUnaryStreamer<RequestType, ResponseType>, true>(func) {} - }; + explicit StreamedUnaryHandler( + std::function<Status(ServerContext*, + ServerUnaryStreamer<RequestType, ResponseType>*)> + func) + : TemplatedBidiStreamingHandler< + ServerUnaryStreamer<RequestType, ResponseType>, true>(func) {} +}; // Handle unknown method by returning UNIMPLEMENTED error. class UnknownMethodHandler : public MethodHandler { diff --git a/include/grpc++/impl/codegen/service_type.h b/include/grpc++/impl/codegen/service_type.h index 9d2a80cbc4..72b2225312 100644 --- a/include/grpc++/impl/codegen/service_type.h +++ b/include/grpc++/impl/codegen/service_type.h @@ -148,7 +148,7 @@ class Service { } void MarkMethodStreamedUnary(int index, - MethodHandler* streamed_unary_method) { + MethodHandler* streamed_unary_method) { GPR_CODEGEN_ASSERT(methods_[index] && methods_[index]->handler() && "Cannot mark an async or generic method Streamed Unary"); methods_[index]->SetHandler(streamed_unary_method); |