THRIFT-1316. cpp: update server classes to accept
TProcessorFactory objects
Patch: Adam Simpkins
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1164201 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TSimpleServer.h b/lib/cpp/src/server/TSimpleServer.h
index 29e120e..ea40ab0 100644
--- a/lib/cpp/src/server/TSimpleServer.h
+++ b/lib/cpp/src/server/TSimpleServer.h
@@ -34,19 +34,50 @@
*/
class TSimpleServer : public TServer {
public:
- TSimpleServer(boost::shared_ptr<TProcessor> processor,
- boost::shared_ptr<TServerTransport> serverTransport,
- boost::shared_ptr<TTransportFactory> transportFactory,
- boost::shared_ptr<TProtocolFactory> protocolFactory) :
+ template<typename ProcessorFactory>
+ TSimpleServer(
+ const boost::shared_ptr<ProcessorFactory>& processorFactory,
+ const boost::shared_ptr<TServerTransport>& serverTransport,
+ const boost::shared_ptr<TTransportFactory>& transportFactory,
+ const boost::shared_ptr<TProtocolFactory>& protocolFactory,
+ THRIFT_OVERLOAD_IF(ProcessorFactory, TProcessorFactory)) :
+ TServer(processorFactory, serverTransport, transportFactory,
+ protocolFactory),
+ stop_(false) {}
+
+ template<typename Processor>
+ TSimpleServer(
+ const boost::shared_ptr<Processor>& processor,
+ const boost::shared_ptr<TServerTransport>& serverTransport,
+ const boost::shared_ptr<TTransportFactory>& transportFactory,
+ const boost::shared_ptr<TProtocolFactory>& protocolFactory,
+ THRIFT_OVERLOAD_IF(Processor, TProcessor)) :
TServer(processor, serverTransport, transportFactory, protocolFactory),
stop_(false) {}
- TSimpleServer(boost::shared_ptr<TProcessor> processor,
- boost::shared_ptr<TServerTransport> serverTransport,
- boost::shared_ptr<TTransportFactory> inputTransportFactory,
- boost::shared_ptr<TTransportFactory> outputTransportFactory,
- boost::shared_ptr<TProtocolFactory> inputProtocolFactory,
- boost::shared_ptr<TProtocolFactory> outputProtocolFactory):
+ template<typename ProcessorFactory>
+ TSimpleServer(
+ const boost::shared_ptr<ProcessorFactory>& processorFactory,
+ const boost::shared_ptr<TServerTransport>& serverTransport,
+ const boost::shared_ptr<TTransportFactory>& inputTransportFactory,
+ const boost::shared_ptr<TTransportFactory>& outputTransportFactory,
+ const boost::shared_ptr<TProtocolFactory>& inputProtocolFactory,
+ const boost::shared_ptr<TProtocolFactory>& outputProtocolFactory,
+ THRIFT_OVERLOAD_IF(ProcessorFactory, TProcessorFactory)) :
+ TServer(processorFactory, serverTransport,
+ inputTransportFactory, outputTransportFactory,
+ inputProtocolFactory, outputProtocolFactory),
+ stop_(false) {}
+
+ template<typename Processor>
+ TSimpleServer(
+ const boost::shared_ptr<Processor>& processor,
+ const boost::shared_ptr<TServerTransport>& serverTransport,
+ const boost::shared_ptr<TTransportFactory>& inputTransportFactory,
+ const boost::shared_ptr<TTransportFactory>& outputTransportFactory,
+ const boost::shared_ptr<TProtocolFactory>& inputProtocolFactory,
+ const boost::shared_ptr<TProtocolFactory>& outputProtocolFactory,
+ THRIFT_OVERLOAD_IF(Processor, TProcessor)) :
TServer(processor, serverTransport,
inputTransportFactory, outputTransportFactory,
inputProtocolFactory, outputProtocolFactory),