blob: 8ce92853b163c056fe4f35aac342b8317e227466 [file] [log] [blame]
Mark Sleef5f2be42006-09-05 21:05:31 +00001#ifndef _THRIFT_TPROCESSOR_H_
2#define _THRIFT_TPROCESSOR_H_ 1
Mark Slee8d7e1f62006-06-07 06:48:56 +00003
4#include <string>
Mark Slee4af6ed72006-10-25 19:02:49 +00005#include <protocol/TProtocol.h>
Marc Slemko16698852006-08-04 03:16:10 +00006#include <boost/shared_ptr.hpp>
Mark Slee8d7e1f62006-06-07 06:48:56 +00007
Marc Slemko6f038a72006-08-03 18:58:09 +00008namespace facebook { namespace thrift {
9
Marc Slemko16698852006-08-04 03:16:10 +000010using namespace boost;
11
Mark Slee4af6ed72006-10-25 19:02:49 +000012using namespace facebook::thrift::protocol;
Marc Slemko6f038a72006-08-03 18:58:09 +000013
Mark Slee8d7e1f62006-06-07 06:48:56 +000014/**
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 */
22class TProcessor {
23 public:
24 virtual ~TProcessor() {}
Mark Slee4af6ed72006-10-25 19:02:49 +000025
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 Sleed788b2e2006-09-07 01:26:35 +000032
Mark Slee8d7e1f62006-06-07 06:48:56 +000033 protected:
34 TProcessor() {}
35};
36
Marc Slemko6f038a72006-08-03 18:58:09 +000037}} // facebook::thrift
38
Mark Sleef5f2be42006-09-05 21:05:31 +000039#endif // #ifndef _THRIFT_PROCESSOR_H_