blob: 52280a4092769278ec7f43479719f5c08071ac9a [file] [log] [blame]
Mark Slee31985722006-05-24 21:45:31 +00001#ifndef T_SERVICE_H
2#define T_SERVICE_H
3
4#include "t_function.h"
5#include <vector>
6
Mark Sleef0712dc2006-10-25 19:03:57 +00007class t_program;
8
Mark Sleef5377b32006-10-10 01:42:59 +00009/**
10 * A service consists of a set of functions.
11 *
12 * @author Mark Slee <mcslee@facebook.com>
13 */
Mark Sleef0712dc2006-10-25 19:03:57 +000014class t_service : public t_type {
Mark Slee31985722006-05-24 21:45:31 +000015 public:
Mark Sleef0712dc2006-10-25 19:03:57 +000016 t_service(t_program* program) :
17 t_type(program),
18 extends_(NULL) {}
Mark Slee31985722006-05-24 21:45:31 +000019
Mark Sleef0712dc2006-10-25 19:03:57 +000020 bool is_service() const {
21 return true;
22 }
23
24 void set_extends(t_service* extends) {
25 extends_ = extends;
Mark Sleef5377b32006-10-10 01:42:59 +000026 }
Mark Slee31985722006-05-24 21:45:31 +000027
Mark Sleef5377b32006-10-10 01:42:59 +000028 void add_function(t_function* func) {
29 functions_.push_back(func);
30 }
31
Mark Sleef5377b32006-10-10 01:42:59 +000032 const std::vector<t_function*>& get_functions() const {
33 return functions_;
34 }
Mark Slee31985722006-05-24 21:45:31 +000035
Mark Sleef0712dc2006-10-25 19:03:57 +000036 t_service* get_extends() {
37 return extends_;
38 }
39
Mark Slee31985722006-05-24 21:45:31 +000040 private:
Mark Slee31985722006-05-24 21:45:31 +000041 std::vector<t_function*> functions_;
Mark Sleef0712dc2006-10-25 19:03:57 +000042 t_service* extends_;
Mark Slee31985722006-05-24 21:45:31 +000043};
44
45#endif