| David Reiss | 5ddabb8 | 2010-10-06 17:09:37 +0000 | [diff] [blame] | 1 | /* | 
 | 2 |  * Licensed to the Apache Software Foundation (ASF) under one | 
 | 3 |  * or more contributor license agreements. See the NOTICE file | 
 | 4 |  * distributed with this work for additional information | 
 | 5 |  * regarding copyright ownership. The ASF licenses this file | 
 | 6 |  * to you under the Apache License, Version 2.0 (the | 
 | 7 |  * "License"); you may not use this file except in compliance | 
 | 8 |  * with the License. You may obtain a copy of the License at | 
 | 9 |  * | 
 | 10 |  *   http://www.apache.org/licenses/LICENSE-2.0 | 
 | 11 |  * | 
 | 12 |  * Unless required by applicable law or agreed to in writing, | 
 | 13 |  * software distributed under the License is distributed on an | 
 | 14 |  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
 | 15 |  * KIND, either express or implied. See the License for the | 
 | 16 |  * specific language governing permissions and limitations | 
 | 17 |  * under the License. | 
 | 18 |  */ | 
 | 19 |  | 
 | 20 | #include "TAsyncProtocolProcessor.h" | 
 | 21 |  | 
 | 22 | using apache::thrift::transport::TBufferBase; | 
 | 23 | using apache::thrift::protocol::TProtocol; | 
 | 24 |  | 
 | 25 | namespace apache { namespace thrift { namespace async { | 
 | 26 |  | 
 | 27 | void TAsyncProtocolProcessor::process( | 
 | 28 |     std::tr1::function<void(bool healthy)> _return, | 
 | 29 |     boost::shared_ptr<TBufferBase> ibuf, | 
 | 30 |     boost::shared_ptr<TBufferBase> obuf) { | 
 | 31 |   boost::shared_ptr<TProtocol> iprot(pfact_->getProtocol(ibuf)); | 
 | 32 |   boost::shared_ptr<TProtocol> oprot(pfact_->getProtocol(obuf)); | 
 | 33 |   return underlying_->process( | 
 | 34 |       std::tr1::bind( | 
 | 35 |         &TAsyncProtocolProcessor::finish, | 
 | 36 |         _return, | 
 | 37 |         oprot, | 
 | 38 |         std::tr1::placeholders::_1), | 
 | 39 |       iprot, oprot); | 
 | 40 | } | 
 | 41 |  | 
 | 42 | /* static */ void TAsyncProtocolProcessor::finish( | 
 | 43 |     std::tr1::function<void(bool healthy)> _return, | 
 | 44 |     boost::shared_ptr<TProtocol> oprot, | 
 | 45 |     bool healthy) { | 
| Roger Meier | 3b771a1 | 2010-11-17 22:11:26 +0000 | [diff] [blame] | 46 |   (void) oprot; | 
| David Reiss | 5ddabb8 | 2010-10-06 17:09:37 +0000 | [diff] [blame] | 47 |   // This is a stub function to hold a reference to oprot. | 
 | 48 |   return _return(healthy); | 
 | 49 | } | 
 | 50 |  | 
 | 51 | }}} // apache::thrift::async |