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