Add an accessor for the I/O protocols of Thrift clients.
authorDavid Reiss <dreiss@apache.org>
Fri, 7 Mar 2008 20:28:31 +0000 (20:28 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 7 Mar 2008 20:28:31 +0000 (20:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665565 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/generate/t_cpp_generator.cc

index 7cdd635..9fee1bd 100644 (file)
@@ -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<facebook::thrift::protocol::TProtocol> getInputProtocol() {" << endl <<
+    indent() << "  return piprot_;" << endl <<
+    indent() << "}" << endl;
+
+  f_header_ <<
+    indent() << "boost::shared_ptr<facebook::thrift::protocol::TProtocol> getOutputProtocol() {" << endl <<
+    indent() << "  return poprot_;" << endl <<
+    indent() << "}" << endl;
+
   vector<t_function*> functions = tservice->get_functions();
   vector<t_function*>::const_iterator f_iter;
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {