diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-02-09 20:54:25 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-02-09 20:54:25 -0800 |
commit | 80e00a8c63bd801b697fbe0cd1d8e00b14a81c76 (patch) | |
tree | 087efdcc340e9e9fb1f1d960a1fdd72adb0c8264 /include/grpc++ | |
parent | de917062ecacbeb547c8e2e4e3f4260d3e9a2f2e (diff) |
Stub out unary call wrapper
Diffstat (limited to 'include/grpc++')
-rw-r--r-- | include/grpc++/channel_interface.h | 13 | ||||
-rw-r--r-- | include/grpc++/completion_queue.h | 6 | ||||
-rw-r--r-- | include/grpc++/impl/client_unary_call.h | 67 |
3 files changed, 73 insertions, 13 deletions
diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index c128a08a9f..3631ea4d5d 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -61,19 +61,6 @@ class ChannelInterface { virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) = 0; }; -// Wrapper that begins an asynchronous unary call -void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result, Status *status, - CompletionQueue *cq, void *tag); - -// 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); - } // namespace grpc #endif // __GRPCPP_CHANNEL_INTERFACE_H__ diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 641d599c7e..c976bd5b45 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -34,6 +34,8 @@ #ifndef __GRPCPP_COMPLETION_QUEUE_H__ #define __GRPCPP_COMPLETION_QUEUE_H__ +#include <grpc++/impl/client_unary_call.h> + struct grpc_completion_queue; namespace grpc { @@ -85,6 +87,10 @@ class CompletionQueue { template <class R> friend class ::grpc::ServerReader; template <class W> friend class ::grpc::ServerWriter; template <class R, class W> friend class ::grpc::ServerReaderWriter; + friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); bool Pluck(CompletionQueueTag *tag); diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h new file mode 100644 index 0000000000..091430b884 --- /dev/null +++ b/include/grpc++/impl/client_unary_call.h @@ -0,0 +1,67 @@ +/* +* +* Copyright 2014, Google Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following disclaimer +* in the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Google Inc. nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __GRPCPP_CLIENT_UNARY_CALL_H__ +#define __GRPCPP_CLIENT_UNARY_CALL_H__ + +namespace google { +namespace protobuf { +class Message; +} // namespace protobuf +} // namespace google + +namespace grpc { + +class ChannelInterface; +class ClientContext; +class CompletionQueue; +class RpcMethod; +class Status; + +// Wrapper that begins an asynchronous unary call +void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result, Status *status, + CompletionQueue *cq, void *tag); + +// 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); + +} // namespace grpc + +#endif + |