File: Typestuff.hh

package info (click to toggle)
eclipse-titan 6.1.0-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 79,084 kB
  • ctags: 29,092
  • sloc: cpp: 210,764; ansic: 44,862; yacc: 21,034; sh: 12,594; makefile: 12,225; lex: 8,972; xml: 5,348; java: 4,849; perl: 3,780; python: 2,834; php: 175
file content (309 lines) | stat: -rw-r--r-- 9,627 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/******************************************************************************
 * Copyright (c) 2000-2016 Ericsson Telecom AB
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Balasko, Jeno
 *   Delic, Adam
 *   Forstner, Matyas
 *   Gecse, Roland
 *   Kovacs, Ferenc
 *   Raduly, Csaba
 *   Szabados, Kristof
 *   Szabo, Janos Zoltan – initial implementation
 *   Szalai, Gabor
 *   Tatarka, Gabor
 *   Zalanyi, Balazs Andor
 *
 ******************************************************************************/
#ifndef _Common_Typestuff_HH
#define _Common_Typestuff_HH

#include "Setting.hh"

namespace Asn {
  class TagCollection;
} // namespace Asn

namespace Ttcn {
  class WithAttribPath;
}

namespace Common {
  class CompField;

  /**
   * \addtogroup AST_Type
   *
   * @{
   */

  /**
   * ExceptionSpecification
   */
  class ExcSpec : public Node {
  private:
    Type *type;
    Value *value;
    /** Copy constructor not implemented */
    ExcSpec(const ExcSpec& p);
    /** Assignment disabled */
    ExcSpec& operator=(const ExcSpec& p);
  public:
    ExcSpec(Type *p_type, Value *p_value);
    virtual ~ExcSpec();
    virtual ExcSpec *clone() const;
    virtual void set_my_scope(Scope *p_scope);
    virtual void set_fullname(const string& p_fullname);
    Type *get_type() const { return type; }
    Value *get_value() const { return value; }
  };

  class CTs_EE_CTs;
  class CTs;
  class ExtAndExc;
  class ExtAdds;
  class ExtAddGrp;
  class ExtAdd;
  class CT;
  class CT_CompsOf;
  class CT_reg;

  /**
   * ComponentTypeList
   */
  class CTs : public Node {
  private:
    vector<CT> cts;
    /** Copy constructor not implemented */
    CTs(const CTs& p);
    /** Assignment disabled */
    CTs& operator=(const CTs& p);
  public:
    CTs() : Node(), cts() { }
    virtual ~CTs();
    virtual CTs *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    size_t get_nof_comps() const;
    CompField* get_comp_byIndex(size_t n) const;
    bool has_comp_withName(const Identifier& p_name) const;
    CompField* get_comp_byName(const Identifier& p_name) const;
    void tr_compsof(ReferenceChain *refch, bool is_set);
    void add_ct(CT* p_ct);
    virtual void dump(unsigned level) const;
  };

  /**
   * ComponentTypeList ExtensionAndException ComponentTypeList
   */
  class CTs_EE_CTs : public Node {
    CTs *cts1;
    ExtAndExc *ee;
    CTs *cts2;
    /** Pointer to the owner type */
    Type *my_type;
    /** Indicates whether the uniqueness of components has been checked */
    bool checked;
    /** Shortcut for all components */
    vector<CompField> comps_v;
    /** Map for all components (indexed by component name) */
    map<string, CompField> comps_m;
    /** Copy constructor not implemented */
    CTs_EE_CTs(const CTs_EE_CTs& p);
    /** Assignment disabled */
    CTs_EE_CTs& operator=(const CTs_EE_CTs& p);
  public:
    CTs_EE_CTs(CTs *p_cts1, ExtAndExc *p_ee, CTs *p_cts2);
    virtual ~CTs_EE_CTs();
    virtual CTs_EE_CTs *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    void set_my_type(Type *p_my_type) { my_type = p_my_type; }
    size_t get_nof_comps();
    size_t get_nof_root_comps();
    CompField* get_comp_byIndex(size_t n);
    CompField* get_root_comp_byIndex(size_t n);
    bool has_comp_withName(const Identifier& p_name);
    CompField* get_comp_byName(const Identifier& p_name);
    void tr_compsof(ReferenceChain *refch, bool in_ellipsis);
    bool has_ellipsis() const { return ee != 0; }
    bool needs_auto_tags();
    void add_auto_tags();
    /** Checks the uniqueness of components and builds the shortcut map and
      * vectors */
    void chk();
    void chk_tags();
    virtual void dump(unsigned level) const;
  private:
    void chk_comp_field(CompField *cf, const char *type_name,
        const char *comp_name);
    void chk_tags_choice();
    void chk_tags_seq();
    void chk_tags_seq_comp(Asn::TagCollection& coll, CompField *cf,
        bool is_mandatory);
    void chk_tags_set();
    void get_multiple_tags(Asn::TagCollection& coll, Type *type);
  };

  /**
   * ExtensionAddition (abstract class).
   */
  class ExtAdd : public Node {
  public:
    virtual ExtAdd *clone() const = 0;
    virtual size_t get_nof_comps() const = 0;
    virtual CompField* get_comp_byIndex(size_t n) const = 0;
    virtual bool has_comp_withName(const Identifier& p_name) const = 0;
    virtual CompField* get_comp_byName(const Identifier& p_name) const = 0;
    virtual void tr_compsof(ReferenceChain *refch, bool is_set) = 0;
  };

