blob: ce2753934a561928021f363ae9010399f75b6526 [file] [log] [blame]
Mark Slee8d7e1f62006-06-07 06:48:56 +00001#ifndef T_PROCESSOR_H
2#define T_PROCESSOR_H
3
4#include <string>
Marc Slemko16698852006-08-04 03:16:10 +00005#include <transport/TTransport.h>
6#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
Marc Slemko6f038a72006-08-03 18:58:09 +000012using namespace facebook::thrift::transport;
13
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() {}
Marc Slemko16698852006-08-04 03:16:10 +000025 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 Slee8d7e1f62006-06-07 06:48:56 +000027 protected:
28 TProcessor() {}
29};
30
Marc Slemko6f038a72006-08-03 18:58:09 +000031}} // facebook::thrift
32
Mark Slee8d7e1f62006-06-07 06:48:56 +000033#endif