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