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 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef _Common_Typestuff_HH
9 #define _Common_Typestuff_HH
25 * \addtogroup AST_Type
31 * ExceptionSpecification
33 class ExcSpec : public Node {
37 /** Copy constructor not implemented */
38 ExcSpec(const ExcSpec& p);
39 /** Assignment disabled */
40 ExcSpec& operator=(const ExcSpec& p);
42 ExcSpec(Type *p_type, Value *p_value);
44 virtual ExcSpec *clone() const;
45 virtual void set_my_scope(Scope *p_scope);
46 virtual void set_fullname(const string& p_fullname);
47 Type *get_type() const { return type; }
48 Value *get_value() const { return value; }
64 class CTs : public Node {
67 /** Copy constructor not implemented */
69 /** Assignment disabled */
70 CTs& operator=(const CTs& p);
72 CTs() : Node(), cts() { }
74 virtual CTs *clone() const;
75 virtual void set_fullname(const string& p_fullname);
76 virtual void set_my_scope(Scope *p_scope);
77 size_t get_nof_comps() const;
78 CompField* get_comp_byIndex(size_t n) const;
79 bool has_comp_withName(const Identifier& p_name) const;
80 CompField* get_comp_byName(const Identifier& p_name) const;
81 void tr_compsof(ReferenceChain *refch, bool is_set);
82 void add_ct(CT* p_ct);
83 virtual void dump(unsigned level) const;
87 * ComponentTypeList ExtensionAndException ComponentTypeList
89 class CTs_EE_CTs : public Node {
93 /** Pointer to the owner type */
95 /** Indicates whether the uniqueness of components has been checked */
97 /** Shortcut for all components */
98 vector<CompField> comps_v;
99 /** Map for all components (indexed by component name) */
100 map<string, CompField> comps_m;
101 /** Copy constructor not implemented */
102 CTs_EE_CTs(const CTs_EE_CTs& p);
103 /** Assignment disabled */
104 CTs_EE_CTs& operator=(const CTs_EE_CTs& p);
106 CTs_EE_CTs(CTs *p_cts1, ExtAndExc *p_ee, CTs *p_cts2);
107 virtual ~CTs_EE_CTs();
108 virtual CTs_EE_CTs *clone() const;
109 virtual void set_fullname(const string& p_fullname);
110 virtual void set_my_scope(Scope *p_scope);
111 void set_my_type(Type *p_my_type) { my_type = p_my_type; }
112 size_t get_nof_comps();
113 size_t get_nof_root_comps();
114 CompField* get_comp_byIndex(size_t n);
115 CompField* get_root_comp_byIndex(size_t n);
116 bool has_comp_withName(const Identifier& p_name);
117 CompField* get_comp_byName(const Identifier& p_name);
118 void tr_compsof(ReferenceChain *refch, bool in_ellipsis);
119 bool has_ellipsis() const { return ee != 0; }
120 bool needs_auto_tags();
121 void add_auto_tags();
122 /** Checks the uniqueness of components and builds the shortcut map and
126 virtual void dump(unsigned level) const;
128 void chk_comp_field(CompField *cf, const char *type_name,
129 const char *comp_name);
130 void chk_tags_choice();
132 void chk_tags_seq_comp(Asn::TagCollection& coll, CompField *cf,
135 void get_multiple_tags(Asn::TagCollection& coll, Type *type);
139 * ExtensionAddition (abstract class).
141 class ExtAdd : public Node {
143 virtual ExtAdd *clone() const = 0;
144 virtual size_t get_nof_comps() const = 0;
145 virtual CompField* get_comp_byIndex(size_t n) const = 0;
146 virtual bool has_comp_withName(const Identifier& p_name) const = 0;
147 virtual CompField* get_comp_byName(const Identifier& p_name) const = 0;
148 virtual void tr_compsof(ReferenceChain *refch, bool is_set) = 0;
152 * ExtensionAdditionList
154 class ExtAdds : public Node {
157 /** Copy constructor not implemented */
158 ExtAdds(const ExtAdds& p);
159 /** Assignment disabled */
160 ExtAdds& operator=(const ExtAdds& p);
162 ExtAdds() : Node(), eas() { }
164 virtual ExtAdds *clone() const;
165 virtual void set_fullname(const string& p_fullname);
166 virtual void set_my_scope(Scope *p_scope);
167 size_t get_nof_comps() const;
168 CompField* get_comp_byIndex(size_t n) const;
169 bool has_comp_withName(const Identifier& p_name) const;
170 CompField* get_comp_byName(const Identifier& p_name) const;
171 void tr_compsof(ReferenceChain *refch, bool is_set);
172 void add_ea(ExtAdd* p_ea);
173 virtual void dump(unsigned level) const;
177 * ExtensionAndException
179 class ExtAndExc : public Node {
181 /** optional exception specification */
184 /** Copy constructor not implemented */
185 ExtAndExc(const ExtAndExc& p);
186 /** Assignment disabled */
187 ExtAndExc& operator=(const ExtAndExc& p);
189 ExtAndExc(ExcSpec *p_excSpec, ExtAdds *p_eas=0);
190 virtual ~ExtAndExc();
191 virtual ExtAndExc *clone() const;
192 virtual void set_fullname(const string& p_fullname);
193 virtual void set_my_scope(Scope *p_scope);
194 size_t get_nof_comps() const { return eas->get_nof_comps(); }
195 CompField* get_comp_byIndex(size_t n) const
196 { return eas->get_comp_byIndex(n); }
197 bool has_comp_withName(const Identifier& p_name) const
198 { return eas->has_comp_withName(p_name); }
199 CompField* get_comp_byName(const Identifier& p_name) const
200 { return eas->get_comp_byName(p_name); }
201 void tr_compsof(ReferenceChain *refch, bool is_set)
202 { eas->tr_compsof(refch, is_set); }
203 void set_eas(ExtAdds *p_eas);
204 virtual void dump(unsigned level) const;
208 * ExtensionAdditionGroup
210 class ExtAddGrp : public ExtAdd {
212 /** can be NULL if not present */
213 Value *versionnumber;
215 /** Copy constructor not implemented */
216 ExtAddGrp(const ExtAddGrp& p);
217 /** Assignment disabled */
218 ExtAddGrp& operator=(const ExtAddGrp& p);
220 ExtAddGrp(Value* p_versionnumber, CTs *p_cts);
221 virtual ~ExtAddGrp();
222 virtual ExtAddGrp *clone() const;
223 virtual void set_fullname(const string& p_fullname);
224 virtual void set_my_scope(Scope *p_scope);
225 virtual size_t get_nof_comps() const;
226 virtual CompField* get_comp_byIndex(size_t n) const;
227 virtual bool has_comp_withName(const Identifier& p_name) const;
228 virtual CompField* get_comp_byName(const Identifier& p_name) const;
229 virtual void tr_compsof(ReferenceChain *refch, bool is_set);
230 virtual void dump(unsigned level) const;
234 * ComponentType (abstract class).
236 class CT : public ExtAdd, public Location {
238 virtual CT *clone() const = 0;
242 * ComponentType/regular (Contains only a Component).
244 class CT_reg : public CT {
247 /** Copy constructor not implemented */
248 CT_reg(const CT_reg& p);
249 /** Assignment disabled */
250 CT_reg& operator=(const CT_reg& p);
252 CT_reg(CompField *p_comp);
254 virtual CT_reg *clone() const;
255 virtual void set_fullname(const string& p_fullname);
256 virtual void set_my_scope(Scope *p_scope);
257 virtual size_t get_nof_comps() const;
258 virtual CompField* get_comp_byIndex(size_t n) const;
259 virtual bool has_comp_withName(const Identifier& p_name) const;
260 virtual CompField* get_comp_byName(const Identifier& p_name) const;
261 virtual void tr_compsof(ReferenceChain *refch, bool is_set);
262 virtual void dump(unsigned level) const;
268 class CT_CompsOf : public CT {
271 bool tr_compsof_ready;
273 /** Copy constructor not implemented */
274 CT_CompsOf(const CT_CompsOf& p);
275 /** Assignment disabled */
276 CT_CompsOf& operator=(const CT_CompsOf& p);
278 CT_CompsOf(Type *p_compsoftype);
279 virtual ~CT_CompsOf();
280 virtual CT_CompsOf *clone() const;
281 virtual void set_fullname(const string& p_fullname);
282 virtual void set_my_scope(Scope *p_scope);
283 virtual size_t get_nof_comps() const;
284 virtual CompField* get_comp_byIndex(size_t n) const;
285 virtual bool has_comp_withName(const Identifier& p_name) const;
286 virtual CompField* get_comp_byName(const Identifier& p_name) const;
287 virtual void tr_compsof(ReferenceChain *refch, bool is_set);
288 virtual void dump(unsigned level) const;
291 /** @} end of AST_Type group */
293 } // namespace Common
295 #endif // _Common_Typestuff_HH