Use LTTngUSTLogger logger plugin in logtest regression test
[deliverable/titan.core.git] / core / ASN_Null.hh
CommitLineData
d44e3c4f 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
7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Baranyi, Botond
11 * Beres, Szabolcs
12 * Delic, Adam
13 * Forstner, Matyas
14 * Raduly, Csaba
15 * Szabados, Kristof
16 * Szabo, Bence Janos
17 * Szabo, Janos Zoltan – initial implementation
18 * Tatarka, Gabor
19 *
20 ******************************************************************************/
970ed795
EL
21#ifndef ASN_NULL_HH
22#define ASN_NULL_HH
23
24#include "Types.h"
25#include "Basetype.hh"
26#include "Template.hh"
27#include "Optional.hh"
28#include "Encdec.hh"
29#include "BER.hh"
30
31class Module_Param;
32
33class ASN_NULL : public Base_Type {
34 friend boolean operator==(asn_null_type par_value,
35 const ASN_NULL& other_value);
36
37 boolean bound_flag;
38public:
39 ASN_NULL();
40 ASN_NULL(asn_null_type other_value);
41 ASN_NULL(const ASN_NULL& other_value);
42
43 ASN_NULL& operator=(asn_null_type other_value);
44 ASN_NULL& operator=(const ASN_NULL& other_value);
45
46 boolean operator==(asn_null_type other_value) const;
47 boolean operator==(const ASN_NULL& other_value) const;
48 inline boolean operator!=(asn_null_type other_value) const
49 { return !(*this == other_value); }
50 inline boolean operator!=(const ASN_NULL& other_value) const
51 { return !(*this == other_value); }
52
53 inline boolean is_bound() const { return bound_flag; }
54 inline boolean is_value() const { return bound_flag; }
55 inline void clean_up() { bound_flag = FALSE; }
56
57 void log() const;
58
59#ifdef TITAN_RUNTIME_2
60 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const ASN_NULL*>(other_value)); }
61 void set_value(const Base_Type* other_value) { *this = *(static_cast<const ASN_NULL*>(other_value)); }
62 Base_Type* clone() const { return new ASN_NULL(*this); }
63 const TTCN_Typedescriptor_t* get_descriptor() const { return &ASN_NULL_descr_; }
64#else
65 inline boolean is_present() const { return is_bound(); }
66#endif
67
3abe9331 68 void set_param(Module_Param& param);
69 Module_Param* get_param(Module_Param_Name& param_name) const;
970ed795
EL
70
71 void encode_text(Text_Buf& text_buf) const;
72 void decode_text(Text_Buf& text_buf);
73
74 void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
75 TTCN_EncDec::coding_t p_coding, ...) const;
76
77 void decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
78 TTCN_EncDec::coding_t p_coding, ...);
79
80 ASN_BER_TLV_t* BER_encode_TLV(const TTCN_Typedescriptor_t& p_td,
81 unsigned p_coding) const;
82
83 boolean BER_decode_TLV(const TTCN_Typedescriptor_t& p_td,
84 const ASN_BER_TLV_t& p_tlv, unsigned L_form);
85 int XER_encode(const XERdescriptor_t& p_td,
af710487 86 TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const;
970ed795 87 int XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader,
feade998 88 unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*);
af710487 89
90 /** Encodes accordingly to the JSON encoding rules.
91 * Returns the length of the encoded data. */
92 int JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&) const;
93
94 /** Decodes accordingly to the JSON decoding rules.
95 * Returns the length of the encoded data. */
96 int JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&, boolean);
970ed795
EL
97};
98
99extern boolean operator==(asn_null_type par_value, const ASN_NULL& other_value);
100inline boolean operator!=(asn_null_type par_value, const ASN_NULL& other_value)
101 { return !(par_value == other_value); }
102
103class ASN_NULL_template : public Base_Template {
104 struct {
105 unsigned int n_values;
106 ASN_NULL_template *list_value;
107 } value_list;
108
109 void copy_template(const ASN_NULL_template& other_value);
110
111public:
112 ASN_NULL_template();
113 ASN_NULL_template(template_sel other_value);
114 ASN_NULL_template(asn_null_type other_value);
115 ASN_NULL_template(const ASN_NULL& other_value);
116 ASN_NULL_template(const OPTIONAL<ASN_NULL>& other_value);
117 ASN_NULL_template(const ASN_NULL_template& other_value);
118
119 ~ASN_NULL_template();
120 void clean_up();
121
122 ASN_NULL_template& operator=(template_sel other_value);
123 ASN_NULL_template& operator=(asn_null_type other_value);
124 ASN_NULL_template& operator=(const ASN_NULL& other_value);
125 ASN_NULL_template& operator=(const OPTIONAL<ASN_NULL>& other_value);
126 ASN_NULL_template& operator=(const ASN_NULL_template& other_value);
127
3abe9331 128 boolean match(asn_null_type other_value, boolean legacy = FALSE) const;
129 boolean match(const ASN_NULL& other_value, boolean legacy = FALSE) const;
970ed795
EL
130 asn_null_type valueof() const;
131
132 void set_type(template_sel template_type, unsigned int list_length);
133 ASN_NULL_template& list_item(unsigned int list_index);
134
135 void log() const;
3abe9331 136 void log_match(const ASN_NULL& match_value, boolean legacy = FALSE) const;
970ed795
EL
137
138 void set_param(Module_Param& param);
3abe9331 139 Module_Param* get_param(Module_Param_Name& param_name) const;
970ed795
EL
140
141 void encode_text(Text_Buf& text_buf) const;
142 void decode_text(Text_Buf& text_buf);
143
3abe9331 144 boolean is_present(boolean legacy = FALSE) const;
145 boolean match_omit(boolean legacy = FALSE) const;
970ed795
EL
146#ifdef TITAN_RUNTIME_2
147 void valueofv(Base_Type* value) const { *(static_cast<ASN_NULL*>(value)) = valueof(); }
148 void set_value(template_sel other_value) { *this = other_value; }
149 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const ASN_NULL*>(other_value)); }
150 Base_Template* clone() const { return new ASN_NULL_template(*this); }
151 const TTCN_Typedescriptor_t* get_descriptor() const { return &ASN_NULL_descr_; }
3abe9331 152 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const ASN_NULL*>(other_value)), legacy); }
153 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const ASN_NULL*>(match_value)), legacy); }
970ed795 154#else
3abe9331 155 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
970ed795
EL
156#endif
157};
158
159#endif // ASN_NULL_HH
This page took 0.031758 seconds and 5 git commands to generate.