blob: 68728f2d9cb606504187184d1c13710afb4d960e [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001#ifndef T_SERVER_H
2#define T_SERVER_H
3
Marc Slemko16698852006-08-04 03:16:10 +00004#include <TProcessor.h>
5
6#include <boost/shared_ptr.hpp>
Mark Sleee8540632006-05-30 09:24:40 +00007
Marc Slemko6f038a72006-08-03 18:58:09 +00008namespace facebook { namespace thrift { namespace server {
9
10using namespace facebook::thrift;
Marc Slemko16698852006-08-04 03:16:10 +000011using namespace boost;
Marc Slemko6f038a72006-08-03 18:58:09 +000012
Mark Sleee8540632006-05-30 09:24:40 +000013class TServerOptions;
14
15/**
16 * Thrift server.
17 *
18 * @author Mark Slee <mcslee@facebook.com>
19 */
20class TServer {
Marc Slemko16698852006-08-04 03:16:10 +000021public:
Mark Sleee8540632006-05-30 09:24:40 +000022 virtual ~TServer() {}
23 virtual void run() = 0;
Marc Slemko16698852006-08-04 03:16:10 +000024
25protected:
26 TServer(shared_ptr<TProcessor> processor, shared_ptr<TServerOptions> options) :
Mark Slee8d7e1f62006-06-07 06:48:56 +000027 processor_(processor), options_(options) {}
Marc Slemko16698852006-08-04 03:16:10 +000028
29 shared_ptr<TProcessor> processor_;
30 shared_ptr<TServerOptions> options_;
Mark Sleee8540632006-05-30 09:24:40 +000031};
Marc Slemko16698852006-08-04 03:16:10 +000032
Mark Sleee8540632006-05-30 09:24:40 +000033/**
34 * Class to encapsulate all generic server options.
35 */
36class TServerOptions {
Marc Slemko16698852006-08-04 03:16:10 +000037public:
Mark Sleee8540632006-05-30 09:24:40 +000038 // TODO(mcslee): Fill in getters/setters here
Marc Slemko16698852006-08-04 03:16:10 +000039protected:
Mark Sleee8540632006-05-30 09:24:40 +000040 // TODO(mcslee): Fill data members in here
41};
42
Marc Slemko6f038a72006-08-03 18:58:09 +000043}}} // facebook::thrift::server
44
Mark Sleee8540632006-05-30 09:24:40 +000045#endif