blob: cba4a844a7df3d4d21fbb099df105830d018f750 [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
David Reiss0c90f6f2008-02-06 22:18:40 +000014namespace facebook { 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 *
22 * @author Mark Slee <mcslee@facebook.com>
23 */
24class TProcessor {
25 public:
26 virtual ~TProcessor() {}
Mark Slee4af6ed72006-10-25 19:02:49 +000027
Mark Slee5ea15f92007-03-05 22:55:59 +000028 virtual bool process(boost::shared_ptr<protocol::TProtocol> in,
29 boost::shared_ptr<protocol::TProtocol> out) = 0;
Mark Slee4af6ed72006-10-25 19:02:49 +000030
James Wangf1ceb472007-03-28 22:43:57 +000031 bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> io) {
Mark Slee4af6ed72006-10-25 19:02:49 +000032 return process(io, io);
33 }
Mark Sleed788b2e2006-09-07 01:26:35 +000034
Mark Slee8d7e1f62006-06-07 06:48:56 +000035 protected:
36 TProcessor() {}
37};
38
Marc Slemko6f038a72006-08-03 18:58:09 +000039}} // facebook::thrift
40
Mark Sleef5f2be42006-09-05 21:05:31 +000041#endif // #ifndef _THRIFT_PROCESSOR_H_