Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 1 | #ifndef T_PROCESSOR_H |
| 2 | #define T_PROCESSOR_H |
| 3 | |
| 4 | #include <string> |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame^] | 5 | #include <transport/TTransport.h> |
| 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 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 12 | using namespace facebook::thrift::transport; |
| 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() {} |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame^] | 25 | virtual bool process(shared_ptr<TTransport> in, shared_ptr<TTransport> out) = 0; |
| 26 | virtual bool process(shared_ptr<TTransport> io) { return process(io, io); } |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 27 | protected: |
| 28 | TProcessor() {} |
| 29 | }; |
| 30 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 31 | }} // facebook::thrift |
| 32 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 33 | #endif |