Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Raduly, Csaba | |
11 | * | |
12 | ******************************************************************************/ | |
970ed795 EL |
13 | #ifndef SIGPARAM_HH_ |
14 | #define SIGPARAM_HH_ | |
15 | ||
16 | #include "Setting.hh" | |
17 | ||
18 | namespace Common { | |
19 | ||
20 | /** | |
21 | * Signature parameter | |
22 | */ | |
23 | class SignatureParam : public Node, public Location { | |
24 | public: | |
25 | enum param_direction_t { PARAM_IN, PARAM_OUT, PARAM_INOUT }; | |
26 | private: | |
27 | param_direction_t param_direction; | |
28 | Type *param_type; | |
29 | Identifier *param_id; | |
30 | /** Copy constructor not implemented */ | |
31 | SignatureParam(const SignatureParam& p); | |
32 | /** Assignment disabled */ | |
33 | SignatureParam& operator=(const SignatureParam& p); | |
34 | public: | |
35 | SignatureParam(param_direction_t p_d, Type *p_t, Identifier *p_i); | |
36 | ~SignatureParam(); | |
37 | virtual SignatureParam *clone() const; | |
38 | const Identifier& get_id() const { return *param_id; } | |
39 | Type *get_type() const { return param_type; } | |
40 | param_direction_t get_direction() const { return param_direction; } | |
41 | virtual void set_fullname(const string& p_fullname); | |
42 | virtual void set_my_scope(Scope *p_scope); | |
43 | virtual void dump(unsigned level) const; | |
44 | }; | |
45 | ||
46 | /** | |
47 | * Signature parameter-list | |
48 | */ | |
49 | class SignatureParamList : public Node { | |
50 | vector<SignatureParam> params_v; | |
51 | map<string, SignatureParam> params_m; | |
52 | vector<SignatureParam> in_params_v, out_params_v; | |
53 | bool checked; | |
54 | private: | |
55 | /** Copy constructor not implemented */ | |
56 | SignatureParamList(const SignatureParamList& p); | |
57 | /** Assignment disabled */ | |
58 | SignatureParamList& operator=(const SignatureParamList& p); | |
59 | public: | |
60 | SignatureParamList() | |
61 | : Node(), params_v(), params_m(), in_params_v(), out_params_v(), | |
62 | checked(false) { } | |
63 | ~SignatureParamList(); | |
64 | virtual SignatureParamList *clone() const; | |
65 | virtual void set_fullname(const string& p_fullname); | |
66 | virtual void set_my_scope(Scope *p_scope); | |
67 | void add_param(SignatureParam *p_param); | |
68 | size_t get_nof_params() const { return params_v.size(); } | |
69 | SignatureParam *get_param_byIndex(size_t n) const { return params_v[n]; } | |
70 | /** Returns the number of in/inout parameters. */ | |
71 | size_t get_nof_in_params() const; | |
72 | /** Returns the n-th in/inout parameter. */ | |
73 | SignatureParam *get_in_param_byIndex(size_t n) const; | |
74 | /** Returns the number of out/inout parameters. */ | |
75 | size_t get_nof_out_params() const; | |
76 | /** Returns the n-th out/inout parameter. */ | |
77 | SignatureParam *get_out_param_byIndex(size_t n) const; | |
78 | bool has_param_withName(const Identifier& p_name) const; | |
79 | const SignatureParam *get_param_byName(const Identifier& p_name) const; | |
80 | ||
81 | void chk(Type *p_signature); | |
82 | virtual void dump(unsigned level) const; | |
83 | }; | |
84 | ||
85 | /** | |
86 | * Signature exception-list | |
87 | */ | |
88 | class SignatureExceptions : public Node, public Location { | |
89 | vector<Type> exc_v; | |
90 | map<string,Type> exc_m; | |
91 | private: | |
92 | /** Copy constructor not implemented */ | |
93 | SignatureExceptions(const SignatureExceptions& p); | |
94 | /** Assignment disabled */ | |
95 | SignatureExceptions& operator=(const SignatureExceptions& p); | |
96 | public: | |
97 | SignatureExceptions() : Node(), Location(), exc_v(), exc_m() { } | |
98 | ~SignatureExceptions(); | |
99 | SignatureExceptions *clone() const; | |
100 | void add_type(Type *p_type); | |
101 | size_t get_nof_types() const { return exc_v.size(); } | |
102 | Type *get_type_byIndex(size_t n) const { return exc_v[n]; } | |
103 | bool has_type(Type *p_type); | |
104 | /** Returns the number of types that are compatible with * \a p_type. */ | |
105 | size_t get_nof_compatible_types(Type *p_type); | |
106 | Type *get_type_byName(const string& p_typename) const | |
107 | { return exc_m[p_typename]; } | |
108 | ||
109 | void chk(Type *p_signature); | |
110 | virtual void set_fullname(const string& p_fullname); | |
111 | virtual void set_my_scope(Scope *p_scope); | |
112 | virtual void dump(unsigned level) const; | |
113 | }; | |
114 | ||
115 | } /* namespace Common */ | |
116 | #endif /* SIGPARAM_HH_ */ |