  /**
   * ExtensionAdditionList
   */
  class ExtAdds : public Node {
  private:
    vector<ExtAdd> eas;
    /** Copy constructor not implemented */
    ExtAdds(const ExtAdds& p);
    /** Assignment disabled */
    ExtAdds& operator=(const ExtAdds& p);
  public:
    ExtAdds() : Node(), eas() { }
    virtual ~ExtAdds();
    virtual ExtAdds *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    size_t get_nof_comps() const;
    CompField* get_comp_byIndex(size_t n) const;
    bool has_comp_withName(const Identifier& p_name) const;
    CompField* get_comp_byName(const Identifier& p_name) const;
    void tr_compsof(ReferenceChain *refch, bool is_set);
    void add_ea(ExtAdd* p_ea);
    virtual void dump(unsigned level) const;
  };

  /**
   * ExtensionAndException
   */
  class ExtAndExc : public Node {
  private:
    /** optional exception specification */
    ExcSpec *excSpec;
    ExtAdds *eas;
    /** Copy constructor not implemented */
    ExtAndExc(const ExtAndExc& p);
    /** Assignment disabled */
    ExtAndExc& operator=(const ExtAndExc& p);
  public:
    ExtAndExc(ExcSpec *p_excSpec, ExtAdds *p_eas=0);
    virtual ~ExtAndExc();
    virtual ExtAndExc *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    size_t get_nof_comps() const { return eas->get_nof_comps(); }
    CompField* get_comp_byIndex(size_t n) const
      { return eas->get_comp_byIndex(n); }
    bool has_comp_withName(const Identifier& p_name) const
      { return eas->has_comp_withName(p_name); }
    CompField* get_comp_byName(const Identifier& p_name) const
      { return eas->get_comp_byName(p_name); }
    void tr_compsof(ReferenceChain *refch, bool is_set)
      { eas->tr_compsof(refch, is_set); }
    void set_eas(ExtAdds *p_eas);
    virtual void dump(unsigned level) const;
  };

  /**
   * ExtensionAdditionGroup
   */
  class ExtAddGrp : public ExtAdd {
  private:
    /** can be NULL if not present */
    Value *versionnumber;
    CTs *cts;
    /** Copy constructor not implemented */
    ExtAddGrp(const ExtAddGrp& p);
    /** Assignment disabled */
    ExtAddGrp& operator=(const ExtAddGrp& p);
  public:
    ExtAddGrp(Value* p_versionnumber, CTs *p_cts);
    virtual ~ExtAddGrp();
    virtual ExtAddGrp *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    virtual size_t get_nof_comps() const;
    virtual CompField* get_comp_byIndex(size_t n) const;
    virtual bool has_comp_withName(const Identifier& p_name) const;
    virtual CompField* get_comp_byName(const Identifier& p_name) const;
    virtual void tr_compsof(ReferenceChain *refch, bool is_set);
    virtual void dump(unsigned level) const;
  };

  /**
   * ComponentType (abstract class).
   */
  class CT : public ExtAdd, public Location {
  public:
    virtual CT *clone() const = 0;
  };

  /**
   * ComponentType/regular (Contains only a Component).
   */
  class CT_reg : public CT {
  private:
    CompField *comp;
    /** Copy constructor not implemented */
    CT_reg(const CT_reg& p);
    /** Assignment disabled */
    CT_reg& operator=(const CT_reg& p);
  public:
    CT_reg(CompField *p_comp);
    virtual ~CT_reg();
    virtual CT_reg *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    virtual size_t get_nof_comps() const;
    virtual CompField* get_comp_byIndex(size_t n) const;
    virtual bool has_comp_withName(const Identifier& p_name) const;
    virtual CompField* get_comp_byName(const Identifier& p_name) const;
    virtual void tr_compsof(ReferenceChain *refch, bool is_set);
    virtual void dump(unsigned level) const;
  };

  /**
   * ComponentsOf
   */
  class CT_CompsOf : public CT {
  private:
    Type *compsoftype;
    bool tr_compsof_ready;
    CTs *cts;
    /** Copy constructor not implemented */
    CT_CompsOf(const CT_CompsOf& p);
    /** Assignment disabled */
    CT_CompsOf& operator=(const CT_CompsOf& p);
  public:
    CT_CompsOf(Type *p_compsoftype);
    virtual ~CT_CompsOf();
    virtual CT_CompsOf *clone() const;
    virtual void set_fullname(const string& p_fullname);
    virtual void set_my_scope(Scope *p_scope);
    virtual size_t get_nof_comps() const;
    virtual CompField* get_comp_byIndex(size_t n) const;
    virtual bool has_comp_withName(const Identifier& p_name) const;
    virtual CompField* get_comp_byName(const Identifier& p_name) const;
    virtual void tr_compsof(ReferenceChain *refch, bool is_set);
    virtual void dump(unsigned level) const;
  };

  /** @} end of AST_Type group */

} // namespace Common

#endif // _Common_Typestuff_HH