diff --git a/BUILD b/BUILD index b4d11d5ba87..02c9061d887 100644 --- a/BUILD +++ b/BUILD @@ -721,6 +721,7 @@ cc_library( "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", ], @@ -808,6 +809,7 @@ cc_library( "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", ], diff --git a/Makefile b/Makefile index 5253e7cabf0..a043cd33ddb 100644 --- a/Makefile +++ b/Makefile @@ -4257,6 +4257,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/status.h \ include/grpc++/status_code_enum.h \ include/grpc++/stream.h \ + include/grpc++/stub_options.h \ include/grpc++/thread_pool_interface.h \ include/grpc++/time.h \ @@ -4500,6 +4501,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/status.h \ include/grpc++/status_code_enum.h \ include/grpc++/stream.h \ + include/grpc++/stub_options.h \ include/grpc++/thread_pool_interface.h \ include/grpc++/time.h \ diff --git a/build.json b/build.json index 9fb43c3464e..516e2f19c0f 100644 --- a/build.json +++ b/build.json @@ -69,6 +69,7 @@ "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h" ], diff --git a/include/grpc++/stub_options.h b/include/grpc++/stub_options.h new file mode 100644 index 00000000000..c7c16dcd554 --- /dev/null +++ b/include/grpc++/stub_options.h @@ -0,0 +1,43 @@ +/* + * + * Copyright 2015, 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 GRPCXX_STUB_OPTIONS_H +#define GRPCXX_STUB_OPTIONS_H + +namespace grpc { + +class StubOptions {}; + +} // namespace grpc + +#endif // GRPCXX_STUB_OPTIONS_H diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 75659947df9..ea487bcd89a 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -119,6 +119,7 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, "#include \n" "#include \n" "#include \n" + "#include \n" "\n" "namespace grpc {\n" "class CompletionQueue;\n" @@ -574,8 +575,8 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, printer->Print("};\n"); printer->Print( "static std::unique_ptr NewStub(const std::shared_ptr< " - "::grpc::ChannelInterface>& " - "channel);\n"); + "::grpc::ChannelInterface>& channel, " + "const ::grpc::StubOptions& options = ::grpc::StubOptions());\n"); printer->Print("\n"); @@ -966,7 +967,8 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, printer->Print( *vars, "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" - "const std::shared_ptr< ::grpc::ChannelInterface>& channel) {\n" + "const std::shared_ptr< ::grpc::ChannelInterface>& channel, " + "const ::grpc::StubOptions& options) {\n" " std::unique_ptr< $ns$$Service$::Stub> stub(new " "$ns$$Service$::Stub(channel));\n" " return stub;\n" diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 6b1302d4bd3..eb14925fff2 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -799,6 +799,7 @@ include/grpc++/slice.h \ include/grpc++/status.h \ include/grpc++/status_code_enum.h \ include/grpc++/stream.h \ +include/grpc++/stub_options.h \ include/grpc++/thread_pool_interface.h \ include/grpc++/time.h diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 9cbf23e1a79..3d6649bef6d 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -799,6 +799,7 @@ include/grpc++/slice.h \ include/grpc++/status.h \ include/grpc++/status_code_enum.h \ include/grpc++/stream.h \ +include/grpc++/stub_options.h \ include/grpc++/thread_pool_interface.h \ include/grpc++/time.h \ src/cpp/client/secure_credentials.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index f43306dcfca..1ad371f0a45 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -11812,6 +11812,7 @@ "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", "src/cpp/client/channel.h", @@ -11862,6 +11863,7 @@ "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", "src/cpp/client/channel.cc", @@ -11986,6 +11988,7 @@ "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", "src/cpp/client/channel.h", @@ -12033,6 +12036,7 @@ "include/grpc++/status.h", "include/grpc++/status_code_enum.h", "include/grpc++/stream.h", + "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", "src/cpp/client/channel.cc", diff --git a/vsprojects/grpc++/grpc++.vcxproj b/vsprojects/grpc++/grpc++.vcxproj index 7587cfed775..58474511fc4 100644 --- a/vsprojects/grpc++/grpc++.vcxproj +++ b/vsprojects/grpc++/grpc++.vcxproj @@ -252,6 +252,7 @@ + diff --git a/vsprojects/grpc++/grpc++.vcxproj.filters b/vsprojects/grpc++/grpc++.vcxproj.filters index 85b743a8fb4..2a8ee08b084 100644 --- a/vsprojects/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/grpc++/grpc++.vcxproj.filters @@ -213,6 +213,9 @@ include\grpc++ + + include\grpc++ + include\grpc++ diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj index ea1f747e6b8..0d989c4a933 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -252,6 +252,7 @@ + diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 7f109a25578..71d42e5c6dd 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -198,6 +198,9 @@ include\grpc++ + + include\grpc++ + include\grpc++