blob: d53223fa28ef518609c2c998dbe47704d6128ea0 [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>
Marc Slemko3ea00332006-08-17 01:11:13 +00005#include <concurrency/Thread.h>
Marc Slemko16698852006-08-04 03:16:10 +00006
7#include <boost/shared_ptr.hpp>
Mark Sleee8540632006-05-30 09:24:40 +00008
Marc Slemko6f038a72006-08-03 18:58:09 +00009namespace facebook { namespace thrift { namespace server {
10
11using namespace facebook::thrift;
Marc Slemko16698852006-08-04 03:16:10 +000012using namespace boost;
Marc Slemko6f038a72006-08-03 18:58:09 +000013
Mark Sleee8540632006-05-30 09:24:40 +000014class TServerOptions;
15
16/**
17 * Thrift server.
18 *
19 * @author Mark Slee <mcslee@facebook.com>
20 */
Marc Slemko3ea00332006-08-17 01:11:13 +000021class TServer : public concurrency::Runnable {
Marc Slemko16698852006-08-04 03:16:10 +000022public:
Mark Sleee8540632006-05-30 09:24:40 +000023 virtual ~TServer() {}
24 virtual void run() = 0;
Marc Slemko16698852006-08-04 03:16:10 +000025
26protected:
27 TServer(shared_ptr<TProcessor> processor, shared_ptr<TServerOptions> options) :
Mark Slee8d7e1f62006-06-07 06:48:56 +000028 processor_(processor), options_(options) {}
Marc Slemko16698852006-08-04 03:16:10 +000029
30 shared_ptr<TProcessor> processor_;
31 shared_ptr<TServerOptions> options_;
Mark Sleee8540632006-05-30 09:24:40 +000032};
Marc Slemko16698852006-08-04 03:16:10 +000033
Mark Sleee8540632006-05-30 09:24:40 +000034/**
35 * Class to encapsulate all generic server options.
36 */
37class TServerOptions {
Marc Slemko16698852006-08-04 03:16:10 +000038public:
Mark Sleee8540632006-05-30 09:24:40 +000039 // TODO(mcslee): Fill in getters/setters here
Marc Slemko16698852006-08-04 03:16:10 +000040protected:
Mark Sleee8540632006-05-30 09:24:40 +000041 // TODO(mcslee): Fill data members in here
42};
43
Marc Slemko6f038a72006-08-03 18:58:09 +000044}}} // facebook::thrift::server
45
Mark Sleee8540632006-05-30 09:24:40 +000046#endif