diff options
author | Yang Gao <yangg@google.com> | 2015-03-05 13:46:41 -0800 |
---|---|---|
committer | Yang Gao <yangg@google.com> | 2015-03-05 13:46:41 -0800 |
commit | c79a57c3a9ffea6f5a1cbea7b061d204a11281db (patch) | |
tree | f4d4414e2f66d122702ae07fa9e8e4d872da6e7c /include | |
parent | 5b73bb114234ee1afe1a2e26c0de88b25fd621c5 (diff) | |
parent | 9709188eb8302aae7270fe2b4239a46bd9b8bbd6 (diff) |
Merge branch 'master' into untypedAPI
Diffstat (limited to 'include')
50 files changed, 359 insertions, 440 deletions
diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index b4a654c4a9..f86a1ea518 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_ASYNC_UNARY_CALL_H__ -#define __GRPCPP_ASYNC_UNARY_CALL_H__ +#ifndef GRPCXX_ASYNC_UNARY_CALL_H +#define GRPCXX_ASYNC_UNARY_CALL_H #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> @@ -45,11 +45,11 @@ namespace grpc { template <class R> -class ClientAsyncResponseReader final { +class ClientAsyncResponseReader GRPC_FINAL { public: ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, - const google::protobuf::Message& request, void* tag) + const grpc::protobuf::Message& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); @@ -77,9 +77,8 @@ class ClientAsyncResponseReader final { call_.PerformOps(&finish_buf_); } - private: - ClientContext* context_ = nullptr; + ClientContext* context_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; @@ -87,7 +86,8 @@ class ClientAsyncResponseReader final { }; template <class W> -class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { +class ServerAsyncResponseWriter GRPC_FINAL + : public ServerAsyncStreamingInterface { public: explicit ServerAsyncResponseWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -127,7 +127,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { } private: - void BindCall(Call* call) override { call_ = *call; } + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } Call call_; ServerContext* ctx_; @@ -137,4 +137,4 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { } // namespace grpc -#endif // __GRPCPP_ASYNC_UNARY_CALL_H__ +#endif // GRPCXX_ASYNC_UNARY_CALL_H diff --git a/include/grpc++/channel_arguments.h b/include/grpc++/channel_arguments.h index 75c3cf45b4..ad96ef14ae 100644 --- a/include/grpc++/channel_arguments.h +++ b/include/grpc++/channel_arguments.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_CHANNEL_ARGUMENTS_H_ -#define __GRPCPP_CHANNEL_ARGUMENTS_H_ +#ifndef GRPCXX_CHANNEL_ARGUMENTS_H +#define GRPCXX_CHANNEL_ARGUMENTS_H #include <vector> #include <list> @@ -82,4 +82,4 @@ class ChannelArguments { } // namespace grpc -#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_ +#endif // GRPCXX_CHANNEL_ARGUMENTS_H diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 890fd04d82..51260aed3d 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -31,18 +31,12 @@ * */ -#ifndef __GRPCPP_CHANNEL_INTERFACE_H__ -#define __GRPCPP_CHANNEL_INTERFACE_H__ +#ifndef GRPCXX_CHANNEL_INTERFACE_H +#define GRPCXX_CHANNEL_INTERFACE_H #include <grpc++/status.h> #include <grpc++/impl/call.h> -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - struct grpc_call; namespace grpc { @@ -63,4 +57,4 @@ class ChannelInterface : public CallHook { } // namespace grpc -#endif // __GRPCPP_CHANNEL_INTERFACE_H__ +#endif // GRPCXX_CHANNEL_INTERFACE_H diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 1e7e6bfad7..c55d7c2d58 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_CLIENT_CONTEXT_H__ -#define __GRPCPP_CLIENT_CONTEXT_H__ +#ifndef GRPCXX_CLIENT_CONTEXT_H +#define GRPCXX_CLIENT_CONTEXT_H #include <chrono> #include <map> @@ -47,12 +47,6 @@ using std::chrono::system_clock; struct grpc_call; struct grpc_completion_queue; -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - namespace grpc { class CallOpBuffer; @@ -139,7 +133,7 @@ class ClientContext { return authority_; } - bool initial_metadata_received_ = false; + bool initial_metadata_received_; grpc_call *call_; grpc_completion_queue *cq_; gpr_timespec absolute_deadline_; @@ -151,4 +145,4 @@ class ClientContext { } // namespace grpc -#endif // __GRPCPP_CLIENT_CONTEXT_H__ +#endif // GRPCXX_CLIENT_CONTEXT_H diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 0075482d71..f741e3c36b 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_COMPLETION_QUEUE_H__ -#define __GRPCPP_COMPLETION_QUEUE_H__ +#ifndef GRPCXX_COMPLETION_QUEUE_H +#define GRPCXX_COMPLETION_QUEUE_H #include <grpc++/impl/client_unary_call.h> @@ -106,8 +106,8 @@ class CompletionQueue { friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); + const grpc::protobuf::Message &request, + grpc::protobuf::Message *result); // Wraps grpc_completion_queue_pluck. // Cannot be mixed with calls to Next(). @@ -121,4 +121,4 @@ class CompletionQueue { } // namespace grpc -#endif // __GRPCPP_COMPLETION_QUEUE_H__ +#endif // GRPCXX_COMPLETION_QUEUE_H diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 2dced12e37..327ed7a549 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -31,15 +31,35 @@ * */ -#ifndef __GRPCPP_CONFIG_H__ -#define __GRPCPP_CONFIG_H__ +#ifndef GRPCXX_CONFIG_H +#define GRPCXX_CONFIG_H +#ifdef GRPC_OLD_CXX +#define GRPC_FINAL +#define GRPC_OVERRIDE +#else +#define GRPC_FINAL final +#define GRPC_OVERRIDE override +#endif + +#ifndef GRPC_CUSTOM_STRING #include <string> +#define GRPC_CUSTOM_STRING std::string +#endif + +#ifndef GRPC_CUSTOM_MESSAGE +#include <google/protobuf/message.h> +#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message +#endif namespace grpc { -typedef std::string string; +typedef GRPC_CUSTOM_STRING string; + +namespace protobuf { +typedef GRPC_CUSTOM_MESSAGE Message; +} // namespace protobuf } // namespace grpc -#endif // __GRPCPP_CONFIG_H__ +#endif // GRPCXX_CONFIG_H diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index 80ca0c4dc4..3f13188365 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_CREATE_CHANNEL_H__ -#define __GRPCPP_CREATE_CHANNEL_H__ +#ifndef GRPCXX_CREATE_CHANNEL_H +#define GRPCXX_CREATE_CHANNEL_H #include <memory> @@ -55,4 +55,4 @@ std::shared_ptr<ChannelInterface> CreateChannel( } // namespace grpc -#endif // __GRPCPP_CREATE_CHANNEL_H__ +#endif // GRPCXX_CREATE_CHANNEL_H diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index 5cbcca3aa5..12c1a2fc98 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_CREDENTIALS_H_ -#define __GRPCPP_CREDENTIALS_H_ +#ifndef GRPCXX_CREDENTIALS_H +#define GRPCXX_CREDENTIALS_H #include <chrono> #include <memory> @@ -47,7 +47,7 @@ namespace grpc { // to creating an instance using CredentialsFactory, and passing it down // during channel construction. -class Credentials final { +class Credentials GRPC_FINAL { public: ~Credentials(); @@ -133,4 +133,4 @@ class CredentialsFactory { } // namespace grpc -#endif // __GRPCPP_CREDENTIALS_H_ +#endif // GRPCXX_CREDENTIALS_H diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 341710f7a2..5de5662973 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -31,22 +31,17 @@ * */ -#ifndef __GRPCPP_CALL_H__ -#define __GRPCPP_CALL_H__ +#ifndef GRPCXX_IMPL_CALL_H +#define GRPCXX_IMPL_CALL_H #include <grpc/grpc.h> +#include <grpc++/config.h> #include <grpc++/status.h> #include <grpc++/completion_queue.h> #include <memory> #include <map> -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - struct grpc_call; struct grpc_op; @@ -56,7 +51,7 @@ class Call; class CallOpBuffer : public CompletionQueueTag { public: - CallOpBuffer() : return_tag_(this) {} + CallOpBuffer(); ~CallOpBuffer(); void Reset(void *next_return_tag); @@ -66,8 +61,8 @@ class CallOpBuffer : public CompletionQueueTag { std::multimap<grpc::string, grpc::string> *metadata); void AddSendInitialMetadata(ClientContext *ctx); void AddRecvInitialMetadata(ClientContext *ctx); - void AddSendMessage(const google::protobuf::Message &message); - void AddRecvMessage(google::protobuf::Message *message); + void AddSendMessage(const grpc::protobuf::Message &message); + void AddRecvMessage(grpc::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(ClientContext *ctx, Status *status); void AddServerSendStatus(std::multimap<grpc::string, grpc::string> *metadata, @@ -80,40 +75,40 @@ class CallOpBuffer : public CompletionQueueTag { void FillOps(grpc_op *ops, size_t *nops); // Called by completion queue just prior to returning from Next() or Pluck() - bool FinalizeResult(void **tag, bool *status) override; + bool FinalizeResult(void **tag, bool *status) GRPC_OVERRIDE; - bool got_message = false; + bool got_message; private: - void *return_tag_ = nullptr; + void *return_tag_; // Send initial metadata - bool send_initial_metadata_ = false; - size_t initial_metadata_count_ = 0; - grpc_metadata *initial_metadata_ = nullptr; + bool send_initial_metadata_; + size_t initial_metadata_count_; + grpc_metadata *initial_metadata_; // Recv initial metadta - std::multimap<grpc::string, grpc::string> *recv_initial_metadata_ = nullptr; - grpc_metadata_array recv_initial_metadata_arr_ = {0, 0, nullptr}; + std::multimap<grpc::string, grpc::string> *recv_initial_metadata_; + grpc_metadata_array recv_initial_metadata_arr_; // Send message - const google::protobuf::Message *send_message_ = nullptr; - grpc_byte_buffer *send_message_buf_ = nullptr; + const grpc::protobuf::Message *send_message_; + grpc_byte_buffer *send_message_buf_; // Recv message - google::protobuf::Message *recv_message_ = nullptr; - grpc_byte_buffer *recv_message_buf_ = nullptr; + grpc::protobuf::Message *recv_message_; + grpc_byte_buffer *recv_message_buf_; // Client send close - bool client_send_close_ = false; + bool client_send_close_; // Client recv status - std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_ = nullptr; - Status *recv_status_ = nullptr; - grpc_metadata_array recv_trailing_metadata_arr_ = {0, 0, nullptr}; - grpc_status_code status_code_ = GRPC_STATUS_OK; - char *status_details_ = nullptr; - size_t status_details_capacity_ = 0; + std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_; + Status *recv_status_; + grpc_metadata_array recv_trailing_metadata_arr_; + grpc_status_code status_code_; + char *status_details_; + size_t status_details_capacity_; // Server send status - const Status *send_status_ = nullptr; - size_t trailing_metadata_count_ = 0; - grpc_metadata *trailing_metadata_ = nullptr; + const Status *send_status_; + size_t trailing_metadata_count_; + grpc_metadata *trailing_metadata_; int cancelled_buf_; - bool *recv_closed_ = nullptr; + bool *recv_closed_; }; // Channel and Server implement this to allow them to hook performing ops @@ -124,7 +119,7 @@ class CallHook { }; // Straightforward wrapping of the C call object -class Call final { +class Call GRPC_FINAL { public: /* call is owned by the caller */ Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq); @@ -142,4 +137,4 @@ class Call final { } // namespace grpc -#endif // __GRPCPP_CALL_INTERFACE_H__ +#endif // GRPCXX_IMPL_CALL_H diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index f25ded7a24..fd9715da50 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -31,14 +31,10 @@ * */ -#ifndef __GRPCPP_CLIENT_UNARY_CALL_H__ -#define __GRPCPP_CLIENT_UNARY_CALL_H__ +#ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H +#define GRPCXX_IMPL_CLIENT_UNARY_CALL_H -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google +#include <grpc++/config.h> namespace grpc { @@ -51,9 +47,9 @@ class Status; // Wrapper that performs a blocking unary call Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); + const grpc::protobuf::Message &request, + grpc::protobuf::Message *result); } // namespace grpc -#endif +#endif // GRPCXX_IMPL_CLIENT_UNARY_CALL_H diff --git a/include/grpc++/impl/internal_stub.h b/include/grpc++/impl/internal_stub.h index 25290121cd..2cbf1d901b 100644 --- a/include/grpc++/impl/internal_stub.h +++ b/include/grpc++/impl/internal_stub.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_IMPL_INTERNAL_STUB_H__ -#define __GRPCPP_IMPL_INTERNAL_STUB_H__ +#ifndef GRPCXX_IMPL_INTERNAL_STUB_H +#define GRPCXX_IMPL_INTERNAL_STUB_H #include <memory> @@ -57,4 +57,4 @@ class InternalStub { } // namespace grpc -#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__ +#endif // GRPCXX_IMPL_INTERNAL_STUB_H diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index 0236b1182a..e8909ac184 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -31,14 +31,8 @@ * */ -#ifndef __GRPCPP_IMPL_RPC_METHOD_H__ -#define __GRPCPP_IMPL_RPC_METHOD_H__ - -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google +#ifndef GRPCXX_IMPL_RPC_METHOD_H +#define GRPCXX_IMPL_RPC_METHOD_H namespace grpc { @@ -66,4 +60,4 @@ class RpcMethod { } // namespace grpc -#endif // __GRPCPP_IMPL_RPC_METHOD_H__ +#endif // GRPCXX_IMPL_RPC_METHOD_H diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index ffd5c34ef6..097667827a 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -31,18 +31,18 @@ * */ -#ifndef __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ -#define __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ +#ifndef GRPCXX_IMPL_RPC_SERVICE_METHOD_H +#define GRPCXX_IMPL_RPC_SERVICE_METHOD_H #include <functional> #include <map> #include <memory> #include <vector> +#include <grpc++/config.h> #include <grpc++/impl/rpc_method.h> #include <grpc++/status.h> #include <grpc++/stream.h> -#include <google/protobuf/message.h> namespace grpc { class ServerContext; @@ -56,13 +56,13 @@ class MethodHandler { virtual ~MethodHandler() {} struct HandlerParameter { HandlerParameter(Call* c, ServerContext* context, - const google::protobuf::Message* req, - google::protobuf::Message* resp) + const grpc::protobuf::Message* req, + grpc::protobuf::Message* resp) : call(c), server_context(context), request(req), response(resp) {} Call* call; ServerContext* server_context; - const google::protobuf::Message* request; - google::protobuf::Message* response; + const grpc::protobuf::Message* request; + grpc::protobuf::Message* response; }; virtual Status RunHandler(const HandlerParameter& param) = 0; }; @@ -77,7 +77,7 @@ class RpcMethodHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - Status RunHandler(const HandlerParameter& param) final { + Status RunHandler(const HandlerParameter& param) GRPC_FINAL { // Invoke application function, cast proto messages to their actual types. return func_(service_, param.server_context, dynamic_cast<const RequestType*>(param.request), @@ -102,7 +102,7 @@ class ClientStreamingHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - Status RunHandler(const HandlerParameter& param) final { + Status RunHandler(const HandlerParameter& param) GRPC_FINAL { ServerReader<RequestType> reader(param.call, param.server_context); return func_(service_, param.server_context, &reader, dynamic_cast<ResponseType*>(param.response)); @@ -124,7 +124,7 @@ class ServerStreamingHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - Status RunHandler(const HandlerParameter& param) final { + Status RunHandler(const HandlerParameter& param) GRPC_FINAL { ServerWriter<ResponseType> writer(param.call, param.server_context); return func_(service_, param.server_context, dynamic_cast<const RequestType*>(param.request), &writer); @@ -147,7 +147,7 @@ class BidiStreamingHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - Status RunHandler(const HandlerParameter& param) final { + Status RunHandler(const HandlerParameter& param) GRPC_FINAL { ServerReaderWriter<ResponseType, RequestType> stream(param.call, param.server_context); return func_(service_, param.server_context, &stream); @@ -165,8 +165,8 @@ class RpcServiceMethod : public RpcMethod { // Takes ownership of the handler and two prototype objects. RpcServiceMethod(const char* name, RpcMethod::RpcType type, MethodHandler* handler, - google::protobuf::Message* request_prototype, - google::protobuf::Message* response_prototype) + grpc::protobuf::Message* request_prototype, + grpc::protobuf::Message* response_prototype) : RpcMethod(name, type), handler_(handler), request_prototype_(request_prototype), @@ -174,17 +174,17 @@ class RpcServiceMethod : public RpcMethod { MethodHandler* handler() { return handler_.get(); } - google::protobuf::Message* AllocateRequestProto() { + grpc::protobuf::Message* AllocateRequestProto() { return request_prototype_->New(); } - google::protobuf::Message* AllocateResponseProto() { + grpc::protobuf::Message* AllocateResponseProto() { return response_prototype_->New(); } private: std::unique_ptr<MethodHandler> handler_; - std::unique_ptr<google::protobuf::Message> request_prototype_; - std::unique_ptr<google::protobuf::Message> response_prototype_; + std::unique_ptr<grpc::protobuf::Message> request_prototype_; + std::unique_ptr<grpc::protobuf::Message> response_prototype_; }; // This class contains all the method information for an rpc service. It is @@ -203,4 +203,4 @@ class RpcService { } // namespace grpc -#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ +#endif // GRPCXX_IMPL_RPC_SERVICE_METHOD_H diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index cafa2696ab..7cd3ddad6b 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -31,14 +31,10 @@ * */ -#ifndef __GRPCPP_IMPL_SERVICE_TYPE_H__ -#define __GRPCPP_IMPL_SERVICE_TYPE_H__ +#ifndef GRPCXX_IMPL_SERVICE_TYPE_H +#define GRPCXX_IMPL_SERVICE_TYPE_H -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google +#include <grpc++/config.h> namespace grpc { @@ -72,14 +68,18 @@ class AsynchronousService { public: virtual void RequestAsyncCall(void* registered_method, ServerContext* context, - ::google::protobuf::Message* request, + ::grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) = 0; }; AsynchronousService(CompletionQueue* cq, const char** method_names, size_t method_count) - : cq_(cq), method_names_(method_names), method_count_(method_count) {} + : cq_(cq), + dispatch_impl_(nullptr), + method_names_(method_names), + method_count_(method_count), + request_args_(nullptr) {} ~AsynchronousService() { delete[] request_args_; } @@ -87,7 +87,7 @@ class AsynchronousService { protected: void RequestAsyncUnary(int index, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) { dispatch_impl_->RequestAsyncCall(request_args_[index], context, request, @@ -100,7 +100,7 @@ class AsynchronousService { stream, cq, tag); } void RequestServerStreaming(int index, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) { dispatch_impl_->RequestAsyncCall(request_args_[index], context, request, @@ -116,12 +116,12 @@ class AsynchronousService { private: friend class Server; CompletionQueue* const cq_; - DispatchImpl* dispatch_impl_ = nullptr; + DispatchImpl* dispatch_impl_; const char** const method_names_; size_t method_count_; - void** request_args_ = nullptr; + void** request_args_; }; } // namespace grpc -#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ +#endif // GRPCXX_IMPL_SERVICE_TYPE_H diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 429c0ff3cf..e3ba93e487 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_SERVER_H__ -#define __GRPCPP_SERVER_H__ +#ifndef GRPCXX_SERVER_H +#define GRPCXX_SERVER_H #include <condition_variable> #include <list> @@ -47,12 +47,6 @@ struct grpc_server; -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - namespace grpc { class AsynchronousService; class RpcService; @@ -61,8 +55,8 @@ class ServerCredentials; class ThreadPoolInterface; // Currently it only supports handling rpcs in a single thread. -class Server final : private CallHook, - private AsynchronousService::DispatchImpl { +class Server GRPC_FINAL : private CallHook, + private AsynchronousService::DispatchImpl { public: ~Server(); @@ -97,11 +91,11 @@ class Server final : private CallHook, void RunRpc(); void ScheduleCallback(); - void PerformOpsOnCall(CallOpBuffer* ops, Call* call) override; + void PerformOpsOnCall(CallOpBuffer* ops, Call* call) GRPC_OVERRIDE; // DispatchImpl void RequestAsyncCall(void* registered_method, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag); @@ -130,4 +124,4 @@ class Server final : private CallHook, } // namespace grpc -#endif // __GRPCPP_SERVER_H__ +#endif // GRPCXX_SERVER_H diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index faa9c17c58..60c891ce81 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_SERVER_BUILDER_H__ -#define __GRPCPP_SERVER_BUILDER_H__ +#ifndef GRPCXX_SERVER_BUILDER_H +#define GRPCXX_SERVER_BUILDER_H #include <memory> #include <vector> @@ -87,9 +87,9 @@ class ServerBuilder { std::vector<AsynchronousService*> async_services_; std::vector<grpc::string> ports_; std::shared_ptr<ServerCredentials> creds_; - ThreadPoolInterface* thread_pool_ = nullptr; + ThreadPoolInterface* thread_pool_; }; } // namespace grpc -#endif // __GRPCPP_SERVER_BUILDER_H__ +#endif // GRPCXX_SERVER_BUILDER_H diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index d327d8b41e..a986fff46b 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -31,13 +31,13 @@ * */ -#ifndef __GRPCPP_SERVER_CONTEXT_H_ -#define __GRPCPP_SERVER_CONTEXT_H_ +#ifndef GRPCXX_SERVER_CONTEXT_H +#define GRPCXX_SERVER_CONTEXT_H #include <chrono> #include <map> -#include "config.h" +#include <grpc++/config.h> struct gpr_timespec; struct grpc_metadata; @@ -66,7 +66,7 @@ class CompletionQueue; class Server; // Interface of server side rpc context. -class ServerContext final { +class ServerContext GRPC_FINAL { public: ServerContext(); // for async calls ~ServerContext(); @@ -108,12 +108,12 @@ class ServerContext final { ServerContext(gpr_timespec deadline, grpc_metadata* metadata, size_t metadata_count); - CompletionOp* completion_op_ = nullptr; + CompletionOp* completion_op_; std::chrono::system_clock::time_point deadline_; - grpc_call* call_ = nullptr; - CompletionQueue* cq_ = nullptr; - bool sent_initial_metadata_ = false; + grpc_call* call_; + CompletionQueue* cq_; + bool sent_initial_metadata_; std::multimap<grpc::string, grpc::string> client_metadata_; std::multimap<grpc::string, grpc::string> initial_metadata_; std::multimap<grpc::string, grpc::string> trailing_metadata_; @@ -121,4 +121,4 @@ class ServerContext final { } // namespace grpc -#endif // __GRPCPP_SERVER_CONTEXT_H_ +#endif // GRPCXX_SERVER_CONTEXT_H diff --git a/include/grpc++/server_credentials.h b/include/grpc++/server_credentials.h index 5c6787a077..45cd279e0b 100644 --- a/include/grpc++/server_credentials.h +++ b/include/grpc++/server_credentials.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_SERVER_CREDENTIALS_H_ -#define __GRPCPP_SERVER_CREDENTIALS_H_ +#ifndef GRPCXX_SERVER_CREDENTIALS_H +#define GRPCXX_SERVER_CREDENTIALS_H #include <memory> #include <vector> @@ -44,7 +44,7 @@ struct grpc_server_credentials; namespace grpc { // grpc_server_credentials wrapper class. -class ServerCredentials final { +class ServerCredentials GRPC_FINAL { public: ~ServerCredentials(); @@ -79,4 +79,4 @@ class ServerCredentialsFactory { } // namespace grpc -#endif // __GRPCPP_SERVER_CREDENTIALS_H_ +#endif // GRPCXX_SERVER_CREDENTIALS_H diff --git a/include/grpc++/status.h b/include/grpc++/status.h index 1dfb0c997c..8073319eab 100644 --- a/include/grpc++/status.h +++ b/include/grpc++/status.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_STATUS_H__ -#define __GRPCPP_STATUS_H__ +#ifndef GRPCXX_STATUS_H +#define GRPCXX_STATUS_H #include <grpc++/status_code_enum.h> #include <grpc++/config.h> @@ -62,4 +62,4 @@ class Status { } // namespace grpc -#endif // __GRPCPP_STATUS_H__ +#endif // GRPCXX_STATUS_H diff --git a/include/grpc++/status_code_enum.h b/include/grpc++/status_code_enum.h index 0ec0a976d2..2211c964cd 100644 --- a/include/grpc++/status_code_enum.h +++ b/include/grpc++/status_code_enum.h @@ -31,57 +31,43 @@ * */ -#ifndef __GRPCPP_STATUS_CODE_ENUM_H__ -#define __GRPCPP_STATUS_CODE_ENUM_H__ +#ifndef GRPCXX_STATUS_CODE_ENUM_H +#define GRPCXX_STATUS_CODE_ENUM_H namespace grpc { enum StatusCode { - /* Not an error; returned on success - - HTTP Mapping: 200 OK */ + /* Not an error; returned on success */ OK = 0, - /* The operation was cancelled (typically by the caller). - - HTTP Mapping: 499 Client Closed Request */ + /* The operation was cancelled (typically by the caller). */ CANCELLED = 1, /* Unknown error. An example of where this error may be returned is if a Status value received from another address space belongs to an error-space that is not known in this address space. Also errors raised by APIs that do not return enough error information - may be converted to this error. - - HTTP Mapping: 500 Internal Server Error */ + may be converted to this error. */ UNKNOWN = 2, /* Client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the system - (e.g., a malformed file name). - - HTTP Mapping: 400 Bad Request */ + (e.g., a malformed file name). */ INVALID_ARGUMENT = 3, /* Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long - enough for the deadline to expire. - - HTTP Mapping: 504 Gateway Timeout */ + enough for the deadline to expire. */ DEADLINE_EXCEEDED = 4, - /* Some requested entity (e.g., file or directory) was not found. - - HTTP Mapping: 404 Not Found */ + /* Some requested entity (e.g., file or directory) was not found. */ NOT_FOUND = 5, /* Some entity that we attempted to create (e.g., file or directory) - already exists. - - HTTP Mapping: 409 Conflict */ + already exists. */ ALREADY_EXISTS = 6, /* The caller does not have permission to execute the specified @@ -89,21 +75,15 @@ enum StatusCode { caused by exhausting some resource (use RESOURCE_EXHAUSTED instead for those errors). PERMISSION_DENIED must not be used if the caller can not be identified (use UNAUTHENTICATED - instead for those errors). - - HTTP Mapping: 403 Forbidden */ + instead for those errors). */ PERMISSION_DENIED = 7, /* The request does not have valid authentication credentials for the - operation. - - HTTP Mapping: 401 Unauthorized */ + operation. */ UNAUTHENTICATED = 16, /* Some resource has been exhausted, perhaps a per-user quota, or - perhaps the entire file system is out of space. - - HTTP Mapping: 429 Too Many Requests */ + perhaps the entire file system is out of space. */ RESOURCE_EXHAUSTED = 8, /* Operation was rejected because the system is not in a state @@ -124,23 +104,14 @@ enum StatusCode { (d) Use FAILED_PRECONDITION if the client performs conditional REST Get/Update/Delete on a resource and the resource on the server does not match the condition. E.g., conflicting - read-modify-write on the same resource. - - HTTP Mapping: 400 Bad Request - - NOTE: HTTP spec says 412 Precondition Failed should only be used if - the request contains Etag related headers. So if the server does see - Etag related headers in the request, it may choose to return 412 - instead of 400 for this error code. */ + read-modify-write on the same resource. */ FAILED_PRECONDITION = 9, /* The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc. See litmus test above for deciding between FAILED_PRECONDITION, - ABORTED, and UNAVAILABLE. - - HTTP Mapping: 409 Conflict */ + ABORTED, and UNAVAILABLE. */ ABORTED = 10, /* Operation was attempted past the valid range. E.g., seeking or @@ -157,21 +128,15 @@ enum StatusCode { OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) when it applies so that callers who are iterating through a space can easily look for an OUT_OF_RANGE error to detect when - they are done. - - HTTP Mapping: 400 Bad Request */ + they are done. */ OUT_OF_RANGE = 11, - /* Operation is not implemented or not supported/enabled in this service. - - HTTP Mapping: 501 Not Implemented */ + /* Operation is not implemented or not supported/enabled in this service. */ UNIMPLEMENTED = 12, /* Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, - something is very broken. - - HTTP Mapping: 500 Internal Server Error */ + something is very broken. */ INTERNAL = 13, /* The service is currently unavailable. This is a most likely a @@ -179,14 +144,10 @@ enum StatusCode { a backoff. See litmus test above for deciding between FAILED_PRECONDITION, - ABORTED, and UNAVAILABLE. - - HTTP Mapping: 503 Service Unavailable */ + ABORTED, and UNAVAILABLE. */ UNAVAILABLE = 14, - /* Unrecoverable data loss or corruption. - - HTTP Mapping: 500 Internal Server Error */ + /* Unrecoverable data loss or corruption. */ DATA_LOSS = 15, /* Force users to include a default branch: */ @@ -195,4 +156,4 @@ enum StatusCode { } // namespace grpc -#endif // __GRPCPP_STATUS_CODE_ENUM_H_ +#endif // GRPCXX_STATUS_CODE_ENUM_H diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index cd95ff7c92..7625bcc38d 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_STREAM_H__ -#define __GRPCPP_STREAM_H__ +#ifndef GRPCXX_STREAM_H +#define GRPCXX_STREAM_H #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> @@ -83,12 +83,12 @@ class WriterInterface { }; template <class R> -class ClientReader final : public ClientStreamingInterface, - public ReaderInterface<R> { +class ClientReader GRPC_FINAL : public ClientStreamingInterface, + public ReaderInterface<R> { public: // Blocking create a stream and write the first request out. ClientReader(ChannelInterface* channel, const RpcMethod& method, - ClientContext* context, const google::protobuf::Message& request) + ClientContext* context, const grpc::protobuf::Message& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -111,7 +111,7 @@ class ClientReader final : public ClientStreamingInterface, GPR_ASSERT(cq_.Pluck(&buf)); } - virtual bool Read(R* msg) override { + virtual bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!context_->initial_metadata_received_) { buf.AddRecvInitialMetadata(context_); @@ -121,7 +121,7 @@ class ClientReader final : public ClientStreamingInterface, return cq_.Pluck(&buf) && buf.got_message; } - virtual Status Finish() override { + virtual Status Finish() GRPC_OVERRIDE { CallOpBuffer buf; Status status; buf.AddClientRecvStatus(context_, &status); @@ -137,12 +137,12 @@ class ClientReader final : public ClientStreamingInterface, }; template <class W> -class ClientWriter final : public ClientStreamingInterface, - public WriterInterface<W> { +class ClientWriter GRPC_FINAL : public ClientStreamingInterface, + public WriterInterface<W> { public: // Blocking create a stream. ClientWriter(ChannelInterface* channel, const RpcMethod& method, - ClientContext* context, google::protobuf::Message* response) + ClientContext* context, grpc::protobuf::Message* response) : context_(context), response_(response), call_(channel->CreateCall(method, context, &cq_)) { @@ -152,7 +152,7 @@ class ClientWriter final : public ClientStreamingInterface, cq_.Pluck(&buf); } - virtual bool Write(const W& msg) override { + virtual bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddSendMessage(msg); call_.PerformOps(&buf); @@ -167,7 +167,7 @@ class ClientWriter final : public ClientStreamingInterface, } // Read the final response and wait for the final status. - virtual Status Finish() override { + virtual Status Finish() GRPC_OVERRIDE { CallOpBuffer buf; Status status; buf.AddRecvMessage(response_); @@ -179,16 +179,16 @@ class ClientWriter final : public ClientStreamingInterface, private: ClientContext* context_; - google::protobuf::Message* const response_; + grpc::protobuf::Message* const response_; CompletionQueue cq_; Call call_; }; // Client-side interface for bi-directional streaming. template <class W, class R> -class ClientReaderWriter final : public ClientStreamingInterface, - public WriterInterface<W>, - public ReaderInterface<R> { +class ClientReaderWriter GRPC_FINAL : public ClientStreamingInterface, + public WriterInterface<W>, + public ReaderInterface<R> { public: // Blocking create a stream. ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, @@ -213,7 +213,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, GPR_ASSERT(cq_.Pluck(&buf)); } - virtual bool Read(R* msg) override { + virtual bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!context_->initial_metadata_received_) { buf.AddRecvInitialMetadata(context_); @@ -223,7 +223,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, return cq_.Pluck(&buf) && buf.got_message; } - virtual bool Write(const W& msg) override { + virtual bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddSendMessage(msg); call_.PerformOps(&buf); @@ -237,7 +237,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, return cq_.Pluck(&buf); } - virtual Status Finish() override { + virtual Status Finish() GRPC_OVERRIDE { CallOpBuffer buf; Status status; buf.AddClientRecvStatus(context_, &status); @@ -253,7 +253,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, }; template <class R> -class ServerReader final : public ReaderInterface<R> { +class ServerReader GRPC_FINAL : public ReaderInterface<R> { public: ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -267,7 +267,7 @@ class ServerReader final : public ReaderInterface<R> { call_->cq()->Pluck(&buf); } - virtual bool Read(R* msg) override { + virtual bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddRecvMessage(msg); call_->PerformOps(&buf); @@ -280,7 +280,7 @@ class ServerReader final : public ReaderInterface<R> { }; template <class W> -class ServerWriter final : public WriterInterface<W> { +class ServerWriter GRPC_FINAL : public WriterInterface<W> { public: ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -294,7 +294,7 @@ class ServerWriter final : public WriterInterface<W> { call_->cq()->Pluck(&buf); } - virtual bool Write(const W& msg) override { + virtual bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!ctx_->sent_initial_metadata_) { buf.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -312,8 +312,8 @@ class ServerWriter final : public WriterInterface<W> { // Server-side interface for bi-directional streaming. template <class W, class R> -class ServerReaderWriter final : public WriterInterface<W>, - public ReaderInterface<R> { +class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>, + public ReaderInterface<R> { public: ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -327,14 +327,14 @@ class ServerReaderWriter final : public WriterInterface<W>, call_->cq()->Pluck(&buf); } - virtual bool Read(R* msg) override { + virtual bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddRecvMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf) && buf.got_message; } - virtual bool Write(const W& msg) override { + virtual bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!ctx_->sent_initial_metadata_) { buf.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -380,13 +380,13 @@ class AsyncWriterInterface { }; template <class R> -class ClientAsyncReader final : public ClientAsyncStreamingInterface, - public AsyncReaderInterface<R> { +class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface, + public AsyncReaderInterface<R> { public: // Create a stream and write the first request out. ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, - const google::protobuf::Message& request, void* tag) + const grpc::protobuf::Message& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -395,7 +395,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, call_.PerformOps(&init_buf_); } - void ReadInitialMetadata(void* tag) override { + void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { GPR_ASSERT(!context_->initial_metadata_received_); meta_buf_.Reset(tag); @@ -403,7 +403,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - void Read(R* msg, void* tag) override { + void Read(R* msg, void* tag) GRPC_OVERRIDE { read_buf_.Reset(tag); if (!context_->initial_metadata_received_) { read_buf_.AddRecvInitialMetadata(context_); @@ -412,7 +412,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, call_.PerformOps(&read_buf_); } - void Finish(Status* status, void* tag) override { + void Finish(Status* status, void* tag) GRPC_OVERRIDE { finish_buf_.Reset(tag); if (!context_->initial_metadata_received_) { finish_buf_.AddRecvInitialMetadata(context_); @@ -422,7 +422,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, } private: - ClientContext* context_ = nullptr; + ClientContext* context_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; @@ -431,12 +431,12 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, }; template <class W> -class ClientAsyncWriter final : public ClientAsyncStreamingInterface, - public AsyncWriterInterface<W> { +class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface, + public AsyncWriterInterface<W> { public: ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, - google::protobuf::Message* response, void* tag) + grpc::protobuf::Message* response, void* tag) : context_(context), response_(response), call_(channel->CreateCall(method, context, cq)) { @@ -445,7 +445,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&init_buf_); } - void ReadInitialMetadata(void* tag) override { + void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { GPR_ASSERT(!context_->initial_metadata_received_); meta_buf_.Reset(tag); @@ -453,7 +453,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - void Write(const W& msg, void* tag) override { + void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_buf_.Reset(tag); write_buf_.AddSendMessage(msg); call_.PerformOps(&write_buf_); @@ -465,7 +465,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&writes_done_buf_); } - void Finish(Status* status, void* tag) override { + void Finish(Status* status, void* tag) GRPC_OVERRIDE { finish_buf_.Reset(tag); if (!context_->initial_metadata_received_) { finish_buf_.AddRecvInitialMetadata(context_); @@ -476,8 +476,8 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, } private: - ClientContext* context_ = nullptr; - google::protobuf::Message* const response_; + ClientContext* context_; + grpc::protobuf::Message* const response_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; @@ -488,9 +488,9 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, // Client-side interface for bi-directional streaming. template <class W, class R> -class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, - public AsyncWriterInterface<W>, - public AsyncReaderInterface<R> { +class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncStreamingInterface, + public AsyncWriterInterface<W>, + public AsyncReaderInterface<R> { public: ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, @@ -501,7 +501,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&init_buf_); } - void ReadInitialMetadata(void* tag) override { + void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { GPR_ASSERT(!context_->initial_metadata_received_); meta_buf_.Reset(tag); @@ -509,7 +509,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - void Read(R* msg, void* tag) override { + void Read(R* msg, void* tag) GRPC_OVERRIDE { read_buf_.Reset(tag); if (!context_->initial_metadata_received_) { read_buf_.AddRecvInitialMetadata(context_); @@ -518,7 +518,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&read_buf_); } - void Write(const W& msg, void* tag) override { + void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_buf_.Reset(tag); write_buf_.AddSendMessage(msg); call_.PerformOps(&write_buf_); @@ -530,7 +530,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&writes_done_buf_); } - void Finish(Status* status, void* tag) override { + void Finish(Status* status, void* tag) GRPC_OVERRIDE { finish_buf_.Reset(tag); if (!context_->initial_metadata_received_) { finish_buf_.AddRecvInitialMetadata(context_); @@ -540,7 +540,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, } private: - ClientContext* context_ = nullptr; + ClientContext* context_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; @@ -551,13 +551,13 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, }; template <class W, class R> -class ServerAsyncReader : public ServerAsyncStreamingInterface, - public AsyncReaderInterface<R> { +class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, + public AsyncReaderInterface<R> { public: explicit ServerAsyncReader(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - void SendInitialMetadata(void* tag) override { + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { GPR_ASSERT(!ctx_->sent_initial_metadata_); meta_buf_.Reset(tag); @@ -566,7 +566,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - void Read(R* msg, void* tag) override { + void Read(R* msg, void* tag) GRPC_OVERRIDE { read_buf_.Reset(tag); read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); @@ -598,7 +598,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, } private: - void BindCall(Call* call) override { call_ = *call; } + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } Call call_; ServerContext* ctx_; @@ -608,13 +608,13 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, }; template <class W> -class ServerAsyncWriter : public ServerAsyncStreamingInterface, - public AsyncWriterInterface<W> { +class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, + public AsyncWriterInterface<W> { public: explicit ServerAsyncWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - void SendInitialMetadata(void* tag) override { + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { GPR_ASSERT(!ctx_->sent_initial_metadata_); meta_buf_.Reset(tag); @@ -623,7 +623,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - void Write(const W& msg, void* tag) override { + void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -644,7 +644,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, } private: - void BindCall(Call* call) override { call_ = *call; } + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } Call call_; ServerContext* ctx_; @@ -655,14 +655,14 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, // Server-side interface for bi-directional streaming. template <class W, class R> -class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, - public AsyncWriterInterface<W>, - public AsyncReaderInterface<R> { +class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, + public AsyncWriterInterface<W>, + public AsyncReaderInterface<R> { public: explicit ServerAsyncReaderWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - void SendInitialMetadata(void* tag) override { + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { GPR_ASSERT(!ctx_->sent_initial_metadata_); meta_buf_.Reset(tag); @@ -671,13 +671,13 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - virtual void Read(R* msg, void* tag) override { + virtual void Read(R* msg, void* tag) GRPC_OVERRIDE { read_buf_.Reset(tag); read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } - virtual void Write(const W& msg, void* tag) override { + virtual void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -698,7 +698,7 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, } private: - void BindCall(Call* call) override { call_ = *call; } + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } Call call_; ServerContext* ctx_; @@ -710,4 +710,4 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, } // namespace grpc -#endif // __GRPCPP_STREAM_H__ +#endif // GRPCXX_STREAM_H diff --git a/include/grpc++/thread_pool_interface.h b/include/grpc++/thread_pool_interface.h index c839249324..ead307f6a2 100644 --- a/include/grpc++/thread_pool_interface.h +++ b/include/grpc++/thread_pool_interface.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPCPP_THREAD_POOL_INTERFACE_H__ -#define __GRPCPP_THREAD_POOL_INTERFACE_H__ +#ifndef GRPCXX_THREAD_POOL_INTERFACE_H +#define GRPCXX_THREAD_POOL_INTERFACE_H #include <functional> @@ -49,4 +49,4 @@ class ThreadPoolInterface { } // namespace grpc -#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__ +#endif // GRPCXX_THREAD_POOL_INTERFACE_H diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h index 89d8557edf..0ff494cdec 100644 --- a/include/grpc/byte_buffer.h +++ b/include/grpc/byte_buffer.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_BYTE_BUFFER_H__ -#define __GRPC_BYTE_BUFFER_H__ +#ifndef GRPC_BYTE_BUFFER_H +#define GRPC_BYTE_BUFFER_H #include <grpc/grpc.h> #include <grpc/support/slice_buffer.h> @@ -47,4 +47,4 @@ struct grpc_byte_buffer { } data; }; -#endif /* __GRPC_BYTE_BUFFER_H__ */ +#endif /* GRPC_BYTE_BUFFER_H */ diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h index 4446e0c6b3..cb757cf642 100644 --- a/include/grpc/byte_buffer_reader.h +++ b/include/grpc/byte_buffer_reader.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_BYTE_BUFFER_READER_H__ -#define __GRPC_BYTE_BUFFER_READER_H__ +#ifndef GRPC_BYTE_BUFFER_READER_H +#define GRPC_BYTE_BUFFER_READER_H #include <grpc/grpc.h> #include <grpc/byte_buffer.h> @@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader { } current; }; -#endif /* __GRPC_BYTE_BUFFER_READER_H__ */ +#endif /* GRPC_BYTE_BUFFER_READER_H */ diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 4a720d11f8..bb1653101f 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_GRPC_H__ -#define __GRPC_GRPC_H__ +#ifndef GRPC_GRPC_H +#define GRPC_GRPC_H #include <grpc/status.h> @@ -632,4 +632,4 @@ void grpc_server_destroy(grpc_server *server); } #endif -#endif /* __GRPC_GRPC_H__ */ +#endif /* GRPC_GRPC_H */ diff --git a/include/grpc/grpc_http.h b/include/grpc/grpc_http.h index 757f53f9df..c41e87413f 100644 --- a/include/grpc/grpc_http.h +++ b/include/grpc/grpc_http.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_GRPC_HTTP_H__ -#define __GRPC_GRPC_HTTP_H__ +#ifndef GRPC_GRPC_HTTP_H +#define GRPC_GRPC_HTTP_H #ifdef __cplusplus extern "C" { @@ -64,4 +64,4 @@ typedef struct { } #endif -#endif /* __GRPC_GRPC_HTTP_H__ */ +#endif /* GRPC_GRPC_HTTP_H */ diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 4ba4ffc118..577f03e85f 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_SECURITY_H_ -#define GRPC_SECURITY_H_ +#ifndef GRPC_GRPC_SECURITY_H +#define GRPC_GRPC_SECURITY_H #include "grpc.h" #include "status.h" @@ -185,4 +185,4 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr); } #endif -#endif /* GRPC_SECURITY_H_ */ +#endif /* GRPC_GRPC_SECURITY_H */ diff --git a/include/grpc/status.h b/include/grpc/status.h index 76a71ed26f..456b9006e7 100644 --- a/include/grpc/status.h +++ b/include/grpc/status.h @@ -31,59 +31,45 @@ * */ -#ifndef __GRPC_STATUS_H__ -#define __GRPC_STATUS_H__ +#ifndef GRPC_STATUS_H +#define GRPC_STATUS_H #ifdef __cplusplus extern "C" { #endif typedef enum { - /* Not an error; returned on success - - HTTP Mapping: 200 OK */ + /* Not an error; returned on success */ GRPC_STATUS_OK = 0, - /* The operation was cancelled (typically by the caller). - - HTTP Mapping: 499 Client Closed Request */ + /* The operation was cancelled (typically by the caller). */ GRPC_STATUS_CANCELLED = 1, /* Unknown error. An example of where this error may be returned is if a Status value received from another address space belongs to an error-space that is not known in this address space. Also errors raised by APIs that do not return enough error information - may be converted to this error. - - HTTP Mapping: 500 Internal Server Error */ + may be converted to this error. */ GRPC_STATUS_UNKNOWN = 2, /* Client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the system - (e.g., a malformed file name). - - HTTP Mapping: 400 Bad Request */ + (e.g., a malformed file name). */ GRPC_STATUS_INVALID_ARGUMENT = 3, /* Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long - enough for the deadline to expire. - - HTTP Mapping: 504 Gateway Timeout */ + enough for the deadline to expire. */ GRPC_STATUS_DEADLINE_EXCEEDED = 4, - /* Some requested entity (e.g., file or directory) was not found. - - HTTP Mapping: 404 Not Found */ + /* Some requested entity (e.g., file or directory) was not found. */ GRPC_STATUS_NOT_FOUND = 5, /* Some entity that we attempted to create (e.g., file or directory) - already exists. - - HTTP Mapping: 409 Conflict */ + already exists. */ GRPC_STATUS_ALREADY_EXISTS = 6, /* The caller does not have permission to execute the specified @@ -91,21 +77,15 @@ typedef enum { caused by exhausting some resource (use RESOURCE_EXHAUSTED instead for those errors). PERMISSION_DENIED must not be used if the caller can not be identified (use UNAUTHENTICATED - instead for those errors). - - HTTP Mapping: 403 Forbidden */ + instead for those errors). */ GRPC_STATUS_PERMISSION_DENIED = 7, /* The request does not have valid authentication credentials for the - operation. - - HTTP Mapping: 401 Unauthorized */ + operation. */ GRPC_STATUS_UNAUTHENTICATED = 16, /* Some resource has been exhausted, perhaps a per-user quota, or - perhaps the entire file system is out of space. - - HTTP Mapping: 429 Too Many Requests */ + perhaps the entire file system is out of space. */ GRPC_STATUS_RESOURCE_EXHAUSTED = 8, /* Operation was rejected because the system is not in a state @@ -126,23 +106,14 @@ typedef enum { (d) Use FAILED_PRECONDITION if the client performs conditional REST Get/Update/Delete on a resource and the resource on the server does not match the condition. E.g., conflicting - read-modify-write on the same resource. - - HTTP Mapping: 400 Bad Request - - NOTE: HTTP spec says 412 Precondition Failed should only be used if - the request contains Etag related headers. So if the server does see - Etag related headers in the request, it may choose to return 412 - instead of 400 for this error code. */ + read-modify-write on the same resource. */ GRPC_STATUS_FAILED_PRECONDITION = 9, /* The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc. See litmus test above for deciding between FAILED_PRECONDITION, - ABORTED, and UNAVAILABLE. - - HTTP Mapping: 409 Conflict */ + ABORTED, and UNAVAILABLE. */ GRPC_STATUS_ABORTED = 10, /* Operation was attempted past the valid range. E.g., seeking or @@ -159,21 +130,15 @@ typedef enum { OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) when it applies so that callers who are iterating through a space can easily look for an OUT_OF_RANGE error to detect when - they are done. - - HTTP Mapping: 400 Bad Request */ + they are done. */ GRPC_STATUS_OUT_OF_RANGE = 11, - /* Operation is not implemented or not supported/enabled in this service. - - HTTP Mapping: 501 Not Implemented */ + /* Operation is not implemented or not supported/enabled in this service. */ GRPC_STATUS_UNIMPLEMENTED = 12, /* Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, - something is very broken. - - HTTP Mapping: 500 Internal Server Error */ + something is very broken. */ GRPC_STATUS_INTERNAL = 13, /* The service is currently unavailable. This is a most likely a @@ -181,14 +146,10 @@ typedef enum { a backoff. See litmus test above for deciding between FAILED_PRECONDITION, - ABORTED, and UNAVAILABLE. - - HTTP Mapping: 503 Service Unavailable */ + ABORTED, and UNAVAILABLE. */ GRPC_STATUS_UNAVAILABLE = 14, - /* Unrecoverable data loss or corruption. - - HTTP Mapping: 500 Internal Server Error */ + /* Unrecoverable data loss or corruption. */ GRPC_STATUS_DATA_LOSS = 15, /* Force users to include a default branch: */ @@ -199,4 +160,4 @@ typedef enum { } #endif -#endif /* __GRPC_STATUS_H__ */ +#endif /* GRPC_STATUS_H */ diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index 09ea97565b..509870f3e3 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_ALLOC_H__ -#define __GRPC_SUPPORT_ALLOC_H__ +#ifndef GRPC_SUPPORT_ALLOC_H +#define GRPC_SUPPORT_ALLOC_H #include <stddef.h> @@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr); } #endif -#endif /* __GRPC_SUPPORT_ALLOC_H__ */ +#endif /* GRPC_SUPPORT_ALLOC_H */ diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h index f1e30d31e8..feca6b30b2 100644 --- a/include/grpc/support/atm.h +++ b/include/grpc/support/atm.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_ATM_H__ -#define __GRPC_SUPPORT_ATM_H__ +#ifndef GRPC_SUPPORT_ATM_H +#define GRPC_SUPPORT_ATM_H /* This interface provides atomic operations and barriers. It is internal to gpr support code and should not be used outside it. @@ -89,4 +89,4 @@ #error could not determine platform for atm #endif -#endif /* __GRPC_SUPPORT_ATM_H__ */ +#endif /* GRPC_SUPPORT_ATM_H */ diff --git a/include/grpc/support/atm_gcc_atomic.h b/include/grpc/support/atm_gcc_atomic.h index 2ae24aec06..11d78b4097 100644 --- a/include/grpc/support/atm_gcc_atomic.h +++ b/include/grpc/support/atm_gcc_atomic.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ -#define __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ +#ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H +#define GRPC_SUPPORT_ATM_GCC_ATOMIC_H /* atm_platform.h for gcc and gcc-like compilers with the __atomic_* interface. */ @@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { __ATOMIC_RELAXED); } -#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */ +#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */ diff --git a/include/grpc/support/atm_gcc_sync.h b/include/grpc/support/atm_gcc_sync.h index cec62e1a20..e863bfd4c1 100644 --- a/include/grpc/support/atm_gcc_sync.h +++ b/include/grpc/support/atm_gcc_sync.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_ATM_GCC_SYNC_H__ -#define __GRPC_SUPPORT_ATM_GCC_SYNC_H__ +#ifndef GRPC_SUPPORT_ATM_GCC_SYNC_H +#define GRPC_SUPPORT_ATM_GCC_SYNC_H /* variant of atm_platform.h for gcc and gcc-like compiers with __sync_* interface */ @@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) { #define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n))) #define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n)) -#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */ +#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */ diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 9bb1cfec35..3b9113c28b 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_ATM_WIN32_H__ -#define __GRPC_SUPPORT_ATM_WIN32_H__ +#ifndef GRPC_SUPPORT_ATM_WIN32_H +#define GRPC_SUPPORT_ATM_WIN32_H /* Win32 variant of atm_platform.h */ #include <grpc/support/port_platform.h> @@ -105,4 +105,4 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) { return old; } -#endif /* __GRPC_SUPPORT_ATM_WIN32_H__ */ +#endif /* GRPC_SUPPORT_ATM_WIN32_H */ diff --git a/include/grpc/support/cancellable_platform.h b/include/grpc/support/cancellable_platform.h index e77f9f1577..e8e4b84e2f 100644 --- a/include/grpc/support/cancellable_platform.h +++ b/include/grpc/support/cancellable_platform.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ -#define __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ +#ifndef GRPC_SUPPORT_CANCELLABLE_PLATFORM_H +#define GRPC_SUPPORT_CANCELLABLE_PLATFORM_H #include <grpc/support/atm.h> #include <grpc/support/sync.h> @@ -53,4 +53,4 @@ typedef struct { struct gpr_cancellable_list_ waiters; } gpr_cancellable; -#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */ +#endif /* GRPC_SUPPORT_CANCELLABLE_PLATFORM_H */ diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index 20de12242c..c2350a07e8 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_CMDLINE_H__ -#define __GRPC_SUPPORT_CMDLINE_H__ +#ifndef GRPC_SUPPORT_CMDLINE_H +#define GRPC_SUPPORT_CMDLINE_H #ifdef __cplusplus extern "C" { @@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl); } #endif -#endif /* __GRPC_SUPPORT_CMDLINE_H__ */ +#endif /* GRPC_SUPPORT_CMDLINE_H */ diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index 580f12dad7..005c3c721c 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_INTERNAL_SUPPORT_CPU_H__ -#define __GRPC_INTERNAL_SUPPORT_CPU_H__ +#ifndef GRPC_SUPPORT_CPU_H +#define GRPC_SUPPORT_CPU_H #ifdef __cplusplus extern "C" { @@ -54,4 +54,4 @@ unsigned gpr_cpu_current_cpu(void); } // extern "C" #endif -#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ +#endif /* GRPC_SUPPORT_CPU_H */ diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index fb9d3d1691..64d08f0bf1 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -31,8 +31,11 @@ * */ -#ifndef __GRPC_SUPPORT_HISTOGRAM_H__ -#define __GRPC_SUPPORT_HISTOGRAM_H__ +#ifndef GRPC_SUPPORT_HISTOGRAM_H +#define GRPC_SUPPORT_HISTOGRAM_H + +#include <grpc/support/port_platform.h> +#include <stddef.h> #ifdef __cplusplus extern "C" { @@ -59,8 +62,15 @@ double gpr_histogram_count(gpr_histogram *histogram); double gpr_histogram_sum(gpr_histogram *histogram); double gpr_histogram_sum_of_squares(gpr_histogram *histogram); +const gpr_uint32 *gpr_histogram_get_contents(gpr_histogram *histogram, + size_t *count); +void gpr_histogram_merge_contents(gpr_histogram *histogram, + const gpr_uint32 *data, size_t data_count, + double min_seen, double max_seen, double sum, + double sum_of_squares, double count); + #ifdef __cplusplus } #endif -#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */ +#endif /* GRPC_SUPPORT_HISTOGRAM_H */ diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 2dac38a157..3cc2f498e8 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_HOST_PORT_H__ -#define __GRPC_SUPPORT_HOST_PORT_H__ +#ifndef GRPC_SUPPORT_HOST_PORT_H +#define GRPC_SUPPORT_HOST_PORT_H #ifdef __cplusplus extern "C" { @@ -59,4 +59,4 @@ void gpr_split_host_port(const char *name, char **host, char **port); } #endif -#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */ +#endif /* GRPC_SUPPORT_HOST_PORT_H */ diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index c142949f77..aad4f235d2 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_LOG_H__ -#define __GRPC_SUPPORT_LOG_H__ +#ifndef GRPC_SUPPORT_LOG_H +#define GRPC_SUPPORT_LOG_H #include <stdlib.h> /* for abort() */ #include <stdarg.h> @@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func); } #endif -#endif /* __GRPC_SUPPORT_LOG_H__ */ +#endif /* GRPC_SUPPORT_LOG_H */ diff --git a/include/grpc/support/log_win32.h b/include/grpc/support/log_win32.h index 52d6a70318..ad0edcdb89 100644 --- a/include/grpc/support/log_win32.h +++ b/include/grpc/support/log_win32.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_LOG_WIN32_H__ -#define __GRPC_SUPPORT_LOG_WIN32_H__ +#ifndef GRPC_SUPPORT_LOG_WIN32_H +#define GRPC_SUPPORT_LOG_WIN32_H #include <windows.h> @@ -50,4 +50,4 @@ char *gpr_format_message(DWORD messageid); } #endif -#endif /* __GRPC_SUPPORT_LOG_H__ */ +#endif /* GRPC_SUPPORT_LOG_WIN32_H */ diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 0a651757bc..f04c2e76af 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_PORT_PLATFORM_H__ -#define __GRPC_SUPPORT_PORT_PLATFORM_H__ +#ifndef GRPC_SUPPORT_PORT_PLATFORM_H +#define GRPC_SUPPORT_PORT_PLATFORM_H /* Override this file with one for your platform if you need to redefine things. */ @@ -206,4 +206,4 @@ typedef uintptr_t gpr_uintptr; power of two */ #define GPR_MAX_ALIGNMENT 16 -#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */ +#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */ diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h index 8a2129028f..9026602f15 100644 --- a/include/grpc/support/slice.h +++ b/include/grpc/support/slice.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_SLICE_H__ -#define __GRPC_SUPPORT_SLICE_H__ +#ifndef GRPC_SUPPORT_SLICE_H +#define GRPC_SUPPORT_SLICE_H #include <grpc/support/sync.h> @@ -175,4 +175,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b); } #endif -#endif /* __GRPC_SUPPORT_SLICE_H__ */ +#endif /* GRPC_SUPPORT_SLICE_H */ diff --git a/include/grpc/support/slice_buffer.h b/include/grpc/support/slice_buffer.h index 8b57f9f0b9..56f71ef234 100644 --- a/include/grpc/support/slice_buffer.h +++ b/include/grpc/support/slice_buffer.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_SLICE_BUFFER_H__ -#define __GRPC_SUPPORT_SLICE_BUFFER_H__ +#ifndef GRPC_SUPPORT_SLICE_BUFFER_H +#define GRPC_SUPPORT_SLICE_BUFFER_H #include <grpc/support/slice.h> @@ -81,4 +81,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb); } #endif -#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */ +#endif /* GRPC_SUPPORT_SLICE_BUFFER_H */ diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index bc99317f3c..35b2d12e77 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_SYNC_H__ -#define __GRPC_SUPPORT_SYNC_H__ +#ifndef GRPC_SUPPORT_SYNC_H +#define GRPC_SUPPORT_SYNC_H /* Synchronization primitives for GPR. The type gpr_mu provides a non-reentrant mutex (lock). @@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c); } #endif -#endif /* __GRPC_SUPPORT_SYNC_H__ */ +#endif /* GRPC_SUPPORT_SYNC_H */ diff --git a/include/grpc/support/sync_generic.h b/include/grpc/support/sync_generic.h index 3bae222cb0..bbd1b3ea2e 100644 --- a/include/grpc/support/sync_generic.h +++ b/include/grpc/support/sync_generic.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_SYNC_GENERIC_H__ -#define __GRPC_SUPPORT_SYNC_GENERIC_H__ +#ifndef GRPC_SUPPORT_SYNC_GENERIC_H +#define GRPC_SUPPORT_SYNC_GENERIC_H /* Generic type defintions for gpr_sync. */ #include <grpc/support/atm.h> @@ -58,4 +58,4 @@ typedef struct { #define GPR_STATS_INIT \ { 0 } -#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */ +#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */ diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index 8ba2c5b892..762d9ebe3c 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_SYNC_POSIX_H__ -#define __GRPC_SUPPORT_SYNC_POSIX_H__ +#ifndef GRPC_SUPPORT_SYNC_POSIX_H +#define GRPC_SUPPORT_SYNC_POSIX_H #include <grpc/support/sync_generic.h> @@ -44,4 +44,4 @@ typedef pthread_once_t gpr_once; #define GPR_ONCE_INIT PTHREAD_ONCE_INIT -#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */ +#endif /* GRPC_SUPPORT_SYNC_POSIX_H */ diff --git a/include/grpc/support/sync_win32.h b/include/grpc/support/sync_win32.h index 13823b8ee3..cb2a8663a0 100644 --- a/include/grpc/support/sync_win32.h +++ b/include/grpc/support/sync_win32.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_SYNC_WIN32_H__ -#define __GRPC_SUPPORT_SYNC_WIN32_H__ +#ifndef GRPC_SUPPORT_SYNC_WIN32_H +#define GRPC_SUPPORT_SYNC_WIN32_H #include <grpc/support/sync_generic.h> @@ -48,4 +48,4 @@ typedef CONDITION_VARIABLE gpr_cv; typedef INIT_ONCE gpr_once; #define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT -#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */ +#endif /* GRPC_SUPPORT_SYNC_WIN32_H */ diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index a81e6cd3ba..64d5bed49a 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_THD_H__ -#define __GRPC_SUPPORT_THD_H__ +#ifndef GRPC_SUPPORT_THD_H +#define GRPC_SUPPORT_THD_H /* Thread interface for GPR. Types @@ -73,4 +73,4 @@ gpr_thd_id gpr_thd_currentid(void); } #endif -#endif /* __GRPC_SUPPORT_THD_H__ */ +#endif /* GRPC_SUPPORT_THD_H */ diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index 150b7ac8c5..1fd3181859 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_TIME_H__ -#define __GRPC_SUPPORT_TIME_H__ +#ifndef GRPC_SUPPORT_TIME_H +#define GRPC_SUPPORT_TIME_H /* Time support. We use gpr_timespec, which is analogous to struct timespec. On some machines, absolute times may be in local time. */ @@ -100,4 +100,4 @@ double gpr_timespec_to_micros(gpr_timespec t); } #endif -#endif /* __GRPC_SUPPORT_TIME_H__ */ +#endif /* GRPC_SUPPORT_TIME_H */ diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index 8d756c37c3..979f3d026b 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -31,8 +31,8 @@ * */ -#ifndef __GRPC_SUPPORT_USEFUL_H__ -#define __GRPC_SUPPORT_USEFUL_H__ +#ifndef GRPC_SUPPORT_USEFUL_H +#define GRPC_SUPPORT_USEFUL_H /* useful macros that don't belong anywhere else */ @@ -45,4 +45,4 @@ #define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) -#endif /* __GRPC_SUPPORT_USEFUL_H__ */ +#endif /* GRPC_SUPPORT_USEFUL_H */ |