From: David Reiss Date: Fri, 7 Mar 2008 20:28:31 +0000 (+0000) Subject: Add an accessor for the I/O protocols of Thrift clients. X-Git-Tag: 0.2.0~907 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=0e913a6381c5dc6b50460d18e2490165db4de629;p=common%2Fthrift.git Add an accessor for the I/O protocols of Thrift clients. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665565 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc index 7cdd6359..9fee1bdb 100644 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -1598,6 +1598,17 @@ void t_cpp_generator::generate_service_client(t_service* tservice) { indent() << " " << extends << "Client(iprot, oprot) {}" << endl; } + // Generate getters for the protocols. + f_header_ << + indent() << "boost::shared_ptr getInputProtocol() {" << endl << + indent() << " return piprot_;" << endl << + indent() << "}" << endl; + + f_header_ << + indent() << "boost::shared_ptr getOutputProtocol() {" << endl << + indent() << " return poprot_;" << endl << + indent() << "}" << endl; + vector functions = tservice->get_functions(); vector::const_iterator f_iter; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {