Mark Slee | 9f0c651 | 2007-02-28 23:58:26 +0000 | [diff] [blame] | 1 | // Copyright (c) 2006- Facebook |
| 2 | // Distributed under the Thrift Software License |
| 3 | // |
| 4 | // See accompanying file LICENSE or visit the Thrift site at: |
| 5 | // http://developers.facebook.com/thrift/ |
| 6 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 7 | #ifndef _THRIFT_TPROCESSOR_H_ |
| 8 | #define _THRIFT_TPROCESSOR_H_ 1 |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 9 | |
| 10 | #include <string> |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 11 | #include <protocol/TProtocol.h> |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 12 | #include <boost/shared_ptr.hpp> |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 13 | |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 14 | namespace facebook { namespace thrift { |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 15 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 16 | /** |
| 17 | * A processor is a generic object that acts upon two streams of data, one |
| 18 | * an input and the other an output. The definition of this object is loose, |
| 19 | * though the typical case is for some sort of server that either generates |
| 20 | * responses to an input stream or forwards data from one pipe onto another. |
| 21 | * |
| 22 | * @author Mark Slee <mcslee@facebook.com> |
| 23 | */ |
| 24 | class TProcessor { |
| 25 | public: |
| 26 | virtual ~TProcessor() {} |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 27 | |
Mark Slee | 5ea15f9 | 2007-03-05 22:55:59 +0000 | [diff] [blame] | 28 | virtual bool process(boost::shared_ptr<protocol::TProtocol> in, |
| 29 | boost::shared_ptr<protocol::TProtocol> out) = 0; |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 30 | |
James Wang | f1ceb47 | 2007-03-28 22:43:57 +0000 | [diff] [blame] | 31 | bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> io) { |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 32 | return process(io, io); |
| 33 | } |
Mark Slee | d788b2e | 2006-09-07 01:26:35 +0000 | [diff] [blame] | 34 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 35 | protected: |
| 36 | TProcessor() {} |
| 37 | }; |
| 38 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 39 | }} // facebook::thrift |
| 40 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 41 | #endif // #ifndef _THRIFT_PROCESSOR_H_ |