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
16 * Szabo, Janos Zoltan – initial implementation
19 * Zalanyi, Balazs Andor
21 ******************************************************************************/
22 #ifndef _Common_Typestuff_HH
23 #define _Common_Typestuff_HH
39 * \addtogroup AST_Type
45 * ExceptionSpecification
47 class ExcSpec : public Node {
51 /** Copy constructor not implemented */
52 ExcSpec(const ExcSpec& p);
53 /** Assignment disabled */
54 ExcSpec& operator=(const ExcSpec& p);
56 ExcSpec(Type *p_type, Value *p_value);
58 virtual ExcSpec *clone() const;
59 virtual void set_my_scope(Scope *p_scope);
60 virtual void set_fullname(const string& p_fullname);
61 Type *get_type() const { return type; }
62 Value *get_value() const { return value; }
78 class CTs : public Node {
81 /** Copy constructor not implemented */
83 /** Assignment disabled */
84 CTs& operator=(const CTs& p);
86 CTs() : Node(), cts() { }
88 virtual CTs *clone() const;
89 virtual void set_fullname(const string& p_fullname);
90 virtual void set_my_scope(Scope *p_scope);
91 size_t get_nof_comps() const;
92 CompField* get_comp_byIndex(size_t n) const;
93 bool has_comp_withName(const Identifier& p_name) const;
94 CompField* get_comp_byName(const Identifier& p_name) const;
95 void tr_compsof(ReferenceChain *refch, bool is_set);
96 void add_ct(CT* p_ct);
97 virtual void dump(unsigned level) const;
101 * ComponentTypeList ExtensionAndException ComponentTypeList
103 class CTs_EE_CTs : public Node {
107 /** Pointer to the owner type */
109 /** Indicates whether the uniqueness of components has been checked */
111 /** Shortcut for all components */
112 vector<CompField> comps_v;
113 /** Map for all components (indexed by component name) */
114 map<string, CompField> comps_m;
115 /** Copy constructor not implemented */
116 CTs_EE_CTs(const CTs_EE_CTs& p);
117 /** Assignment disabled */
118 CTs_EE_CTs& operator=(const CTs_EE_CTs& p);
120 CTs_EE_CTs(CTs *p_cts1, ExtAndExc *p_ee, CTs *p_cts2);
121 virtual ~CTs_EE_CTs();
122 virtual CTs_EE_CTs *clone() const;
123 virtual void set_fullname(const string& p_fullname);
124 virtual void set_my_scope(Scope *p_scope);
125 void set_my_type(Type *p_my_type) { my_type = p_my_type; }
126 size_t get_nof_comps();
127 size_t get_nof_root_comps();
128 CompField* get_comp_byIndex(size_t n);
129 CompField* get_root_comp_byIndex(size_t n);
130 bool has_comp_withName(const Identifier& p_name);
131 CompField* get_comp_byName(const Identifier& p_name);
132 void tr_compsof(ReferenceChain *refch, bool in_ellipsis);
133 bool has_ellipsis() const { return ee != 0; }
134 bool needs_auto_tags();
135 void add_auto_tags();
136 /** Checks the uniqueness of components and builds the shortcut map and
140 virtual void dump(unsigned level) const;
142 void chk_comp_field(CompField *cf, const char *type_name,
143 const char *comp_name);
144 void chk_tags_choice();
146 void chk_tags_seq_comp(Asn::TagCollection& coll, CompField *cf,
149 void get_multiple_tags(Asn::TagCollection& coll, Type *type);
153 * ExtensionAddition (abstract class).
155 class ExtAdd : public Node {
157 virtual ExtAdd *clone() const = 0;
158 virtual size_t get_nof_comps() const = 0;
159 virtual CompField* get_comp_byIndex(size_t n) const = 0;
160 virtual bool has_comp_withName(const Identifier& p_name) const = 0;
161 virtual CompField* get_comp_byName(const Identifier& p_name) const = 0;
162 virtual void tr_compsof(ReferenceChain *refch, bool is_set) = 0;
166 * ExtensionAdditionList
168 class ExtAdds : public Node {
171 /** Copy constructor not implemented */
172 ExtAdds(const ExtAdds& p);
173 /** Assignment disabled */
174 ExtAdds& operator=(const ExtAdds& p);
176 ExtAdds() : Node(), eas() { }
178 virtual ExtAdds *clone() const;
179 virtual void set_fullname(const string& p_fullname);
180 virtual void set_my_scope(Scope *p_scope);
181 size_t get_nof_comps() const;
182 CompField* get_comp_byIndex(size_t n) const;
183 bool has_comp_withName(const Identifier& p_name) const;
184 CompField* get_comp_byName(const Identifier& p_name) const;
185 void tr_compsof(ReferenceChain *refch, bool is_set);
186 void add_ea(ExtAdd* p_ea);
187 virtual void dump(unsigned level) const;
191 * ExtensionAndException
193 class ExtAndExc : public Node {
195 /** optional exception specification */
198 /** Copy constructor not implemented */
199 ExtAndExc(const ExtAndExc& p);
200 /** Assignment disabled */
201 ExtAndExc& operator=(const ExtAndExc& p);
203 ExtAndExc(ExcSpec *p_excSpec, ExtAdds *p_eas=0);
204 virtual ~ExtAndExc();
205 virtual ExtAndExc *clone() const;
206 virtual void set_fullname(const string& p_fullname);
207 virtual void set_my_scope(Scope *p_scope);
208 size_t get_nof_comps() const { return eas->get_nof_comps(); }
209 CompField* get_comp_byIndex(size_t n) const
210 { return eas->get_comp_byIndex(n); }
211 bool has_comp_withName(const Identifier& p_name) const
212 { return eas->has_comp_withName(p_name); }
213 CompField* get_comp_byName(const Identifier& p_name) const
214 { return eas->get_comp_byName(p_name); }
215 void tr_compsof(ReferenceChain *refch, bool is_set)
216 { eas->tr_compsof(refch, is_set); }
217 void set_eas(ExtAdds *p_eas);
218 virtual void dump(unsigned level) const;
222 * ExtensionAdditionGroup
224 class ExtAddGrp : public ExtAdd {
226 /** can be NULL if not present */
227 Value *versionnumber;
229 /** Copy constructor not implemented */
230 ExtAddGrp(const ExtAddGrp& p);
231 /** Assignment disabled */
232 ExtAddGrp& operator=(const ExtAddGrp& p);
234 ExtAddGrp(Value* p_versionnumber, CTs *p_cts);
235 virtual ~ExtAddGrp();
236 virtual ExtAddGrp *clone() const;
237 virtual void set_fullname(const string& p_fullname);
238 virtual void set_my_scope(Scope *p_scope);
239 virtual size_t get_nof_comps() const;
240 virtual CompField* get_comp_byIndex(size_t n) const;
241 virtual bool has_comp_withName(const Identifier& p_name) const;
242 virtual CompField* get_comp_byName(const Identifier& p_name) const;
243 virtual void tr_compsof(ReferenceChain *refch, bool is_set);
244 virtual void dump(unsigned level) const;
248 * ComponentType (abstract class).
250 class CT : public ExtAdd, public Location {
252 virtual CT *clone() const = 0;
256 * ComponentType/regular (Contains only a Component).
258 class CT_reg : public CT {
261 /** Copy constructor not implemented */
262 CT_reg(const CT_reg& p);
263 /** Assignment disabled */
264 CT_reg& operator=(const CT_reg& p);
266 CT_reg(CompField *p_comp);
268 virtual CT_reg *clone() const;
269 virtual void set_fullname(const string& p_fullname);
270 virtual void set_my_scope(Scope *p_scope);
271 virtual size_t get_nof_comps() const;
272 virtual CompField* get_comp_byIndex(size_t n) const;
273 virtual bool has_comp_withName(const Identifier& p_name) const;
274 virtual CompField* get_comp_byName(const Identifier& p_name) const;
275 virtual void tr_compsof(ReferenceChain *refch, bool is_set);
276 virtual void dump(unsigned level) const;
282 class CT_CompsOf : public CT {
285 bool tr_compsof_ready;
287 /** Copy constructor not implemented */
288 CT_CompsOf(const CT_CompsOf& p);
289 /** Assignment disabled */
290 CT_CompsOf& operator=(const CT_CompsOf& p);
292 CT_CompsOf(Type *p_compsoftype);
293 virtual ~CT_CompsOf();
294 virtual CT_CompsOf *clone() const;
295 virtual void set_fullname(const string& p_fullname);
296 virtual void set_my_scope(Scope *p_scope);
297 virtual size_t get_nof_comps() const;
298 virtual CompField* get_comp_byIndex(size_t n) const;
299 virtual bool has_comp_withName(const Identifier& p_name) const;
300 virtual CompField* get_comp_byName(const Identifier& p_name) const;
301 virtual void tr_compsof(ReferenceChain *refch, bool is_set);
302 virtual void dump(unsigned level) const;
305 /** @} end of AST_Type group */
307 } // namespace Common
309 #endif // _Common_Typestuff_HH