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
12 ******************************************************************************/
23 class SignatureParam : public Node, public Location {
25 enum param_direction_t { PARAM_IN, PARAM_OUT, PARAM_INOUT };
27 param_direction_t param_direction;
30 /** Copy constructor not implemented */
31 SignatureParam(const SignatureParam& p);
32 /** Assignment disabled */
33 SignatureParam& operator=(const SignatureParam& p);
35 SignatureParam(param_direction_t p_d, Type *p_t, Identifier *p_i);
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;
47 * Signature parameter-list
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;
55 /** Copy constructor not implemented */
56 SignatureParamList(const SignatureParamList& p);
57 /** Assignment disabled */
58 SignatureParamList& operator=(const SignatureParamList& p);
61 : Node(), params_v(), params_m(), in_params_v(), out_params_v(),
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;
81 void chk(Type *p_signature);
82 virtual void dump(unsigned level) const;
86 * Signature exception-list
88 class SignatureExceptions : public Node, public Location {
90 map<string,Type> exc_m;
92 /** Copy constructor not implemented */
93 SignatureExceptions(const SignatureExceptions& p);
94 /** Assignment disabled */
95 SignatureExceptions& operator=(const SignatureExceptions& p);
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]; }
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;
115 } /* namespace Common */
116 #endif /* SIGPARAM_HH_ */