+#ifdef TITAN_RUNTIME_2
+template<typename T_type>
+int OPTIONAL<T_type>::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_descr,
+ const TTCN_Typedescriptor_t& p_td,
+ JSON_Tokenizer& p_tok) const
+{
+ switch (get_selection()) {
+ case OPTIONAL_PRESENT:
+ return optional_value->JSON_encode_negtest(p_err_descr, p_td, p_tok);
+ case OPTIONAL_OMIT:
+ return p_tok.put_next_token(JSON_TOKEN_LITERAL_NULL, NULL);
+ default:
+ TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,
+ "Encoding an unbound optional value.");
+ return -1;
+ }
+}
+#endif
+