Sync with 5.4.0
[deliverable/titan.core.git] / core / Param_Types.hh
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 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 PARAM_TYPES_H
9 #define PARAM_TYPES_H
10
11 #include <stddef.h>
12 #include "RInt.hh"
13 #include "Types.h"
14 #include "memory.h"
15 #include "Vector.hh"
16 #include <cstdio>
17
18
19 // the following structures are used in the lexer/parser (ugly historical stuff)
20 struct param_objid_t {
21 int n_components;
22 int *components_ptr;
23 };
24 struct param_bitstring_t {
25 int n_bits;
26 unsigned char *bits_ptr;
27 };
28 struct param_hexstring_t {
29 int n_nibbles;
30 unsigned char *nibbles_ptr;
31 };
32 struct param_octetstring_t {
33 int n_octets;
34 unsigned char *octets_ptr;
35 };
36 struct param_charstring_t {
37 int n_chars;
38 char *chars_ptr;
39 };
40 struct param_universal_charstring_t {
41 int n_uchars;
42 universal_char *uchars_ptr;
43 };
44
45 ///////////////////////////////////////////////////////////////////////////////
46
47 class Module_Param_Id {
48 Module_Param_Id(const Module_Param_Id& p); // copy constructor disabled
49 Module_Param_Id& operator=(const Module_Param_Id& p); // assignment disabled
50 public:
51 Module_Param_Id() {}
52 virtual ~Module_Param_Id() {}
53 virtual bool is_explicit() const = 0;
54 virtual bool is_index() const { return false; }
55 virtual bool is_custom() const { return false; }
56 virtual size_t get_index() const;
57 virtual char* get_name() const;
58 virtual char* get_current_name() const;
59 virtual bool next_name(int offset = 1);
60 virtual char* get_str() const = 0; // returns an expstring that must be deallocated
61 };
62
63 class Module_Param_Name : public Module_Param_Id {
64 /** The first elements are the module name (if any) and the module parameter name,
65 * followed by record/set field names and array (or record of/set of) indexes.
66 * Since the names of modules, module parameters and fields cannot start with
67 * numbers, the indexes are easily distinguishable from these elements. */
68 Vector<char*> names;
69 /** The position of the current element being checked (in vector 'names') */
70 size_t pos;
71 public:
72 Module_Param_Name(const Vector<char*>& p): names(p), pos(0) {}
73 ~Module_Param_Name() { for (size_t i = 0; i < names.size(); ++i) Free(names[i]); }
74 bool is_explicit() const { return true; }
75 char* get_current_name() const { return names[pos]; }
76 bool next_name(int offset = 1) {
77 if (static_cast<int>(pos) + offset < 0 || pos + offset >= names.size()) return false;
78 pos += offset;
79 return true;
80 }
81 void reset() { pos = 0; }
82 boolean is_single_name() const { return names.size() == 1; }
83 char* get_str() const;
84 };
85
86 class Module_Param_FieldName : public Module_Param_Id {
87 char* name; // owned expstring_t
88 public:
89 Module_Param_FieldName(char* p): name(p) {}
90 ~Module_Param_FieldName() { Free(name); }
91 char* get_name() const { return name; }
92 bool is_explicit() const { return true; }
93 char* get_str() const;
94 };
95
96 class Module_Param_Index : public Module_Param_Id {
97 size_t index;
98 bool is_expl;
99 public:
100 Module_Param_Index(size_t p_index, bool p_is_expl): index(p_index), is_expl(p_is_expl) {}
101 size_t get_index() const { return index; }
102 bool is_index() const { return true; }
103 bool is_explicit() const { return is_expl; }
104 char* get_str() const;
105 };
106
107 /** Custom module parameter name class, used in Module_Param instances that aren't
108 * actual module parameters (length boundaries, array indexes and character codes in
109 * quadruples use temporary Module_Param instances to allow the use of expressions
110 * and references to module parameters).
111 * Errors reported in these cases will contain the custom text set in this class,
112 * instead of the regular error message header. */
113 class Module_Param_CustomName : public Module_Param_Id {
114 char* name; // owned expstring_t
115 public:
116 Module_Param_CustomName(char* p): name(p) {}
117 ~Module_Param_CustomName() { Free(name); }
118 char* get_name() const { return name; }
119 bool is_explicit() const { return true; }
120 char* get_str() const;
121 bool is_custom() const { return true; }
122 };
123
124 ///////////////////////////////////////////////////////////////////////////////
125
126 class Module_Param_Length_Restriction {
127 Module_Param_Length_Restriction(const Module_Param_Length_Restriction& p); // copy constructor disabled
128 Module_Param_Length_Restriction& operator=(const Module_Param_Length_Restriction& p); // assignment disabled
129 size_t min;
130 bool has_max;
131 size_t max;
132 public:
133 Module_Param_Length_Restriction(): min(0), has_max(false), max(0) {}
134 void set_single(size_t p_single) { has_max=true; min = max = p_single; }
135 void set_min(size_t p_min) { min=p_min; }
136 void set_max(size_t p_max) { has_max=true; max=p_max; }
137 size_t get_min() const { return min; }
138 bool get_has_max() const { return has_max; }
139 size_t get_max() const { return max; }
140 bool is_single() const { return has_max && min==max; }
141 void log() const;
142 };
143
144 ///////////////////////////////////////////////////////////////////////////////
145
146 // forward declaration
147 class Module_Param_Ptr;
148
149 class Module_Param {
150 Module_Param(const Module_Param& p); // copy constructor disabled
151 Module_Param& operator=(const Module_Param& p); // assignment disabled
152
153 public:
154 enum type_t { // list of all derived classes that can be instantiated
155 MP_NotUsed,
156 MP_Omit,
157 MP_Integer,
158 MP_Float,
159 MP_Boolean,
160 MP_Verdict,
161 MP_Objid,
162 MP_Bitstring,
163 MP_Hexstring,
164 MP_Octetstring,
165 MP_Charstring,
166 MP_Universal_Charstring,
167 MP_Enumerated,
168 MP_Ttcn_Null,
169 MP_Ttcn_mtc,
170 MP_Ttcn_system,
171 MP_Asn_Null,
172 MP_Any,
173 MP_AnyOrNone,
174 MP_IntRange,
175 MP_FloatRange,
176 MP_StringRange,
177 MP_Pattern,
178 MP_Bitstring_Template,
179 MP_Hexstring_Template,
180 MP_Octetstring_Template,
181 MP_Assignment_List,
182 MP_Value_List,
183 MP_Indexed_List,
184 MP_List_Template,
185 MP_ComplementList_Template,
186 MP_Superset_Template,
187 MP_Subset_Template,
188 MP_Permutation_Template,
189 MP_Reference,
190 MP_Unbound,
191 MP_Expression
192 };
193 enum operation_type_t { OT_ASSIGN, OT_CONCAT };
194 enum basic_check_bits_t { // used to parametrize basic_check()
195 BC_VALUE = 0x00, // non-list values
196 BC_LIST = 0x01, // list values and templates
197 BC_TEMPLATE = 0x02 // templates
198 };
199 enum expression_operand_t { // expression types for MP_Expression
200 EXPR_ERROR, // for reporting errors
201 EXPR_ADD,
202 EXPR_SUBTRACT,
203 EXPR_MULTIPLY,
204 EXPR_DIVIDE,
205 EXPR_CONCATENATE,
206 EXPR_NEGATE // only operand1 is used
207 };
208
209 protected:
210 operation_type_t operation_type;
211 Module_Param_Id* id; // owned
212 Module_Param* parent; // not owned, NULL if no parent
213 boolean has_ifpresent; // true if 'ifpresent' was used
214 Module_Param_Length_Restriction* length_restriction; // owned, NULL if no length restriction
215
216 public:
217 // set default values, these shall be changed using member functions or constructors of derived classes
218 Module_Param(): operation_type(OT_ASSIGN), id(NULL), parent(NULL), has_ifpresent(FALSE), length_restriction(NULL) {}
219 virtual ~Module_Param() { delete id; delete length_restriction; }
220
221 virtual type_t get_type() const = 0;
222 void set_parent(Module_Param* p_parent) { parent = p_parent; }
223 void set_id(Module_Param_Id* p_id);
224 Module_Param_Id* get_id() const; // returns the Id or error, never returns NULL (because every module parameter
225 // should have either an explicit or an implicit id when this is called)
226 void set_ifpresent() { has_ifpresent = TRUE; }
227 boolean get_ifpresent() const { return has_ifpresent; }
228 void set_length_restriction(Module_Param_Length_Restriction* p_length_restriction);
229 Module_Param_Length_Restriction* get_length_restriction() const { return length_restriction; }
230 operation_type_t get_operation_type() const { return operation_type; }
231 void set_operation_type(operation_type_t p_optype) { operation_type = p_optype; }
232 const char* get_operation_type_str() const;
233 const char* get_operation_type_sign_str() const;
234 virtual const char* get_type_str() const = 0;
235 void log(bool log_id = true) const;
236 virtual void log_value() const = 0;
237 char* get_param_context() const;
238
239 // error reporter functions
240 void error(const char* err, ...) const
241 __attribute__ ((__format__ (__printf__, 2, 3), __noreturn__));
242
243 void type_error(const char* expected, const char* type_name = NULL) const
244 __attribute__ ((__noreturn__));
245
246 inline void expr_type_error(const char* type_name) const
247 __attribute__ ((__noreturn__)) {
248 error("%s is not allowed in %s expression.",
249 get_expr_type_str(), type_name);
250 }
251
252 // check and error report function for operation type, ifpresent and length restriction
253 void basic_check(int check_type, const char* what) const;
254
255 // add element to compound type, error if not compound type
256 virtual void add_elem(Module_Param* value);
257 virtual void add_list_with_implicit_ids(Vector<Module_Param*>* mp_list);
258
259 // try to access data of a given type, error if it's another type
260 virtual boolean get_boolean() const;
261 virtual size_t get_size() const;
262 virtual Module_Param* get_elem(size_t index) const;
263 virtual int get_string_size() const;
264 virtual void* get_string_data() const;
265 virtual int_val_t* get_lower_int() const;
266 virtual int_val_t* get_upper_int() const;
267 virtual double get_lower_float() const;
268 virtual double get_upper_float() const;
269 virtual bool has_lower_float() const;
270 virtual bool has_upper_float() const;
271 virtual universal_char get_lower_uchar() const;
272 virtual universal_char get_upper_uchar() const;
273 virtual int_val_t* get_integer() const;
274 virtual double get_float() const;
275 virtual char* get_pattern() const;
276 virtual verdicttype get_verdict() const;
277 virtual char* get_enumerated() const;
278 virtual Module_Param_Ptr get_referenced_param() const;
279 virtual expression_operand_t get_expr_type() const;
280 virtual const char* get_expr_type_str() const;
281 virtual Module_Param* get_operand1() const;
282 virtual Module_Param* get_operand2() const;
283 };
284
285 /** Smart pointer class for Module_Param instances
286 * Uses a reference counter so the Module_Param object is never copied.
287 * Deletes the object (if it's temporary), when the reference counter reaches zero. */
288 class Module_Param_Ptr {
289 struct module_param_ptr_struct {
290 Module_Param* mp_ptr;
291 boolean temporary;
292 int ref_count;
293 } *ptr;
294 void clean_up();
295 public:
296 Module_Param_Ptr(Module_Param* p);
297 Module_Param_Ptr(const Module_Param_Ptr& r);
298 ~Module_Param_Ptr() { clean_up(); }
299 Module_Param_Ptr& operator=(const Module_Param_Ptr& r);
300 void set_temporary() { ptr->temporary = TRUE; }
301 Module_Param& operator*() { return *ptr->mp_ptr; }
302 Module_Param* operator->() { return ptr->mp_ptr; }
303 };
304
305 /** Module parameter reference (and enumerated value)
306 * Stores a reference to another module parameter, that can be retrieved with the
307 * method get_referenced_param().
308 * @note Enumerated values are stored as references (with only 1 name segment),
309 * since the parser cannot distinguish them. */
310 class Module_Param_Reference : public Module_Param {
311 Module_Param_Name* mp_ref;
312 public:
313 type_t get_type() const { return MP_Reference; }
314 Module_Param_Reference(Module_Param_Name* p);
315 ~Module_Param_Reference() { delete mp_ref; }
316 Module_Param_Ptr get_referenced_param() const;
317 char* get_enumerated() const;
318 const char* get_type_str() const { return "module parameter reference"; }
319 void log_value() const;
320 };
321
322 /** Unbound module parameter
323 * This cannot be created by the parser, only by get_referenced_param(), when
324 * the referenced module parameter is unbound. */
325 class Module_Param_Unbound : public Module_Param {
326 type_t get_type() const { return MP_Unbound; }
327 const char* get_type_str() const { return "<unbound>"; }
328 void log_value() const;
329 };
330
331 /** Module parameter expression
332 * Contains an unprocessed module parameter expression with one or two operands.
333 * Expression types:
334 * with 2 operands: +, -, *, /, &
335 * with 1 operand: - (unary + is handled by the parser). */
336 class Module_Param_Expression : public Module_Param {
337 private:
338 expression_operand_t expr_type;
339 Module_Param* operand1;
340 Module_Param* operand2;
341 public:
342 Module_Param_Expression(expression_operand_t p_type, Module_Param* p_op1,
343 Module_Param* p_op2);
344 Module_Param_Expression(Module_Param* p_op);
345 ~Module_Param_Expression();
346 expression_operand_t get_expr_type() const { return expr_type; }
347 const char* get_expr_type_str() const;
348 Module_Param* get_operand1() const { return operand1; }
349 Module_Param* get_operand2() const { return operand2; }
350 type_t get_type() const { return MP_Expression; }
351 const char* get_type_str() const { return "expression"; }
352 void log_value() const;
353 };
354
355 class Module_Param_NotUsed : public Module_Param {
356 public:
357 type_t get_type() const { return MP_NotUsed; }
358 const char* get_type_str() const { return "-"; }
359 void log_value() const;
360 };
361
362 class Module_Param_Omit : public Module_Param {
363 public:
364 type_t get_type() const { return MP_Omit; }
365 const char* get_type_str() const { return "omit"; }
366 void log_value() const;
367 };
368
369 class Module_Param_Integer : public Module_Param {
370 int_val_t* integer_value;
371 public:
372 type_t get_type() const { return MP_Integer; }
373 Module_Param_Integer(int_val_t* p);
374 ~Module_Param_Integer() { delete integer_value; }
375 int_val_t* get_integer() const { return integer_value; }
376 const char* get_type_str() const { return "integer"; }
377 void log_value() const;
378 };
379
380 class Module_Param_Float : public Module_Param {
381 double float_value;
382 public:
383 type_t get_type() const { return MP_Float; }
384 Module_Param_Float(double p): float_value(p) {}
385 double get_float() const { return float_value; }
386 const char* get_type_str() const { return "float"; }
387 void log_value() const;
388 };
389
390 class Module_Param_Boolean : public Module_Param {
391 boolean boolean_value;
392 public:
393 type_t get_type() const { return MP_Boolean; }
394 Module_Param_Boolean(boolean p): boolean_value(p) {}
395 boolean get_boolean() const { return boolean_value; }
396 const char* get_type_str() const { return "boolean"; }
397 void log_value() const;
398 };
399
400 class Module_Param_Verdict : public Module_Param {
401 verdicttype verdict_value;
402 public:
403 type_t get_type() const { return MP_Verdict; }
404 Module_Param_Verdict(verdicttype p): verdict_value(p) {}
405 verdicttype get_verdict() const { return verdict_value; }
406 const char* get_type_str() const { return "verdict"; }
407 void log_value() const;
408 };
409
410 template <typename CHARTYPE>
411 class Module_Param_String : public Module_Param {
412 protected:
413 int n_chars;
414 CHARTYPE* chars_ptr;
415 public:
416 Module_Param_String(int p_n, CHARTYPE* p_c): n_chars(p_n), chars_ptr(p_c) {}
417 ~Module_Param_String() { Free(chars_ptr); }
418 int get_string_size() const { return n_chars; }
419 void* get_string_data() const { return (void*)chars_ptr; }
420 };
421
422 class Module_Param_Objid : public Module_Param_String<int> { // special string of integers :)
423 public:
424 type_t get_type() const { return MP_Objid; }
425 Module_Param_Objid(int p_n, int* p_c): Module_Param_String<int>(p_n, p_c) {}
426 const char* get_type_str() const { return "object identifier"; }
427 void log_value() const;
428 };
429
430 class Module_Param_Bitstring : public Module_Param_String<unsigned char> {
431 public:
432 type_t get_type() const { return MP_Bitstring; }
433 Module_Param_Bitstring(int p_n, unsigned char* p_c): Module_Param_String<unsigned char>(p_n, p_c) {}
434 const char* get_type_str() const { return "bitstring"; }
435 void log_value() const;
436 };
437
438 class Module_Param_Hexstring : public Module_Param_String<unsigned char> {
439 public:
440 type_t get_type() const { return MP_Hexstring; }
441 Module_Param_Hexstring(int p_n, unsigned char* p_c): Module_Param_String<unsigned char>(p_n, p_c) {}
442 const char* get_type_str() const { return "hexstring"; }
443 void log_value() const;
444 };
445
446 class Module_Param_Octetstring : public Module_Param_String<unsigned char> {
447 public:
448 type_t get_type() const { return MP_Octetstring; }
449 Module_Param_Octetstring(int p_n, unsigned char* p_c): Module_Param_String<unsigned char>(p_n, p_c) {}
450 const char* get_type_str() const { return "octetstring"; }
451 void log_value() const;
452 };
453
454 class Module_Param_Charstring : public Module_Param_String<char> {
455 public:
456 type_t get_type() const { return MP_Charstring; }
457 Module_Param_Charstring(int p_n, char* p_c): Module_Param_String<char>(p_n, p_c) {}
458 const char* get_type_str() const { return "charstring"; }
459 void log_value() const;
460 };
461
462 class Module_Param_Universal_Charstring : public Module_Param_String<universal_char> {
463 public:
464 type_t get_type() const { return MP_Universal_Charstring; }
465 Module_Param_Universal_Charstring(int p_n, universal_char* p_c)
466 : Module_Param_String<universal_char>(p_n, p_c) {}
467 const char* get_type_str() const { return "universal charstring"; }
468 void log_value() const;
469 };
470
471 class Module_Param_Enumerated : public Module_Param {
472 char* enum_value;
473 public:
474 type_t get_type() const { return MP_Enumerated; }
475 Module_Param_Enumerated(char* p_e): enum_value(p_e) {}
476 ~Module_Param_Enumerated() { Free(enum_value); }
477 char* get_enumerated() const { return enum_value; }
478 const char* get_type_str() const { return "enumerated"; }
479 void log_value() const;
480 };
481
482 class Module_Param_Ttcn_Null : public Module_Param {
483 public:
484 type_t get_type() const { return MP_Ttcn_Null; }
485 const char* get_type_str() const { return "null"; }
486 void log_value() const;
487 };
488
489 class Module_Param_Ttcn_mtc : public Module_Param {
490 public:
491 type_t get_type() const { return MP_Ttcn_mtc; }
492 const char* get_type_str() const { return "mtc"; }
493 void log_value() const;
494 };
495
496 class Module_Param_Ttcn_system : public Module_Param {
497 public:
498 type_t get_type() const { return MP_Ttcn_system; }
499 const char* get_type_str() const { return "system"; }
500 void log_value() const;
501 };
502
503 class Module_Param_Asn_Null : public Module_Param {
504 public:
505 type_t get_type() const { return MP_Asn_Null; }
506 const char* get_type_str() const { return "NULL"; }
507 void log_value() const;
508 };
509
510 class Module_Param_Any : public Module_Param {
511 public:
512 type_t get_type() const { return MP_Any; }
513 const char* get_type_str() const { return "?"; }
514 void log_value() const;
515 };
516
517 class Module_Param_AnyOrNone : public Module_Param {
518 public:
519 type_t get_type() const { return MP_AnyOrNone; }
520 const char* get_type_str() const { return "*"; }
521 void log_value() const;
522 };
523
524 class Module_Param_IntRange : public Module_Param {
525 int_val_t* lower_bound; // NULL == -infinity
526 int_val_t* upper_bound; // NULL == infinity
527 public:
528 type_t get_type() const { return MP_IntRange; }
529 Module_Param_IntRange(int_val_t* p_l, int_val_t* p_u): lower_bound(p_l), upper_bound(p_u) {}
530 ~Module_Param_IntRange() { Free(lower_bound); Free(upper_bound); }
531 int_val_t* get_lower_int() const { return lower_bound; }
532 int_val_t* get_upper_int() const { return upper_bound; }
533 const char* get_type_str() const { return "integer range"; }
534 void log_value() const;
535 static void log_bound(int_val_t* bound, bool is_lower);
536 };
537
538 class Module_Param_FloatRange : public Module_Param {
539 double lower_bound;
540 bool has_lower;
541 double upper_bound;
542 bool has_upper;
543 public:
544 type_t get_type() const { return MP_FloatRange; }
545 Module_Param_FloatRange(double p_lb, bool p_hl, double p_ub, bool p_hu): lower_bound(p_lb), has_lower(p_hl), upper_bound(p_ub), has_upper(p_hu) {}
546 double get_lower_float() const { return lower_bound; }
547 double get_upper_float() const { return upper_bound; }
548 bool has_lower_float() const { return has_lower; }
549 bool has_upper_float() const { return has_upper; }
550 const char* get_type_str() const { return "float range"; }
551 void log_value() const;
552 };
553
554 class Module_Param_StringRange : public Module_Param {
555 universal_char lower_bound;
556 universal_char upper_bound;
557 public:
558 type_t get_type() const { return MP_StringRange; }
559 Module_Param_StringRange(const universal_char& p_lb, const universal_char& p_ub): lower_bound(p_lb), upper_bound(p_ub) {}
560 universal_char get_lower_uchar() const { return lower_bound; }
561 universal_char get_upper_uchar() const { return upper_bound; }
562 const char* get_type_str() const { return "char range"; }
563 void log_value() const;
564 };
565
566 class Module_Param_Pattern : public Module_Param {
567 char* pattern;
568 public:
569 type_t get_type() const { return MP_Pattern; }
570 Module_Param_Pattern(char* p_p): pattern(p_p) {}
571 ~Module_Param_Pattern() { Free(pattern); }
572 char* get_pattern() const { return pattern; }
573 const char* get_type_str() const { return "pattern"; }
574 void log_value() const;
575 };
576
577 class Module_Param_Bitstring_Template : public Module_Param_String<unsigned char> { // template parameter type is taken from String_struct.hh (B/H/O-string template structures)
578 public:
579 type_t get_type() const { return MP_Bitstring_Template; }
580 Module_Param_Bitstring_Template(int p_n, unsigned char* p_c): Module_Param_String<unsigned char>(p_n, p_c) {}
581 const char* get_type_str() const { return "bitstring template"; }
582 void log_value() const;
583 };
584
585 class Module_Param_Hexstring_Template : public Module_Param_String<unsigned char> {
586 public:
587 type_t get_type() const { return MP_Hexstring_Template; }
588 Module_Param_Hexstring_Template(int p_n, unsigned char* p_c): Module_Param_String<unsigned char>(p_n, p_c) {}
589 const char* get_type_str() const { return "hexstring template"; }
590 void log_value() const;
591 };
592
593 class Module_Param_Octetstring_Template : public Module_Param_String<unsigned short> {
594 public:
595 type_t get_type() const { return MP_Octetstring_Template; }
596 Module_Param_Octetstring_Template(int p_n, unsigned short* p_c): Module_Param_String<unsigned short>(p_n, p_c) {}
597 const char* get_type_str() const { return "octetstring template"; }
598 void log_value() const;
599 };
600
601 class Module_Param_Compound : public Module_Param {
602 Vector<Module_Param*> values; // Module_Param instances are owned
603 public:
604 Module_Param_Compound() {}
605 ~Module_Param_Compound();
606 void log_value_vec(const char* begin_str, const char* end_str) const;
607 void add_elem(Module_Param* value);
608 // add a list of params, adds to each one an implicit index based on
609 // the position in the values vector
610 void add_list_with_implicit_ids(Vector<Module_Param*>* mp_list);
611 size_t get_size() const;
612 Module_Param* get_elem(size_t index) const;
613 };
614
615 class Module_Param_Assignment_List : public Module_Param_Compound {
616 public:
617 type_t get_type() const { return MP_Assignment_List; }
618 const char* get_type_str() const { return "list with assignment notation"; }
619 void log_value() const { log_value_vec("{","}"); }
620 };
621
622 class Module_Param_Value_List : public Module_Param_Compound {
623 public:
624 type_t get_type() const { return MP_Value_List; }
625 const char* get_type_str() const { return "value list"; }
626 void log_value() const { log_value_vec("{","}"); }
627 };
628
629 class Module_Param_Indexed_List : public Module_Param_Compound {
630 public:
631 type_t get_type() const { return MP_Indexed_List; }
632 const char* get_type_str() const { return "indexed value list"; }
633 void log_value() const { log_value_vec("{","}"); }
634 };
635
636 class Module_Param_List_Template : public Module_Param_Compound {
637 public:
638 type_t get_type() const { return MP_List_Template; }
639 const char* get_type_str() const { return "list template"; }
640 void log_value() const { log_value_vec("(",")"); }
641 };
642
643 class Module_Param_ComplementList_Template : public Module_Param_Compound {
644 public:
645 type_t get_type() const { return MP_ComplementList_Template; }
646 const char* get_type_str() const { return "complemented list template"; }
647 void log_value() const { log_value_vec("complement(",")"); }
648 };
649
650 class Module_Param_Superset_Template : public Module_Param_Compound {
651 public:
652 type_t get_type() const { return MP_Superset_Template; }
653 const char* get_type_str() const { return "superset template"; }
654 void log_value() const { log_value_vec("superset(",")"); }
655 };
656
657 class Module_Param_Subset_Template : public Module_Param_Compound {
658 public:
659 type_t get_type() const { return MP_Subset_Template; }
660 const char* get_type_str() const { return "subset template"; }
661 void log_value() const { log_value_vec("subset(",")"); }
662 };
663
664 class Module_Param_Permutation_Template : public Module_Param_Compound {
665 public:
666 type_t get_type() const { return MP_Permutation_Template; }
667 const char* get_type_str() const { return "permutation template"; }
668 void log_value() const { log_value_vec("permutation(",")"); }
669 };
670
671 class Ttcn_String_Parsing {
672 private: // only instantiation can set it to true and destruction set it back to false
673 static bool string_parsing;
674 public:
675 Ttcn_String_Parsing() { string_parsing = true; }
676 ~Ttcn_String_Parsing() { string_parsing = false; }
677 static bool happening() { return string_parsing; }
678 };
679
680 /** Use the configuration file parser to convert a string into a TTCN-3 value.
681 * @param mp_str the converted string (used as if it were a module parameter in a
682 * config file)
683 * @param is_component true, if the expected TTCN-3 value is a component
684 * @return the TTCN-3 value in module parameter form (will be set using set_param)
685 * @tricky Component names (given with the "start" command) can contain any characters.
686 * This conflicts with several other rules, so certain rules in the parser will only
687 * be applied to components. */
688 extern Module_Param* process_config_string2ttcn(const char* mp_str, bool is_component);
689
690 #endif
This page took 0.06639 seconds and 5 git commands to generate.