aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-06-05 07:14:58 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-06-05 07:14:58 -0700
commitce40de58da69dc5fb1569d4dca934ef7eea4d3b1 (patch)
treea5f6cea76723eb3e8878dfcc55c18c6b2f786d25
parentc091d5f4cde41d97b75dafb44a1e6708e007922b (diff)
clang-format
-rw-r--r--include/grpc++/async_unary_call.h13
-rw-r--r--include/grpc++/byte_buffer.h3
-rw-r--r--include/grpc++/completion_queue.h2
-rw-r--r--include/grpc++/config.h20
-rw-r--r--include/grpc++/config_protobuf.h3
-rw-r--r--include/grpc++/impl/call.h68
-rw-r--r--include/grpc++/impl/client_unary_call.h13
-rw-r--r--include/grpc++/impl/proto_utils.h18
-rw-r--r--include/grpc++/impl/rpc_service_method.h24
-rw-r--r--include/grpc++/impl/serialization_traits.h5
-rw-r--r--include/grpc++/impl/service_type.h19
-rw-r--r--include/grpc++/server.h67
-rw-r--r--include/grpc++/stream.h25
-rw-r--r--include/grpc/support/port_platform.h20
-rw-r--r--src/compiler/config.h6
-rw-r--r--src/compiler/cpp_generator.cc181
-rw-r--r--src/cpp/client/channel.h8
-rw-r--r--src/cpp/proto/proto_utils.cc8
-rw-r--r--src/cpp/server/server.cc58
19 files changed, 303 insertions, 258 deletions
diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h
index 3d475d0668..a3c9e20213 100644
--- a/include/grpc++/async_unary_call.h
+++ b/include/grpc++/async_unary_call.h
@@ -90,9 +90,11 @@ class ClientAsyncResponseReader GRPC_FINAL
private:
ClientContext* context_;
Call call_;
- SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpClientSendClose> init_buf_;
+ SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpClientSendClose> init_buf_;
CallOpSet<CallOpRecvInitialMetadata> meta_buf_;
- CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>, CallOpClientRecvStatus> finish_buf_;
+ CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
+ CallOpClientRecvStatus> finish_buf_;
};
template <class W>
@@ -119,7 +121,9 @@ class ServerAsyncResponseWriter GRPC_FINAL
}
// The response is dropped if the status is not OK.
if (status.IsOk() && !finish_buf_.SendMessage(msg)) {
- finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, Status(INVALID_ARGUMENT, "Failed to serialize message"));
+ finish_buf_.ServerSendStatus(
+ ctx_->trailing_metadata_,
+ Status(INVALID_ARGUMENT, "Failed to serialize message"));
} else {
finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
}
@@ -143,7 +147,8 @@ class ServerAsyncResponseWriter GRPC_FINAL
Call call_;
ServerContext* ctx_;
CallOpSet<CallOpSendInitialMetadata> meta_buf_;
- CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpServerSendStatus> finish_buf_;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpServerSendStatus> finish_buf_;
};
} // namespace grpc
diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h
index 618ec764df..80b3397a2d 100644
--- a/include/grpc++/byte_buffer.h
+++ b/include/grpc++/byte_buffer.h
@@ -85,7 +85,8 @@ class ByteBuffer GRPC_FINAL {
template <>
class SerializationTraits<ByteBuffer, void> {
public:
- static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest, int max_message_size) {
+ static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest,
+ int max_message_size) {
dest->set_buffer(byte_buffer);
return Status::OK;
}
diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h
index 0490073937..a3e7a9c9f4 100644
--- a/include/grpc++/completion_queue.h
+++ b/include/grpc++/completion_queue.h
@@ -95,7 +95,7 @@ class CompletionQueue : public GrpcLibrary {
// Nonblocking (until deadline) read from queue.
// Cannot rely on result of tag or ok if return is TIMEOUT
- template<typename T>
+ template <typename T>
NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) {
TimePoint<T> deadline_tp(deadline);
return AsyncNextInternal(tag, ok, deadline_tp.raw_time());
diff --git a/include/grpc++/config.h b/include/grpc++/config.h
index af248b66e3..1362c0a1fa 100644
--- a/include/grpc++/config.h
+++ b/include/grpc++/config.h
@@ -46,7 +46,7 @@
#define GRPC_CXX0X_NO_OVERRIDE 1
#define GRPC_CXX0X_NO_CHRONO 1
#define GRPC_CXX0X_NO_THREAD 1
-#endif
+#endif
#endif // Visual Studio
#ifndef __clang__
@@ -80,16 +80,22 @@
#ifdef GRPC_CXX0X_NO_NULLPTR
#include <memory>
const class {
-public:
- template <class T> operator T*() const {return static_cast<T *>(0);}
- template <class T> operator std::unique_ptr<T>() const {
+ public:
+ template <class T>
+ operator T *() const {
+ return static_cast<T *>(0);
+ }
+ template <class T>
+ operator std::unique_ptr<T>() const {
return std::unique_ptr<T>(static_cast<T *>(0));
}
- template <class T> operator std::shared_ptr<T>() const {
+ template <class T>
+ operator std::shared_ptr<T>() const {
return std::shared_ptr<T>(static_cast<T *>(0));
}
- operator bool() const {return false;}
-private:
+ operator bool() const { return false; }
+
+ private:
void operator&() const = delete;
} nullptr = {};
#endif
diff --git a/include/grpc++/config_protobuf.h b/include/grpc++/config_protobuf.h
index f6938b02ce..3afc7a58e2 100644
--- a/include/grpc++/config_protobuf.h
+++ b/include/grpc++/config_protobuf.h
@@ -51,8 +51,7 @@
::google::protobuf::io::ZeroCopyOutputStream
#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \
::google::protobuf::io::ZeroCopyInputStream
-#define GRPC_CUSTOM_CODEDINPUTSTREAM \
- ::google::protobuf::io::CodedInputStream
+#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream
#endif
namespace grpc {
diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h
index 40dbf9e641..88056470e3 100644
--- a/include/grpc++/impl/call.h
+++ b/include/grpc++/impl/call.h
@@ -54,7 +54,8 @@ class Call;
void FillMetadataMap(grpc_metadata_array* arr,
std::multimap<grpc::string, grpc::string>* metadata);
-grpc_metadata* FillMetadataArray(const std::multimap<grpc::string, grpc::string>& metadata);
+grpc_metadata* FillMetadataArray(
+ const std::multimap<grpc::string, grpc::string>& metadata);
class CallNoOp {
protected:
@@ -66,7 +67,8 @@ class CallOpSendInitialMetadata {
public:
CallOpSendInitialMetadata() : send_(false) {}
- void SendInitialMetadata(const std::multimap<grpc::string, grpc::string>& metadata) {
+ void SendInitialMetadata(
+ const std::multimap<grpc::string, grpc::string>& metadata) {
send_ = true;
initial_metadata_count_ = metadata.size();
initial_metadata_ = FillMetadataArray(metadata);
@@ -118,16 +120,14 @@ class CallOpRecvMessage {
public:
CallOpRecvMessage() : got_message(false), message_(nullptr) {}
- void RecvMessage(R* message) {
- message_ = message;
- }
+ void RecvMessage(R* message) { message_ = message; }
bool got_message;
protected:
void AddOp(grpc_op* ops, size_t* nops) {
if (message_ == nullptr) return;
- grpc_op *op = &ops[(*nops)++];
+ grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &recv_buf_;
}
@@ -137,7 +137,9 @@ class CallOpRecvMessage {
if (recv_buf_) {
if (*status) {
got_message = true;
- *status = SerializationTraits<R>::Deserialize(recv_buf_, message_, max_message_size).IsOk();
+ *status = SerializationTraits<R>::Deserialize(recv_buf_, message_,
+ max_message_size)
+ .IsOk();
} else {
got_message = false;
grpc_byte_buffer_destroy(recv_buf_);
@@ -159,8 +161,10 @@ class CallOpGenericRecvMessage {
template <class R>
void RecvMessage(R* message) {
- deserialize_ = [message](grpc_byte_buffer* buf, int max_message_size) -> Status {
- return SerializationTraits<R>::Deserialize(buf, message, max_message_size);
+ deserialize_ = [message](grpc_byte_buffer* buf,
+ int max_message_size) -> Status {
+ return SerializationTraits<R>::Deserialize(buf, message,
+ max_message_size);
};
}
@@ -169,7 +173,7 @@ class CallOpGenericRecvMessage {
protected:
void AddOp(grpc_op* ops, size_t* nops) {
if (!deserialize_) return;
- grpc_op *op = &ops[(*nops)++];
+ grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &recv_buf_;
}
@@ -218,7 +222,9 @@ class CallOpServerSendStatus {
public:
CallOpServerSendStatus() : send_status_available_(false) {}
- void ServerSendStatus(const std::multimap<grpc::string, grpc::string>& trailing_metadata, const Status& status){
+ void ServerSendStatus(
+ const std::multimap<grpc::string, grpc::string>& trailing_metadata,
+ const Status& status) {
trailing_metadata_count_ = trailing_metadata.size();
trailing_metadata_ = FillMetadataArray(trailing_metadata);
send_status_available_ = true;
@@ -232,8 +238,7 @@ class CallOpServerSendStatus {
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count =
trailing_metadata_count_;
- op->data.send_status_from_server.trailing_metadata =
- trailing_metadata_;
+ op->data.send_status_from_server.trailing_metadata = trailing_metadata_;
op->data.send_status_from_server.status = send_status_code_;
op->data.send_status_from_server.status_details =
send_status_details_.empty() ? nullptr : send_status_details_.c_str();
@@ -280,9 +285,7 @@ class CallOpRecvInitialMetadata {
class CallOpClientRecvStatus {
public:
- CallOpClientRecvStatus() {
- memset(this, 0, sizeof(*this));
- }
+ CallOpClientRecvStatus() { memset(this, 0, sizeof(*this)); }
void ClientRecvStatus(ClientContext* context, Status* status) {
recv_trailing_metadata_ = &context->trailing_metadata_;
@@ -323,7 +326,9 @@ class CallOpSetInterface : public CompletionQueueTag {
CallOpSetInterface() : max_message_size_(0) {}
virtual void FillOps(grpc_op* ops, size_t* nops) = 0;
- void set_max_message_size(int max_message_size) { max_message_size_ = max_message_size; }
+ void set_max_message_size(int max_message_size) {
+ max_message_size_ = max_message_size;
+ }
protected:
int max_message_size_;
@@ -332,14 +337,15 @@ class CallOpSetInterface : public CompletionQueueTag {
template <class T, int I>
class WrapAndDerive : public T {};
-template <class Op1 = CallNoOp, class Op2 = CallNoOp, class Op3 = CallNoOp, class Op4 = CallNoOp, class Op5 = CallNoOp, class Op6 = CallNoOp>
-class CallOpSet : public CallOpSetInterface,
-public WrapAndDerive<Op1, 1>,
-public WrapAndDerive<Op2, 2>,
-public WrapAndDerive<Op3, 3>,
-public WrapAndDerive<Op4, 4>,
-public WrapAndDerive<Op5, 5>,
-public WrapAndDerive<Op6, 6> {
+template <class Op1 = CallNoOp, class Op2 = CallNoOp, class Op3 = CallNoOp,
+ class Op4 = CallNoOp, class Op5 = CallNoOp, class Op6 = CallNoOp>
+class CallOpSet : public CallOpSetInterface,
+ public WrapAndDerive<Op1, 1>,
+ public WrapAndDerive<Op2, 2>,
+ public WrapAndDerive<Op3, 3>,
+ public WrapAndDerive<Op4, 4>,
+ public WrapAndDerive<Op5, 5>,
+ public WrapAndDerive<Op6, 6> {
public:
CallOpSet() : return_tag_(this) {}
void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE {
@@ -365,7 +371,7 @@ public WrapAndDerive<Op6, 6> {
void set_output_tag(void* return_tag) { return_tag_ = return_tag; }
private:
- void *return_tag_;
+ void* return_tag_;
};
#if 0
@@ -444,11 +450,15 @@ class CallOpBuffer : public CompletionQueueTag {
#endif
// SneakyCallOpBuffer does not post completions to the completion queue
-template <class Op1 = CallNoOp, class Op2 = CallNoOp, class Op3 = CallNoOp, class Op4 = CallNoOp, class Op5 = CallNoOp, class Op6 = CallNoOp>
-class SneakyCallOpSet GRPC_FINAL : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> {
+template <class Op1 = CallNoOp, class Op2 = CallNoOp, class Op3 = CallNoOp,
+ class Op4 = CallNoOp, class Op5 = CallNoOp, class Op6 = CallNoOp>
+class SneakyCallOpSet GRPC_FINAL
+ : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> {
public:
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE {
- return CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6>::FinalizeResult(tag, status) && false;
+ return CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6>::FinalizeResult(tag,
+ status) &&
+ false;
}
};
diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h
index 5e37e63c6d..c1832f9eb8 100644
--- a/include/grpc++/impl/client_unary_call.h
+++ b/include/grpc++/impl/client_unary_call.h
@@ -49,18 +49,13 @@ class Status;
// Wrapper that performs a blocking unary call
template <class InputMessage, class OutputMessage>
Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
- ClientContext* context,
- const InputMessage& request,
+ ClientContext* context, const InputMessage& request,
OutputMessage* result) {
CompletionQueue cq;
Call call(channel->CreateCall(method, context, &cq));
- CallOpSet<
- CallOpSendInitialMetadata,
- CallOpSendMessage,
- CallOpRecvInitialMetadata,
- CallOpRecvMessage<OutputMessage>,
- CallOpClientSendClose,
- CallOpClientRecvStatus> ops;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>,
+ CallOpClientSendClose, CallOpClientRecvStatus> ops;
Status status;
ops.SendInitialMetadata(context->send_initial_metadata_);
if (!ops.SendMessage(request)) {
diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/impl/proto_utils.h
index 1a0cc31a8a..ee19859198 100644
--- a/include/grpc++/impl/proto_utils.h
+++ b/include/grpc++/impl/proto_utils.h
@@ -55,14 +55,18 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
int max_message_size);
template <class T>
-class SerializationTraits<T, typename std::enable_if<std::is_base_of<grpc::protobuf::Message, T>::value>::type> {
+class SerializationTraits<T, typename std::enable_if<std::is_base_of<
+ grpc::protobuf::Message, T>::value>::type> {
public:
- static bool Serialize(const grpc::protobuf::Message& msg, grpc_byte_buffer** buffer) {
- return SerializeProto(msg, buffer);
- }
- static Status Deserialize(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, int max_message_size) {
- return DeserializeProto(buffer, msg, max_message_size);
- }
+ static bool Serialize(const grpc::protobuf::Message& msg,
+ grpc_byte_buffer** buffer) {
+ return SerializeProto(msg, buffer);
+ }
+ static Status Deserialize(grpc_byte_buffer* buffer,
+ grpc::protobuf::Message* msg,
+ int max_message_size) {
+ return DeserializeProto(buffer, msg, max_message_size);
+ }
};
} // namespace grpc
diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h
index cd31b22323..1bf39fca3b 100644
--- a/include/grpc++/impl/rpc_service_method.h
+++ b/include/grpc++/impl/rpc_service_method.h
@@ -55,9 +55,12 @@ class MethodHandler {
public:
virtual ~MethodHandler() {}
struct HandlerParameter {
- HandlerParameter(Call* c, ServerContext* context,
- grpc_byte_buffer* req, int max_size)
- : call(c), server_context(context), request(req), max_message_size(max_size) {}
+ HandlerParameter(Call* c, ServerContext* context, grpc_byte_buffer* req,
+ int max_size)
+ : call(c),
+ server_context(context),
+ request(req),
+ max_message_size(max_size) {}
Call* call;
ServerContext* server_context;
// Handler required to grpc_byte_buffer_destroy this
@@ -79,14 +82,16 @@ class RpcMethodHandler : public MethodHandler {
void RunHandler(const HandlerParameter& param) GRPC_FINAL {
RequestType req;
- Status status = SerializationTraits<RequestType>::Deserialize(param.request, &req, param.max_message_size);
+ Status status = SerializationTraits<RequestType>::Deserialize(
+ param.request, &req, param.max_message_size);
ResponseType rsp;
if (status.IsOk()) {
status = func_(service_, param.server_context, &req, &rsp);
}
GPR_ASSERT(!param.server_context->sent_initial_metadata_);
- CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpServerSendStatus> ops;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpServerSendStatus> ops;
ops.SendInitialMetadata(param.server_context->initial_metadata_);
if (status.IsOk()) {
if (!ops.SendMessage(rsp)) {
@@ -122,7 +127,8 @@ class ClientStreamingHandler : public MethodHandler {
Status status = func_(service_, param.server_context, &reader, &rsp);
GPR_ASSERT(!param.server_context->sent_initial_metadata_);
- CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpServerSendStatus> ops;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpServerSendStatus> ops;
ops.SendInitialMetadata(param.server_context->initial_metadata_);
if (status.IsOk()) {
if (!ops.SendMessage(rsp)) {
@@ -152,7 +158,8 @@ class ServerStreamingHandler : public MethodHandler {
void RunHandler(const HandlerParameter& param) GRPC_FINAL {
RequestType req;
- Status status = SerializationTraits<RequestType>::Deserialize(param.request, &req, param.max_message_size);
+ Status status = SerializationTraits<RequestType>::Deserialize(
+ param.request, &req, param.max_message_size);
if (status.IsOk()) {
ServerWriter<ResponseType> writer(param.call, param.server_context);
@@ -211,8 +218,7 @@ class RpcServiceMethod : public RpcMethod {
// Takes ownership of the handler
RpcServiceMethod(const char* name, RpcMethod::RpcType type,
MethodHandler* handler)
- : RpcMethod(name, type, nullptr),
- handler_(handler) {}
+ : RpcMethod(name, type, nullptr), handler_(handler) {}
MethodHandler* handler() { return handler_.get(); }
diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h
index 4648bbfc33..e4f086e08d 100644
--- a/include/grpc++/impl/serialization_traits.h
+++ b/include/grpc++/impl/serialization_traits.h
@@ -38,9 +38,10 @@ struct grpc_byte_buffer;
namespace grpc {
-template <class Message, class UnusedButHereForPartialTemplateSpecialization = void>
+template <class Message,
+ class UnusedButHereForPartialTemplateSpecialization = void>
class SerializationTraits;
} // namespace grpc
-#endif // GRPCXX_IMPL_SERIALIZATION_TRAITS_H
+#endif // GRPCXX_IMPL_SERIALIZATION_TRAITS_H
diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h
index af21d9b8cf..8f9f38f193 100644
--- a/include/grpc++/impl/service_type.h
+++ b/include/grpc++/impl/service_type.h
@@ -77,21 +77,20 @@ class AsynchronousService {
protected:
template <class Message>
- void RequestAsyncUnary(int index, ServerContext* context,
- Message* request,
+ void RequestAsyncUnary(int index, ServerContext* context, Message* request,
ServerAsyncStreamingInterface* stream,
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq, void* tag) {
- server_->RequestAsyncCall(request_args_[index], context,
- stream, call_cq, notification_cq, tag, request);
+ server_->RequestAsyncCall(request_args_[index], context, stream, call_cq,
+ notification_cq, tag, request);
}
void RequestClientStreaming(int index, ServerContext* context,
ServerAsyncStreamingInterface* stream,
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq,
void* tag) {
- server_->RequestAsyncCall(request_args_[index], context,
- stream, call_cq, notification_cq, tag);
+ server_->RequestAsyncCall(request_args_[index], context, stream, call_cq,
+ notification_cq, tag);
}
template <class Message>
void RequestServerStreaming(int index, ServerContext* context,
@@ -100,15 +99,15 @@ class AsynchronousService {
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq,
void* tag) {
- server_->RequestAsyncCall(request_args_[index], context,
- stream, call_cq, notification_cq, tag, request);
+ server_->RequestAsyncCall(request_args_[index], context, stream, call_cq,
+ notification_cq, tag, request);
}
void RequestBidiStreaming(int index, ServerContext* context,
ServerAsyncStreamingInterface* stream,
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq, void* tag) {
- server_->RequestAsyncCall(request_args_[index], context,
- stream, call_cq, notification_cq, tag);
+ server_->RequestAsyncCall(request_args_[index], context, stream, call_cq,
+ notification_cq, tag);
}
private:
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index a6883e24e6..8c7551ccf1 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -58,8 +58,7 @@ class ServerCredentials;
class ThreadPoolInterface;
// Currently it only supports handling rpcs in a single thread.
-class Server GRPC_FINAL : public GrpcLibrary,
- private CallHook {
+class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
public:
~Server();
@@ -97,14 +96,13 @@ class Server GRPC_FINAL : public GrpcLibrary,
void RunRpc();
void ScheduleCallback();
- void PerformOpsOnCall(CallOpSetInterface *ops, Call* call) GRPC_OVERRIDE;
+ void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE;
class BaseAsyncRequest : public CompletionQueueTag {
public:
BaseAsyncRequest(Server* server, ServerContext* context,
- ServerAsyncStreamingInterface* stream,
- CompletionQueue* call_cq,
- void* tag);
+ ServerAsyncStreamingInterface* stream,
+ CompletionQueue* call_cq, void* tag);
virtual ~BaseAsyncRequest();
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE;
@@ -123,20 +121,24 @@ class Server GRPC_FINAL : public GrpcLibrary,
class RegisteredAsyncRequest : public BaseAsyncRequest {
public:
RegisteredAsyncRequest(Server* server, ServerContext* context,
- ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag);
+ ServerAsyncStreamingInterface* stream,
+ CompletionQueue* call_cq, void* tag);
// uses BaseAsyncRequest::FinalizeResult
protected:
- void IssueRequest(void* registered_method, grpc_byte_buffer** payload, ServerCompletionQueue *notification_cq);
+ void IssueRequest(void* registered_method, grpc_byte_buffer** payload,
+ ServerCompletionQueue* notification_cq);
};
class NoPayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest {
public:
- NoPayloadAsyncRequest(void* registered_method, Server* server, ServerContext* context,
- ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq,
- ServerCompletionQueue* notification_cq, void* tag)
- : RegisteredAsyncRequest(server, context, stream, call_cq, tag) {
+ NoPayloadAsyncRequest(void* registered_method, Server* server,
+ ServerContext* context,
+ ServerAsyncStreamingInterface* stream,
+ CompletionQueue* call_cq,
+ ServerCompletionQueue* notification_cq, void* tag)
+ : RegisteredAsyncRequest(server, context, stream, call_cq, tag) {
IssueRequest(registered_method, nullptr, notification_cq);
}
@@ -146,15 +148,23 @@ class Server GRPC_FINAL : public GrpcLibrary,
template <class Message>
class PayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest {
public:
- PayloadAsyncRequest(void* registered_method, Server* server, ServerContext* context,
- ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq,
- ServerCompletionQueue* notification_cq, void* tag, Message* request)
- : RegisteredAsyncRequest(server, context, stream, call_cq, tag), request_(request) {
+ PayloadAsyncRequest(void* registered_method, Server* server,
+ ServerContext* context,
+ ServerAsyncStreamingInterface* stream,
+ CompletionQueue* call_cq,
+ ServerCompletionQueue* notification_cq, void* tag,
+ Message* request)
+ : RegisteredAsyncRequest(server, context, stream, call_cq, tag),
+ request_(request) {
IssueRequest(registered_method, &payload_, notification_cq);
}
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE {
- bool serialization_status = *status && payload_ && SerializationTraits<Message>::Deserialize(payload_, request_, server_->max_message_size_).IsOk();
+ bool serialization_status =
+ *status && payload_ &&
+ SerializationTraits<Message>::Deserialize(payload_, request_,
+ server_->max_message_size_)
+ .IsOk();
bool ret = RegisteredAsyncRequest::FinalizeResult(tag, status);
*status = serialization_status && *status;
return ret;
@@ -168,10 +178,9 @@ class Server GRPC_FINAL : public GrpcLibrary,
class GenericAsyncRequest GRPC_FINAL : public BaseAsyncRequest {
public:
GenericAsyncRequest(Server* server, GenericServerContext* context,
- ServerAsyncStreamingInterface* stream,
- CompletionQueue* call_cq,
- ServerCompletionQueue* notification_cq,
- void* tag);
+ ServerAsyncStreamingInterface* stream,
+ CompletionQueue* call_cq,
+ ServerCompletionQueue* notification_cq, void* tag);
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE;
@@ -183,17 +192,18 @@ class Server GRPC_FINAL : public GrpcLibrary,
void RequestAsyncCall(void* registered_method, ServerContext* context,
ServerAsyncStreamingInterface* stream,
CompletionQueue* call_cq,
- ServerCompletionQueue* notification_cq,
- void* tag, Message *message) {
- new PayloadAsyncRequest<Message>(registered_method, this, context, stream, call_cq, notification_cq, tag, message);
+ ServerCompletionQueue* notification_cq, void* tag,
+ Message* message) {
+ new PayloadAsyncRequest<Message>(registered_method, this, context, stream,
+ call_cq, notification_cq, tag, message);
}
void RequestAsyncCall(void* registered_method, ServerContext* context,
ServerAsyncStreamingInterface* stream,
CompletionQueue* call_cq,
- ServerCompletionQueue* notification_cq,
- void* tag) {
- new NoPayloadAsyncRequest(registered_method, this, context, stream, call_cq, notification_cq, tag);
+ ServerCompletionQueue* notification_cq, void* tag) {
+ new NoPayloadAsyncRequest(registered_method, this, context, stream, call_cq,
+ notification_cq, tag);
}
void RequestAsyncGenericCall(GenericServerContext* context,
@@ -201,7 +211,8 @@ class Server GRPC_FINAL : public GrpcLibrary,
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq,
void* tag) {
- new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, tag);
+ new GenericAsyncRequest(this, context, stream, call_cq, notification_cq,
+ tag);
}
const int max_message_size_;
diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h
index eb2bce678f..2495f96abf 100644
--- a/include/grpc++/stream.h
+++ b/include/grpc++/stream.h
@@ -97,7 +97,8 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
ClientReader(ChannelInterface* channel, const RpcMethod& method,
ClientContext* context, const W& request)
: context_(context), call_(channel->CreateCall(method, context, &cq_)) {
- CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpClientSendClose> ops;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpClientSendClose> ops;
ops.SendInitialMetadata(context->send_initial_metadata_);
// TODO(ctiller): don't assert
GPR_ASSERT(ops.SendMessage(request));
@@ -158,8 +159,7 @@ class ClientWriter : public ClientWriterInterface<W> {
template <class R>
ClientWriter(ChannelInterface* channel, const RpcMethod& method,
ClientContext* context, R* response)
- : context_(context),
- call_(channel->CreateCall(method, context, &cq_)) {
+ : context_(context), call_(channel->CreateCall(method, context, &cq_)) {
finish_ops_.RecvMessage(response);
CallOpSet<CallOpSendInitialMetadata> ops;
@@ -408,8 +408,7 @@ class AsyncWriterInterface {
template <class R>
class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface,
- public AsyncReaderInterface<R> {
-};
+ public AsyncReaderInterface<R> {};
template <class R>
class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
@@ -457,7 +456,8 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
private:
ClientContext* context_;
Call call_;
- CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpClientSendClose> init_ops_;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpClientSendClose>
+ init_ops_;
CallOpSet<CallOpRecvInitialMetadata> meta_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> read_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpClientRecvStatus> finish_ops_;
@@ -477,8 +477,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
R* response, void* tag)
- : context_(context),
- call_(channel->CreateCall(method, context, cq)) {
+ : context_(context), call_(channel->CreateCall(method, context, cq)) {
finish_ops_.RecvMessage(response);
init_ops_.set_output_tag(tag);
@@ -523,7 +522,8 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
CallOpSet<CallOpRecvInitialMetadata> meta_ops_;
CallOpSet<CallOpSendMessage> write_ops_;
CallOpSet<CallOpClientSendClose> writes_done_ops_;
- CallOpSet<CallOpRecvInitialMetadata, CallOpGenericRecvMessage, CallOpClientRecvStatus> finish_ops_;
+ CallOpSet<CallOpRecvInitialMetadata, CallOpGenericRecvMessage,
+ CallOpClientRecvStatus> finish_ops_;
};
// Client-side interface for bi-directional streaming.
@@ -628,7 +628,9 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
}
// The response is dropped if the status is not OK.
if (status.IsOk() && !finish_ops_.SendMessage(msg)) {
- finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, Status(INTERNAL, "Failed to serialize response"));
+ finish_ops_.ServerSendStatus(
+ ctx_->trailing_metadata_,
+ Status(INTERNAL, "Failed to serialize response"));
} else {
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
}
@@ -653,7 +655,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
ServerContext* ctx_;
CallOpSet<CallOpSendInitialMetadata> meta_ops_;
CallOpSet<CallOpRecvMessage<R>> read_ops_;
- CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpServerSendStatus> finish_ops_;
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpServerSendStatus> finish_ops_;
};
template <class W>
diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h
index 077eeb1c07..4fbce9c8d9 100644
--- a/include/grpc/support/port_platform.h
+++ b/include/grpc/support/port_platform.h
@@ -223,7 +223,9 @@
#endif
/* Validate platform combinations */
-#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + defined(GPR_WIN32_ATOMIC) != 1
+#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
+ defined(GPR_WIN32_ATOMIC) != \
+ 1
#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WIN32_ATOMIC
#endif
@@ -231,7 +233,9 @@
#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
#endif
-#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != 1
+#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + \
+ defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
+ 1
#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
#endif
@@ -239,11 +243,15 @@
#error Must define GPR_POSIX_SOCKET to use GPR_POSIX_MULTIPOLL_WITH_POLL
#endif
-#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + defined(GPR_CUSTOM_SOCKET) != 1
+#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + \
+ defined(GPR_CUSTOM_SOCKET) != \
+ 1
#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET
#endif
-#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + defined(GPR_CUSTOM_TLS) != 1
+#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \
+ defined(GPR_CUSTOM_TLS) != \
+ 1
#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS
#endif
@@ -268,10 +276,10 @@ typedef uintptr_t gpr_uintptr;
#ifndef GRPC_MUST_USE_RESULT
#ifdef __GNUC__
-#define GRPC_MUST_USE_RESULT __attribute__ ((warn_unused_result))
+#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))
#else
#define GRPC_MUST_USE_RESULT
#endif
#endif
-#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */
+#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */
diff --git a/src/compiler/config.h b/src/compiler/config.h
index 06ccd8530c..cd52aca57d 100644
--- a/src/compiler/config.h
+++ b/src/compiler/config.h
@@ -49,7 +49,8 @@
#ifndef GRPC_CUSTOM_CODEGENERATOR
#include <google/protobuf/compiler/code_generator.h>
#define GRPC_CUSTOM_CODEGENERATOR ::google::protobuf::compiler::CodeGenerator
-#define GRPC_CUSTOM_GENERATORCONTEXT ::google::protobuf::compiler::GeneratorContext
+#define GRPC_CUSTOM_GENERATORCONTEXT \
+ ::google::protobuf::compiler::GeneratorContext
#endif
#ifndef GRPC_CUSTOM_PRINTER
@@ -58,7 +59,8 @@
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer
#define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream
-#define GRPC_CUSTOM_STRINGOUTPUTSTREAM ::google::protobuf::io::StringOutputStream
+#define GRPC_CUSTOM_STRINGOUTPUTSTREAM \
+ ::google::protobuf::io::StringOutputStream
#endif
#ifndef GRPC_CUSTOM_PLUGINMAIN
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index d03eaddf40..0b69848f7d 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -97,7 +97,8 @@ grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file,
vars["filename_base"] = grpc_generator::StripProto(file->name());
printer.Print(vars, "// Generated by the gRPC protobuf plugin.\n");
- printer.Print(vars, "// If you make any local change, they will be lost.\n");
+ printer.Print(vars,
+ "// If you make any local change, they will be lost.\n");
printer.Print(vars, "// source: $filename$\n");
printer.Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n");
printer.Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
@@ -142,10 +143,10 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file,
return temp;
}
-void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer,
- const grpc::protobuf::MethodDescriptor *method,
- std::map<grpc::string, grpc::string> *vars,
- bool is_public) {
+void PrintHeaderClientMethodInterfaces(
+ grpc::protobuf::io::Printer *printer,
+ const grpc::protobuf::MethodDescriptor *method,
+ std::map<grpc::string, grpc::string> *vars, bool is_public) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -158,19 +159,17 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer,
*vars,
"virtual ::grpc::Status $Method$(::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response) = 0;\n");
- printer->Print(
- *vars,
- "std::unique_ptr< "
- "::grpc::ClientAsyncResponseReaderInterface< $Response$>> "
- "Async$Method$(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq) {\n");
+ printer->Print(*vars,
+ "std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReaderInterface< $Response$>> "
+ "Async$Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncResponseReaderInterface< $Response$>>("
- "Async$Method$Raw(context, request, cq));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReaderInterface< $Response$>>("
+ "Async$Method$Raw(context, request, cq));\n");
printer->Outdent();
printer->Print("}\n");
} else if (ClientOnlyStreaming(method)) {
@@ -189,14 +188,14 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer,
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientAsyncWriterInterface< $Request$>>"
- " Async$Method$(::grpc::ClientContext* context, $Response$* response, "
+ " Async$Method$(::grpc::ClientContext* context, $Response$* "
+ "response, "
"::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncWriterInterface< $Request$>>("
- "Async$Method$Raw(context, response, cq, tag));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncWriterInterface< $Request$>>("
+ "Async$Method$Raw(context, response, cq, tag));\n");
printer->Outdent();
printer->Print("}\n");
} else if (ServerOnlyStreaming(method)) {
@@ -219,18 +218,17 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncReaderInterface< $Response$>>("
- "Async$Method$Raw(context, request, cq, tag));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncReaderInterface< $Response$>>("
+ "Async$Method$Raw(context, request, cq, tag));\n");
printer->Outdent();
printer->Print("}\n");
} else if (BidiStreaming(method)) {
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientReaderWriterInterface< $Request$, $Response$>> "
- "$Method$(::grpc::ClientContext* context) {\n");
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientReaderWriterInterface< "
+ "$Request$, $Response$>> "
+ "$Method$(::grpc::ClientContext* context) {\n");
printer->Indent();
printer->Print(
*vars,
@@ -268,12 +266,11 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer,
"virtual ::grpc::ClientWriterInterface< $Request$>*"
" $Method$Raw("
"::grpc::ClientContext* context, $Response$* response) = 0;\n");
- printer->Print(
- *vars,
- "virtual ::grpc::ClientAsyncWriterInterface< $Request$>*"
- " Async$Method$Raw(::grpc::ClientContext* context, "
- "$Response$* response, "
- "::grpc::CompletionQueue* cq, void* tag) = 0;\n");
+ printer->Print(*vars,
+ "virtual ::grpc::ClientAsyncWriterInterface< $Request$>*"
+ " Async$Method$Raw(::grpc::ClientContext* context, "
+ "$Response$* response, "
+ "::grpc::CompletionQueue* cq, void* tag) = 0;\n");
} else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
@@ -286,16 +283,15 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) = 0;\n");
} else if (BidiStreaming(method)) {
- printer->Print(
- *vars,
- "virtual ::grpc::ClientReaderWriterInterface< $Request$, $Response$>* "
- "$Method$Raw(::grpc::ClientContext* context) = 0;\n");
- printer->Print(
- *vars,
- "virtual ::grpc::ClientAsyncReaderWriterInterface< "
- "$Request$, $Response$>* "
- "Async$Method$Raw(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq, void* tag) = 0;\n");
+ printer->Print(*vars,
+ "virtual ::grpc::ClientReaderWriterInterface< $Request$, "
+ "$Response$>* "
+ "$Method$Raw(::grpc::ClientContext* context) = 0;\n");
+ printer->Print(*vars,
+ "virtual ::grpc::ClientAsyncReaderWriterInterface< "
+ "$Request$, $Response$>* "
+ "Async$Method$Raw(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq, void* tag) = 0;\n");
}
}
}
@@ -322,11 +318,10 @@ void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer,
"const $Request$& request, "
"::grpc::CompletionQueue* cq) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncResponseReader< $Response$>>("
- "Async$Method$Raw(context, request, cq));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReader< $Response$>>("
+ "Async$Method$Raw(context, request, cq));\n");
printer->Outdent();
printer->Print("}\n");
} else if (ClientOnlyStreaming(method)) {
@@ -336,17 +331,16 @@ void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer,
" $Method$("
"::grpc::ClientContext* context, $Response$* response) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
- "($Method$Raw(context, response));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
+ "($Method$Raw(context, response));\n");
printer->Outdent();
printer->Print("}\n");
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>"
- " Async$Method$(::grpc::ClientContext* context, $Response$* response, "
- "::grpc::CompletionQueue* cq, void* tag) {\n");
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>"
+ " Async$Method$(::grpc::ClientContext* context, "
+ "$Response$* response, "
+ "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Indent();
printer->Print(
*vars,
@@ -386,53 +380,47 @@ void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer,
"std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>>"
" $Method$(::grpc::ClientContext* context) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientReaderWriter< $Request$, $Response$>>("
- "$Method$Raw(context));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientReaderWriter< $Request$, $Response$>>("
+ "$Method$Raw(context));\n");
printer->Outdent();
printer->Print("}\n");
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
- "$Request$, $Response$>> "
- "Async$Method$(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq, void* tag) {\n");
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
+ "$Request$, $Response$>> "
+ "Async$Method$(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>>("
- "Async$Method$Raw(context, cq, tag));\n");
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>>("
+ "Async$Method$Raw(context, cq, tag));\n");
printer->Outdent();
printer->Print("}\n");
}
} else {
if (NoStreaming(method)) {
- printer->Print(
- *vars,
- "::grpc::ClientAsyncResponseReader< $Response$>* "
- "Async$Method$Raw(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq) GRPC_OVERRIDE;\n");
+ printer->Print(*vars,
+ "::grpc::ClientAsyncResponseReader< $Response$>* "
+ "Async$Method$Raw(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq) GRPC_OVERRIDE;\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "::grpc::ClientWriter< $Request$>* $Method$Raw("
- "::grpc::ClientContext* context, $Response$* response) "
- "GRPC_OVERRIDE;\n");
+ printer->Print(*vars,
+ "::grpc::ClientWriter< $Request$>* $Method$Raw("
+ "::grpc::ClientContext* context, $Response$* response) "
+ "GRPC_OVERRIDE;\n");
printer->Print(
*vars,
"::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw("
"::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n");
} else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "::grpc::ClientReader< $Response$>* $Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request)"
- " GRPC_OVERRIDE;\n");
+ printer->Print(*vars,
+ "::grpc::ClientReader< $Response$>* $Method$Raw("
+ "::grpc::ClientContext* context, const $Request$& request)"
+ " GRPC_OVERRIDE;\n");
printer->Print(
*vars,
"::grpc::ClientAsyncReader< $Response$>* Async$Method$Raw("
@@ -630,7 +618,7 @@ grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file,
const Parameters &params) {
grpc::string output;
{
- // Scope the output stream so it closes and finalizes output to the string.
+ // Scope the output stream so it closes and finalizes output to the string.
grpc::protobuf::io::StringOutputStream output_stream(&output);
grpc::protobuf::io::Printer printer(&output_stream, '$');
std::map<grpc::string, grpc::string> vars;
@@ -694,7 +682,8 @@ grpc::string GetSourcePrologue(const grpc::protobuf::FileDescriptor *file,
vars["filename_base"] = grpc_generator::StripProto(file->name());
printer.Print(vars, "// Generated by the gRPC protobuf plugin.\n");
- printer.Print(vars, "// If you make any local change, they will be lost.\n");
+ printer.Print(vars,
+ "// If you make any local change, they will be lost.\n");
printer.Print(vars, "// source: $filename$\n\n");
printer.Print(vars, "#include \"$filename_base$.pb.h\"\n");
printer.Print(vars, "#include \"$filename_base$.grpc.pb.h\"\n");
diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h
index 69baa419a6..9108713c58 100644
--- a/src/cpp/client/channel.h
+++ b/src/cpp/client/channel.h
@@ -50,16 +50,16 @@ class CompletionQueue;
class Credentials;
class StreamContextInterface;
-class Channel GRPC_FINAL : public GrpcLibrary,
- public ChannelInterface {
+class Channel GRPC_FINAL : public GrpcLibrary, public ChannelInterface {
public:
Channel(const grpc::string& target, grpc_channel* c_channel);
~Channel() GRPC_OVERRIDE;
- virtual void *RegisterMethod(const char *method) 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(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE;
+ virtual void PerformOpsOnCall(CallOpSetInterface* ops,
+ Call* call) GRPC_OVERRIDE;
private:
const grpc::string target_;
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc
index a4a37c7000..9e8bf1a631 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -67,7 +67,7 @@ class GrpcBufferWriter GRPC_FINAL
slice_ = gpr_slice_malloc(block_size_);
}
*data = GPR_SLICE_START_PTR(slice_);
- byte_count_ += *size = GPR_SLICE_LENGTH(slice_);
+ byte_count_ += * size = GPR_SLICE_LENGTH(slice_);
gpr_slice_buffer_add(slice_buffer_, slice_);
return true;
}
@@ -118,7 +118,7 @@ class GrpcBufferReader GRPC_FINAL
}
gpr_slice_unref(slice_);
*data = GPR_SLICE_START_PTR(slice_);
- byte_count_ += *size = GPR_SLICE_LENGTH(slice_);
+ byte_count_ += * size = GPR_SLICE_LENGTH(slice_);
return true;
}
@@ -158,7 +158,7 @@ bool SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) {
}
Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
- int max_message_size) {
+ int max_message_size) {
if (!buffer) {
return Status(INVALID_ARGUMENT, "No payload");
}
@@ -169,7 +169,7 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
}
if (!msg->ParseFromCodedStream(&decoder)) {
return Status(INVALID_ARGUMENT, msg->InitializationErrorString());
- }
+ }
if (!decoder.ConsumedEntireMessage()) {
return Status(INVALID_ARGUMENT, "Did not read entire message");
}
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index bd97d707a7..b750868607 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -71,9 +71,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
grpc_metadata_array_init(&request_metadata_);
}
- ~SyncRequest() {
- grpc_metadata_array_destroy(&request_metadata_);
- }
+ ~SyncRequest() { grpc_metadata_array_destroy(&request_metadata_); }
static SyncRequest* Wait(CompletionQueue* cq, bool* ok) {
void* tag = nullptr;
@@ -129,8 +127,8 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
void Run() {
ctx_.BeginCompletionOp(&call_);
- method_->handler()->RunHandler(
- MethodHandler::HandlerParameter(&call_, &ctx_, request_payload_, call_.max_message_size()));
+ method_->handler()->RunHandler(MethodHandler::HandlerParameter(
+ &call_, &ctx_, request_payload_, call_.max_message_size()));
void* ignored_tag;
bool ignored_ok;
cq_.Shutdown();
@@ -422,23 +420,27 @@ void Server::RequestAsyncGenericCall(GenericServerContext* context,
}
#endif
-Server::BaseAsyncRequest::BaseAsyncRequest(Server* server, ServerContext* context,
- ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag)
-: server_(server), context_(context), stream_(stream), call_cq_(call_cq), call_(nullptr) {
+Server::BaseAsyncRequest::BaseAsyncRequest(
+ Server* server, ServerContext* context,
+ ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag)
+ : server_(server),
+ context_(context),
+ stream_(stream),
+ call_cq_(call_cq),
+ call_(nullptr) {
memset(&initial_metadata_array_, 0, sizeof(initial_metadata_array_));
}
-Server::BaseAsyncRequest::~BaseAsyncRequest() {
-}
+Server::BaseAsyncRequest::~BaseAsyncRequest() {}
bool Server::BaseAsyncRequest::FinalizeResult(void** tag, bool* status) {
if (*status) {
for (size_t i = 0; i < initial_metadata_array_.count; i++) {
context_->client_metadata_.insert(std::make_pair(
grpc::string(initial_metadata_array_.metadata[i].key),
- grpc::string(
- initial_metadata_array_.metadata[i].value,
- initial_metadata_array_.metadata[i].value + initial_metadata_array_.metadata[i].value_length)));
+ grpc::string(initial_metadata_array_.metadata[i].value,
+ initial_metadata_array_.metadata[i].value +
+ initial_metadata_array_.metadata[i].value_length)));
}
}
context_->call_ = call_;
@@ -453,27 +455,31 @@ bool Server::BaseAsyncRequest::FinalizeResult(void** tag, bool* status) {
return true;
}
-Server::RegisteredAsyncRequest::RegisteredAsyncRequest(Server* server, ServerContext* context,
- ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag)
+Server::RegisteredAsyncRequest::RegisteredAsyncRequest(
+ Server* server, ServerContext* context,
+ ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag)
: BaseAsyncRequest(server, context, stream, call_cq, tag) {}
-
-void Server::RegisteredAsyncRequest::IssueRequest(void* registered_method, grpc_byte_buffer** payload, ServerCompletionQueue *notification_cq) {
+void Server::RegisteredAsyncRequest::IssueRequest(
+ void* registered_method, grpc_byte_buffer** payload,
+ ServerCompletionQueue* notification_cq) {
grpc_server_request_registered_call(
- server_->server_, registered_method, &call_, &context_->deadline_, &initial_metadata_array_, payload, call_cq_->cq(), notification_cq->cq(), this);
+ server_->server_, registered_method, &call_, &context_->deadline_,
+ &initial_metadata_array_, payload, call_cq_->cq(), notification_cq->cq(),
+ this);
}
-Server::GenericAsyncRequest::GenericAsyncRequest(Server* server, GenericServerContext* context,
- ServerAsyncStreamingInterface* stream,
- CompletionQueue* call_cq,
- ServerCompletionQueue* notification_cq,
- void* tag)
-: BaseAsyncRequest(server, context, stream, call_cq, tag) {
+Server::GenericAsyncRequest::GenericAsyncRequest(
+ Server* server, GenericServerContext* context,
+ ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq,
+ ServerCompletionQueue* notification_cq, void* tag)
+ : BaseAsyncRequest(server, context, stream, call_cq, tag) {
grpc_call_details_init(&call_details_);
GPR_ASSERT(notification_cq);
GPR_ASSERT(call_cq);
- grpc_server_request_call(server->server_, &call_, &call_details_, &initial_metadata_array_,
- call_cq->cq(), notification_cq->cq(), this);
+ grpc_server_request_call(server->server_, &call_, &call_details_,
+ &initial_metadata_array_, call_cq->cq(),
+ notification_cq->cq(), this);
}
bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) {