Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 1 | #ifndef T_SERVER_H |
2 | #define T_SERVER_H | ||||
3 | |||||
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 4 | #include <TProcessor.h> |
Marc Slemko | 3ea0033 | 2006-08-17 01:11:13 +0000 | [diff] [blame] | 5 | #include <concurrency/Thread.h> |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 6 | |
7 | #include <boost/shared_ptr.hpp> | ||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 8 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 9 | namespace facebook { namespace thrift { namespace server { |
10 | |||||
11 | using namespace facebook::thrift; | ||||
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 12 | using namespace boost; |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 13 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 14 | class TServerOptions; |
15 | |||||
16 | /** | ||||
17 | * Thrift server. | ||||
18 | * | ||||
19 | * @author Mark Slee <mcslee@facebook.com> | ||||
20 | */ | ||||
Marc Slemko | 3ea0033 | 2006-08-17 01:11:13 +0000 | [diff] [blame] | 21 | class TServer : public concurrency::Runnable { |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 22 | public: |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 23 | virtual ~TServer() {} |
24 | virtual void run() = 0; | ||||
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 25 | |
26 | protected: | ||||
27 | TServer(shared_ptr<TProcessor> processor, shared_ptr<TServerOptions> options) : | ||||
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 28 | processor_(processor), options_(options) {} |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 29 | |
30 | shared_ptr<TProcessor> processor_; | ||||
31 | shared_ptr<TServerOptions> options_; | ||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 32 | }; |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 33 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 34 | /** |
35 | * Class to encapsulate all generic server options. | ||||
36 | */ | ||||
37 | class TServerOptions { | ||||
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 38 | public: |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 39 | // TODO(mcslee): Fill in getters/setters here |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 40 | protected: |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 41 | // TODO(mcslee): Fill data members in here |
42 | }; | ||||
43 | |||||
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 44 | }}} // facebook::thrift::server |
45 | |||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 46 | #endif |