blob: f2d5279a2ae9b8df6aed920f6844992c02368054 [file] [log] [blame]
Gavin McDonald0b75e1a2010-10-28 02:12:01 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef _THRIFT_TPROCESSOR_H_
21#define _THRIFT_TPROCESSOR_H_ 1
22
23#include <string>
24#include <protocol/TProtocol.h>
25#include <boost/shared_ptr.hpp>
26
27namespace apache { namespace thrift {
28
29/**
30 * A processor is a generic object that acts upon two streams of data, one
31 * an input and the other an output. The definition of this object is loose,
32 * though the typical case is for some sort of server that either generates
33 * responses to an input stream or forwards data from one pipe onto another.
34 *
35 */
36class TProcessor {
37 public:
38 virtual ~TProcessor() {}
39
40 virtual bool process(boost::shared_ptr<protocol::TProtocol> in,
41 boost::shared_ptr<protocol::TProtocol> out) = 0;
42
43 bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> io) {
44 return process(io, io);
45 }
46
47 protected:
48 TProcessor() {}
49};
50
51}} // apache::thrift
52
53#endif // #ifndef _THRIFT_PROCESSOR_H_