THRIFT-922. cpp: Update C++ generator to emit templatized code

When the "templates" option is passed to the C++ generator, it now emits
templatized versions of the client and processor.  Generated types emit
templatized read() and write() functions.

This allows the generated code to invoke the correct non-virtual
TTransport and TProtocol implementations, resulting in faster
serialization and deserialization.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005138 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/cpp/Thrift-test.mk b/test/cpp/Thrift-test.mk
index 97f0dec..2e17e7e 100644
--- a/test/cpp/Thrift-test.mk
+++ b/test/cpp/Thrift-test.mk
@@ -56,7 +56,7 @@
 debug: server-debug client-debug
 
 stubs: ../ThriftTest.thrift
-	$(THRIFT) --gen cpp ../ThriftTest.thrift
+	$(THRIFT) --gen cpp:templates ../ThriftTest.thrift
 
 server-debug: stubs
 	g++ -o TestServer $(DCFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp $(thrift_home)/lib/cpp/test/ThriftTest_extras.cpp
@@ -71,7 +71,7 @@
 	g++ -o TestClient $(CFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp $(thrift_home)/lib/cpp/test/ThriftTest_extras.cpp
 
 small:
-	$(THRIFT) --gen cpp ../SmallTest.thrift
+	$(THRIFT) --gen cpp:templates ../SmallTest.thrift
 	g++ -c $(CCFL) ./gen-cpp/SmallService.cpp ./gen-cpp/SmallTest_types.cpp
 
 clean:
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 8ae819a..4fcf6b1 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -89,7 +89,7 @@
 
   shared_ptr< TBinaryProtocolT<TBufferBase> > protocol(
       new TBinaryProtocolT<TBufferBase>(transport));
-  ThriftTestClient testClient(protocol);
+  ThriftTestClientT< TBinaryProtocolT<TBufferBase> > testClient(protocol);
 
   uint64_t time_min = 0;
   uint64_t time_max = 0;
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 369237e..685957a 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -392,11 +392,13 @@
   }
 
   // Dispatcher
-  shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+  shared_ptr<TProtocolFactory> protocolFactory(
+      new TBinaryProtocolFactoryT<TBufferBase>());
 
   shared_ptr<TestHandler> testHandler(new TestHandler());
 
-  shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
+  shared_ptr<TProcessor> testProcessor(
+      new ThriftTestProcessorT< TBinaryProtocolT<TBufferBase> >(testHandler));
 
 
   if (!args["processor-events"].empty()) {