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