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 ///////////////////////////////////////////////////////////////////////////////
12 #include "Basetype.hh"
13 #include "Template.hh"
14 #include "Optional.hh"
20 class ASN_NULL : public Base_Type {
21 friend boolean operator==(asn_null_type par_value,
22 const ASN_NULL& other_value);
27 ASN_NULL(asn_null_type other_value);
28 ASN_NULL(const ASN_NULL& other_value);
30 ASN_NULL& operator=(asn_null_type other_value);
31 ASN_NULL& operator=(const ASN_NULL& other_value);
33 boolean operator==(asn_null_type other_value) const;
34 boolean operator==(const ASN_NULL& other_value) const;
35 inline boolean operator!=(asn_null_type other_value) const
36 { return !(*this == other_value); }
37 inline boolean operator!=(const ASN_NULL& other_value) const
38 { return !(*this == other_value); }
40 inline boolean is_bound() const { return bound_flag; }
41 inline boolean is_value() const { return bound_flag; }
42 inline void clean_up() { bound_flag = FALSE; }
46 #ifdef TITAN_RUNTIME_2
47 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const ASN_NULL*>(other_value)); }
48 void set_value(const Base_Type* other_value) { *this = *(static_cast<const ASN_NULL*>(other_value)); }
49 Base_Type* clone() const { return new ASN_NULL(*this); }
50 const TTCN_Typedescriptor_t* get_descriptor() const { return &ASN_NULL_descr_; }
52 inline boolean is_present() const { return is_bound(); }
55 void set_param(Module_Param& param);
57 void encode_text(Text_Buf& text_buf) const;
58 void decode_text(Text_Buf& text_buf);
60 void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
61 TTCN_EncDec::coding_t p_coding, ...) const;
63 void decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
64 TTCN_EncDec::coding_t p_coding, ...);
66 ASN_BER_TLV_t* BER_encode_TLV(const TTCN_Typedescriptor_t& p_td,
67 unsigned p_coding) const;
69 boolean BER_decode_TLV(const TTCN_Typedescriptor_t& p_td,
70 const ASN_BER_TLV_t& p_tlv, unsigned L_form);
71 int XER_encode(const XERdescriptor_t& p_td,
72 TTCN_Buffer& p_buf, unsigned int flavor, int indent) const;
73 int XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader,
77 extern boolean operator==(asn_null_type par_value, const ASN_NULL& other_value);
78 inline boolean operator!=(asn_null_type par_value, const ASN_NULL& other_value)
79 { return !(par_value == other_value); }
81 class ASN_NULL_template : public Base_Template {
83 unsigned int n_values;
84 ASN_NULL_template *list_value;
87 void copy_template(const ASN_NULL_template& other_value);
91 ASN_NULL_template(template_sel other_value);
92 ASN_NULL_template(asn_null_type other_value);
93 ASN_NULL_template(const ASN_NULL& other_value);
94 ASN_NULL_template(const OPTIONAL<ASN_NULL>& other_value);
95 ASN_NULL_template(const ASN_NULL_template& other_value);
100 ASN_NULL_template& operator=(template_sel other_value);
101 ASN_NULL_template& operator=(asn_null_type other_value);
102 ASN_NULL_template& operator=(const ASN_NULL& other_value);
103 ASN_NULL_template& operator=(const OPTIONAL<ASN_NULL>& other_value);
104 ASN_NULL_template& operator=(const ASN_NULL_template& other_value);
106 boolean match(asn_null_type other_value) const;
107 boolean match(const ASN_NULL& other_value) const;
108 asn_null_type valueof() const;
110 void set_type(template_sel template_type, unsigned int list_length);
111 ASN_NULL_template& list_item(unsigned int list_index);
114 void log_match(const ASN_NULL& match_value) const;
116 void set_param(Module_Param& param);
118 void encode_text(Text_Buf& text_buf) const;
119 void decode_text(Text_Buf& text_buf);
121 boolean is_present() const;
122 boolean match_omit() const;
123 #ifdef TITAN_RUNTIME_2
124 void valueofv(Base_Type* value) const { *(static_cast<ASN_NULL*>(value)) = valueof(); }
125 void set_value(template_sel other_value) { *this = other_value; }
126 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const ASN_NULL*>(other_value)); }
127 Base_Template* clone() const { return new ASN_NULL_template(*this); }
128 const TTCN_Typedescriptor_t* get_descriptor() const { return &ASN_NULL_descr_; }
129 boolean matchv(const Base_Type* other_value) const { return match(*(static_cast<const ASN_NULL*>(other_value))); }
130 void log_matchv(const Base_Type* match_value) const { log_match(*(static_cast<const ASN_NULL*>(match_value))); }
132 void check_restriction(template_res t_res, const char* t_name=NULL) const;
136 #endif // ASN_NULL_HH