1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 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 ///////////////////////////////////////////////////////////////////////////////
18 class SignatureParam : public Node, public Location {
20 enum param_direction_t { PARAM_IN, PARAM_OUT, PARAM_INOUT };
22 param_direction_t param_direction;
25 /** Copy constructor not implemented */
26 SignatureParam(const SignatureParam& p);
27 /** Assignment disabled */
28 SignatureParam& operator=(const SignatureParam& p);
30 SignatureParam(param_direction_t p_d, Type *p_t, Identifier *p_i);
32 virtual SignatureParam *clone() const;
33 const Identifier& get_id() const { return *param_id; }
34 Type *get_type() const { return param_type; }
35 param_direction_t get_direction() const { return param_direction; }
36 virtual void set_fullname(const string& p_fullname);
37 virtual void set_my_scope(Scope *p_scope);
38 virtual void dump(unsigned level) const;
42 * Signature parameter-list
44 class SignatureParamList : public Node {
45 vector<SignatureParam> params_v;
46 map<string, SignatureParam> params_m;
47 vector<SignatureParam> in_params_v, out_params_v;
50 /** Copy constructor not implemented */
51 SignatureParamList(const SignatureParamList& p);
52 /** Assignment disabled */
53 SignatureParamList& operator=(const SignatureParamList& p);
56 : Node(), params_v(), params_m(), in_params_v(), out_params_v(),
58 ~SignatureParamList();
59 virtual SignatureParamList *clone() const;
60 virtual void set_fullname(const string& p_fullname);
61 virtual void set_my_scope(Scope *p_scope);
62 void add_param(SignatureParam *p_param);
63 size_t get_nof_params() const { return params_v.size(); }
64 SignatureParam *get_param_byIndex(size_t n) const { return params_v[n]; }
65 /** Returns the number of in/inout parameters. */
66 size_t get_nof_in_params() const;
67 /** Returns the n-th in/inout parameter. */
68 SignatureParam *get_in_param_byIndex(size_t n) const;
69 /** Returns the number of out/inout parameters. */
70 size_t get_nof_out_params() const;
71 /** Returns the n-th out/inout parameter. */
72 SignatureParam *get_out_param_byIndex(size_t n) const;
73 bool has_param_withName(const Identifier& p_name) const;
74 const SignatureParam *get_param_byName(const Identifier& p_name) const;
76 void chk(Type *p_signature);
77 virtual void dump(unsigned level) const;
81 * Signature exception-list
83 class SignatureExceptions : public Node, public Location {
85 map<string,Type> exc_m;
87 /** Copy constructor not implemented */
88 SignatureExceptions(const SignatureExceptions& p);
89 /** Assignment disabled */
90 SignatureExceptions& operator=(const SignatureExceptions& p);
92 SignatureExceptions() : Node(), Location(), exc_v(), exc_m() { }
93 ~SignatureExceptions();
94 SignatureExceptions *clone() const;
95 void add_type(Type *p_type);
96 size_t get_nof_types() const { return exc_v.size(); }
97 Type *get_type_byIndex(size_t n) const { return exc_v[n]; }
98 bool has_type(Type *p_type);
99 /** Returns the number of types that are compatible with * \a p_type. */
100 size_t get_nof_compatible_types(Type *p_type);
101 Type *get_type_byName(const string& p_typename) const
102 { return exc_m[p_typename]; }
104 void chk(Type *p_signature);
105 virtual void set_fullname(const string& p_fullname);
106 virtual void set_my_scope(Scope *p_scope);
107 virtual void dump(unsigned level) const;
110 } /* namespace Common */
111 #endif /* SIGPARAM_HH_ */