diff options
author | Vijay Pai <vpai@google.com> | 2016-08-04 11:48:47 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-08-04 11:48:47 -0700 |
commit | 5d94118d0d3e11b0333251fec219e4571f6a20e7 (patch) | |
tree | c2dc27be0b7e98bd3710a57bcd4581e95e74e863 /include | |
parent | ff91dea14999225e5f6c9bcf565f28ee3acce6dd (diff) |
clang-format
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/impl/codegen/fc_unary.h | 26 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/method_handler_impl.h | 19 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/rpc_method.h | 2 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/rpc_service_method.h | 2 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/service_type.h | 2 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/sync_stream.h | 25 |
6 files changed, 44 insertions, 32 deletions
diff --git a/include/grpc++/impl/codegen/fc_unary.h b/include/grpc++/impl/codegen/fc_unary.h index 9dbc4024bf..a423f1f0b3 100644 --- a/include/grpc++/impl/codegen/fc_unary.h +++ b/include/grpc++/impl/codegen/fc_unary.h @@ -51,28 +51,36 @@ namespace grpc { /// and exactly 1 Write, in that order, to function correctly. /// Otherwise, the RPC is in error. template <class RequestType, class ResponseType> - class FCUnary GRPC_FINAL : public ServerReaderWriterInterface<ResponseType, RequestType> { -public: - FCUnary(Call* call, ServerContext* ctx): ServerReaderWriterInterface<ResponseType,RequestType>(call, ctx) , read_done_(false), write_done_(false) {} +class FCUnary GRPC_FINAL + : public ServerReaderWriterInterface<ResponseType, RequestType> { + public: + FCUnary(Call* call, ServerContext* ctx) + : ServerReaderWriterInterface<ResponseType, RequestType>(call, ctx), + read_done_(false), + write_done_(false) {} ~FCUnary() {} - bool Read(RequestType *request) GRPC_OVERRIDE { + bool Read(RequestType* request) GRPC_OVERRIDE { if (read_done_) { - return false; + return false; } read_done_ = true; - return ServerReaderWriterInterface<ResponseType,RequestType>::Read(request); + return ServerReaderWriterInterface<ResponseType, RequestType>::Read( + request); } using WriterInterface<ResponseType>::Write; - bool Write(const ResponseType& response, const WriteOptions& options) GRPC_OVERRIDE { + bool Write(const ResponseType& response, + const WriteOptions& options) GRPC_OVERRIDE { if (write_done_ || !read_done_) { - return false; + return false; } write_done_ = true; - return ServerReaderWriterInterface<ResponseType,RequestType>::Write(response, options); + return ServerReaderWriterInterface<ResponseType, RequestType>::Write( + response, options); } + private: bool read_done_; bool write_done_; diff --git a/include/grpc++/impl/codegen/method_handler_impl.h b/include/grpc++/impl/codegen/method_handler_impl.h index 14247b1f03..9c3af53b3a 100644 --- a/include/grpc++/impl/codegen/method_handler_impl.h +++ b/include/grpc++/impl/codegen/method_handler_impl.h @@ -207,19 +207,20 @@ class BidiStreamingHandler : public MethodHandler { // specifically to apply to the flow-controlled implementation of a unary // method. /// The argument to the constructor should be a member function already -/// bound to the appropriate service instance. The declaration gets too complicated +/// bound to the appropriate service instance. The declaration gets too +/// complicated /// otherwise. template <class ServiceType, class RequestType, class ResponseType> class FCUnaryMethodHandler : public MethodHandler { public: - FCUnaryMethodHandler(std::function<Status(ServerContext*, - FCUnary<RequestType,ResponseType>*)> - func) - : func_(func) {} + FCUnaryMethodHandler( + std::function<Status(ServerContext*, FCUnary<RequestType, ResponseType>*)> + func) + : func_(func) {} void RunHandler(const HandlerParameter& param) GRPC_FINAL { FCUnary<RequestType, ResponseType> fc_unary(param.call, - param.server_context); + param.server_context); Status status = func_(param.server_context, &fc_unary); if (!param.server_context->sent_initial_metadata_) { // means that the write never happened, which is bad @@ -230,11 +231,11 @@ class FCUnaryMethodHandler : public MethodHandler { param.call->cq()->Pluck(&ops); } } + private: // Application provided rpc handler function, already bound to its service. - std::function<Status(ServerContext*, - FCUnary<RequestType, ResponseType>*)> - func_; + std::function<Status(ServerContext*, FCUnary<RequestType, ResponseType>*)> + func_; }; // Handle unknown method by returning UNIMPLEMENTED error. diff --git a/include/grpc++/impl/codegen/rpc_method.h b/include/grpc++/impl/codegen/rpc_method.h index 728ba3e334..b55d755075 100644 --- a/include/grpc++/impl/codegen/rpc_method.h +++ b/include/grpc++/impl/codegen/rpc_method.h @@ -47,7 +47,7 @@ class RpcMethod { CLIENT_STREAMING, // request streaming SERVER_STREAMING, // response streaming BIDI_STREAMING, - FC_UNARY // flow-controlled unary call + FC_UNARY // flow-controlled unary call }; RpcMethod(const char* name, RpcType type) diff --git a/include/grpc++/impl/codegen/rpc_service_method.h b/include/grpc++/impl/codegen/rpc_service_method.h index 02da2a2617..52124fba0b 100644 --- a/include/grpc++/impl/codegen/rpc_service_method.h +++ b/include/grpc++/impl/codegen/rpc_service_method.h @@ -82,7 +82,7 @@ class RpcServiceMethod : public RpcMethod { // if MethodHandler is nullptr, then this is an async method MethodHandler* handler() const { return handler_.get(); } void ResetHandler() { handler_.reset(); } - void SetHandler(MethodHandler *handler) { handler_.reset(handler); } + void SetHandler(MethodHandler* handler) { handler_.reset(handler); } private: void* server_tag_; diff --git a/include/grpc++/impl/codegen/service_type.h b/include/grpc++/impl/codegen/service_type.h index c0eeace8a4..dcfc6b01b7 100644 --- a/include/grpc++/impl/codegen/service_type.h +++ b/include/grpc++/impl/codegen/service_type.h @@ -149,7 +149,7 @@ class Service { void MarkMethodFCUnary(int index, MethodHandler* fc_unary_method) { GPR_CODEGEN_ASSERT(methods_[index] && methods_[index]->handler() && - "Cannot mark an async or generic method as FCUnary"); + "Cannot mark an async or generic method as FCUnary"); methods_[index]->SetMethodType(::grpc::RpcMethod::FC_UNARY); methods_[index]->SetHandler(fc_unary_method); } diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 2e63479961..d9b7e6fec5 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -71,7 +71,7 @@ class ReaderInterface { virtual ~ReaderInterface() {} /// Upper bound on the next message size available for reading on this stream - virtual bool NextMessageSize(uint32_t *sz) = 0; + virtual bool NextMessageSize(uint32_t* sz) = 0; /// Blocking read a message and parse to \a msg. Returns \a true on success. /// This is thread-safe with respect to \a Write or \WritesDone methods on @@ -151,7 +151,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> { cq_.Pluck(&ops); /// status ignored } - bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { *sz = call_.max_message_size(); return true; } @@ -301,7 +301,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> { cq_.Pluck(&ops); // status ignored } - bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { *sz = call_.max_message_size(); return true; } @@ -368,7 +368,7 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> { call_->cq()->Pluck(&ops); } - bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { *sz = call_->max_message_size(); return true; } @@ -431,8 +431,9 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> { template <class W, class R> class ServerReaderWriterInterface : public WriterInterface<W>, public ReaderInterface<R> { -public: - ServerReaderWriterInterface(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + public: + ServerReaderWriterInterface(Call* call, ServerContext* ctx) + : call_(call), ctx_(ctx) {} virtual void SendInitialMetadata() { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); @@ -447,7 +448,7 @@ public: call_->cq()->Pluck(&ops); } - virtual bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE { + virtual bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { *sz = call_->max_message_size(); return true; } @@ -476,15 +477,17 @@ public: call_->PerformOps(&ops); return call_->cq()->Pluck(&ops); } -private: + + private: Call* const call_; ServerContext* const ctx_; }; template <class W, class R> -class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface<W,R> { -public: - ServerReaderWriter(Call* call, ServerContext* ctx) : ServerReaderWriterInterface<W,R>(call, ctx) {} +class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface<W, R> { + public: + ServerReaderWriter(Call* call, ServerContext* ctx) + : ServerReaderWriterInterface<W, R>(call, ctx) {} }; } // namespace grpc |