blob: 2ec6b2fa84f2e83af539bb924a2e7507e41df0bf [file] [log] [blame]
Mark Slee9f0c6512007-02-28 23:58:26 +00001// 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 Sleef5f2be42006-09-05 21:05:31 +00007#ifndef _THRIFT_TPROCESSOR_H_
8#define _THRIFT_TPROCESSOR_H_ 1
Mark Slee8d7e1f62006-06-07 06:48:56 +00009
10#include <string>
Mark Slee4af6ed72006-10-25 19:02:49 +000011#include <protocol/TProtocol.h>
Marc Slemko16698852006-08-04 03:16:10 +000012#include <boost/shared_ptr.hpp>
Mark Slee8d7e1f62006-06-07 06:48:56 +000013
T Jake Lucianib5e62212009-01-31 22:36:20 +000014namespace apache { namespace thrift {
Marc Slemko6f038a72006-08-03 18:58:09 +000015
Mark Slee8d7e1f62006-06-07 06:48:56 +000016/**
17 * A processor is a generic object that acts upon two streams of data, one
18 * an input and the other an output. The definition of this object is loose,
19 * though the typical case is for some sort of server that either generates
20 * responses to an input stream or forwards data from one pipe onto another.
21 *
Mark Slee8d7e1f62006-06-07 06:48:56 +000022 */
23class TProcessor {
24 public:
25 virtual ~TProcessor() {}
Mark Slee4af6ed72006-10-25 19:02:49 +000026
Mark Slee5ea15f92007-03-05 22:55:59 +000027 virtual bool process(boost::shared_ptr<protocol::TProtocol> in,
28 boost::shared_ptr<protocol::TProtocol> out) = 0;
Mark Slee4af6ed72006-10-25 19:02:49 +000029
T Jake Lucianib5e62212009-01-31 22:36:20 +000030 bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> io) {
Mark Slee4af6ed72006-10-25 19:02:49 +000031 return process(io, io);
32 }
Mark Sleed788b2e2006-09-07 01:26:35 +000033
Mark Slee8d7e1f62006-06-07 06:48:56 +000034 protected:
35 TProcessor() {}
36};
37
T Jake Lucianib5e62212009-01-31 22:36:20 +000038}} // apache::thrift
Marc Slemko6f038a72006-08-03 18:58:09 +000039
Mark Sleef5f2be42006-09-05 21:05:31 +000040#endif // #ifndef _THRIFT_PROCESSOR_H_