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