Mark Slee | e9ce01c | 2007-05-16 02:29:53 +0000 | [diff] [blame^] | 1 | // Copyright (c) 2006- Facebook |
2 | // Distributed under the Thrift Software License | ||||
3 | // | ||||
4 | // See accompanying file LICENSE or visit the Thrift site at: | ||||
5 | // http://developers.facebook.com/thrift/ | ||||
6 | |||||
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 7 | #ifndef T_SERVICE_H |
8 | #define T_SERVICE_H | ||||
9 | |||||
10 | #include "t_function.h" | ||||
11 | #include <vector> | ||||
12 | |||||
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 13 | class t_program; |
14 | |||||
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 15 | /** |
16 | * A service consists of a set of functions. | ||||
17 | * | ||||
18 | * @author Mark Slee <mcslee@facebook.com> | ||||
19 | */ | ||||
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 20 | class t_service : public t_type { |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 21 | public: |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 22 | t_service(t_program* program) : |
23 | t_type(program), | ||||
24 | extends_(NULL) {} | ||||
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 25 | |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 26 | bool is_service() const { |
27 | return true; | ||||
28 | } | ||||
29 | |||||
30 | void set_extends(t_service* extends) { | ||||
31 | extends_ = extends; | ||||
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 32 | } |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 33 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 34 | void add_function(t_function* func) { |
35 | functions_.push_back(func); | ||||
36 | } | ||||
37 | |||||
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 38 | const std::vector<t_function*>& get_functions() const { |
39 | return functions_; | ||||
40 | } | ||||
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 41 | |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 42 | t_service* get_extends() { |
43 | return extends_; | ||||
44 | } | ||||
45 | |||||
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 46 | private: |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 47 | std::vector<t_function*> functions_; |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 48 | t_service* extends_; |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 49 | }; |
50 | |||||
51 | #endif |