// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version: 15.0.0.0
//  
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace amqplib_generator
{
    using System.Linq;
    using System.Text;
    using System.Collections.Generic;
    using amqplib_generator;
    using System;
    
    /// <summary>
    /// Class to produce the template output
    /// </summary>
    
    #line 1 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")]
    public partial class amqp_definitions_c : amqp_definitions_cBase
    {
#line hidden
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n");
            
            #line 8 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 amqp amqp = Program.LoadAMQPTypes(); 
            
            #line default
            #line hidden
            this.Write(@"
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

// This file is generated. DO NOT EDIT it manually.
// The generator that produces it is located at /uamqp_generator/uamqp_generator.sln

#include <stdlib.h>
#include ""azure_c_shared_utility/optimize_size.h""
#include ""azure_c_shared_utility/gballoc.h""
#include ""azure_uamqp_c/amqpvalue.h""
#include ""azure_uamqp_c/amqp_definitions.h""
#include <stdlib.h>
#include <stdbool.h>

");
            
            #line 24 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
  foreach (section section in amqp.Items.Where(item => item is section)) 
            
            #line default
            #line hidden
            
            #line 25 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
  { 
            
            #line default
            #line hidden
            
            #line 26 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      List<type> types = new List<type>(); 
            
            #line default
            #line hidden
            
            #line 27 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      types.AddRange(section.Items.Where(item => item is type).Cast<type>()); 
            
            #line default
            #line hidden
            
            #line 28 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      foreach (type type in types) 
            
            #line default
            #line hidden
            
            #line 29 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            
            #line 30 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          string type_name = type.name.ToLower().Replace('-', '_'); 
            
            #line default
            #line hidden
            
            #line 31 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          if (type.@class == typeClass.composite) 
            
            #line default
            #line hidden
            
            #line 32 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          { 
            
            #line default
            #line hidden
            
            #line 33 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              var descriptor = type.Items.Where(item => item is descriptor).First() as descriptor; 
            
            #line default
            #line hidden
            this.Write("/* ");
            
            #line 34 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.name));
            
            #line default
            #line hidden
            this.Write(" */\r\n\r\ntypedef struct ");
            
            #line 36 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE_TAG\r\n{\r\n    AMQP_VALUE composite_value;\r\n} ");
            
            #line 39 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE;\r\n\r\n");
            
            #line 41 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              string arg_list = Program.GetMandatoryArgList(type); 
            
            #line default
            #line hidden
            
            #line 42 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              KeyValuePair<field, int>[] mandatory_args = Program.GetMandatoryArgs(type).ToArray(); 
            
            #line default
            #line hidden
            this.Write("static ");
            
            #line 43 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 43 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_create_internal(void)\r\n{\r\n    ");
            
            #line 45 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 45 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 45 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)malloc(sizeof(");
            
            #line 45 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE));\r\n    if (");
            
            #line 46 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance != NULL)\r\n    {\r\n        ");
            
            #line 48 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value = NULL;\r\n    }\r\n\r\n    return ");
            
            #line 51 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance;\r\n}\r\n\r\n");
            
            #line 54 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 54 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_create(");
            
            #line 54 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(arg_list));
            
            #line default
            #line hidden
            this.Write(")\r\n{\r\n    ");
            
            #line 56 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 56 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 56 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)malloc(sizeof(");
            
            #line 56 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE));\r\n    if (");
            
            #line 57 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance != NULL)\r\n    {\r\n        ");
            
            #line 59 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(");
            
            #line 59 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Program.GetDescriptorCode(Program.GetDescriptor(type))));
            
            #line default
            #line hidden
            this.Write(");\r\n        if (");
            
            #line 60 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value == NULL)\r\n        {\r\n            free(");
            
            #line 62 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance);\r\n            ");
            
            #line 63 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = NULL;\r\n        }\r\n");
            
            #line 65 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              if (mandatory_args.Count() > 0) 
            
            #line default
            #line hidden
            
            #line 66 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            this.Write("        else\r\n        {\r\n");
            
            #line 69 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  for (int i = 0; i < mandatory_args.Count(); i++) 
            
            #line default
            #line hidden
            
            #line 70 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 71 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      string mandatory_arg_name = mandatory_args[i].Key.name.ToLower().Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            this.Write("            AMQP_VALUE ");
            
            #line 72 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_arg_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value;\r\n");
            
            #line 73 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("            int result = 0;\r\n\r\n");
            
            #line 76 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  for (int i = 0; i < mandatory_args.Count(); i++) 
            
            #line default
            #line hidden
            
            #line 77 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 78 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      string mandatory_arg_type = Program.GetCType(mandatory_args[i].Key.type.ToLower(), mandatory_args[i].Key.multiple == "true").Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 79 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      string mandatory_arg_name = mandatory_args[i].Key.name.ToLower().Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 80 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (mandatory_args[i].Key.multiple != "true") 
            
            #line default
            #line hidden
            
            #line 81 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("            ");
            
            #line 82 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_arg_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value = amqpvalue_create_");
            
            #line 82 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_args[i].Key.type.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 82 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_args[i].Key.name.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("_value);\r\n");
            
            #line 83 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 84 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 85 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("            ");
            
            #line 86 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_arg_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value = ");
            
            #line 86 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_args[i].Key.name.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("_value;\r\n");
            
            #line 87 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("            if ((result == 0) && (amqpvalue_set_composite_item(");
            
            #line 88 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value, ");
            
            #line 88 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_args[i].Value));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 88 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_arg_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value) != 0))\r\n            {\r\n                result = MU_FAILURE;\r\n       " +
                    "     }\r\n");
            
            #line 92 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 94 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  for (int i = 0; i < mandatory_args.Count(); i++) 
            
            #line default
            #line hidden
            
            #line 95 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 96 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      string mandatory_arg_name = mandatory_args[i].Key.name.ToLower().Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            this.Write("            amqpvalue_destroy(");
            
            #line 97 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(mandatory_arg_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value);\r\n");
            
            #line 98 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("        }\r\n");
            
            #line 100 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("    }\r\n\r\n    return ");
            
            #line 103 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance;\r\n}\r\n\r\n");
            
            #line 106 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 106 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_clone(");
            
            #line 106 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE value)\r\n{\r\n    ");
            
            #line 108 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 108 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 108 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)malloc(sizeof(");
            
            #line 108 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE));\r\n    if (");
            
            #line 109 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance != NULL)\r\n    {\r\n        ");
            
            #line 111 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value = amqpvalue_clone(((");
            
            #line 111 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)value)->composite_value);\r\n        if (");
            
            #line 112 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value == NULL)\r\n        {\r\n            free(");
            
            #line 114 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance);\r\n            ");
            
            #line 115 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = NULL;\r\n        }\r\n    }\r\n\r\n    return ");
            
            #line 119 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance;\r\n}\r\n\r\nvoid ");
            
            #line 122 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(");
            
            #line 122 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 122 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(")\r\n{\r\n    if (");
            
            #line 124 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(" != NULL)\r\n    {\r\n        ");
            
            #line 126 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 126 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 126 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)");
            
            #line 126 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(";\r\n        amqpvalue_destroy(");
            
            #line 127 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value);\r\n        free(");
            
            #line 128 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance);\r\n    }\r\n}\r\n\r\nAMQP_VALUE amqpvalue_create_");
            
            #line 132 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 132 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 132 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(")\r\n{\r\n    AMQP_VALUE result;\r\n\r\n    if (");
            
            #line 136 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(" == NULL)\r\n    {\r\n        result = NULL;\r\n    }\r\n    else\r\n    {\r\n        ");
            
            #line 142 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 142 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 142 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)");
            
            #line 142 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(";\r\n        result = amqpvalue_clone(");
            
            #line 143 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value);\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nbool is_");
            
            #line 149 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_type_by_descriptor(AMQP_VALUE descriptor)\r\n{\r\n    bool result;\r\n\r\n    uint64_t d" +
                    "escriptor_ulong;\r\n    if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) ==" +
                    " 0) &&\r\n        (descriptor_ulong == ");
            
            #line 155 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Program.GetDescriptorCode(descriptor).ToString()));
            
            #line default
            #line hidden
            this.Write("))\r\n    {\r\n        result = true;\r\n    }\r\n    else\r\n    {\r\n        result = false" +
                    ";\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\n\r\nint amqpvalue_get_");
            
            #line 168 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("(AMQP_VALUE value, ");
            
            #line 168 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE* ");
            
            #line 168 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_handle)\r\n{\r\n    int result;\r\n    ");
            
            #line 171 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 171 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 171 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)");
            
            #line 171 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_create_internal();\r\n    *");
            
            #line 172 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_handle = ");
            
            #line 172 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_instance;\r\n    if (*");
            
            #line 173 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_handle == NULL)\r\n    {\r\n        result = MU_FAILURE;\r\n    }\r\n    else\r\n    {\r\n  " +
                    "      AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value);\r\n   " +
                    "     if (list_value == NULL)\r\n        {\r\n            ");
            
            #line 182 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 182 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write(@"_handle);
            result = MU_FAILURE;
        }
        else
        {
            uint32_t list_item_count;
            if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0)
            {
                result = MU_FAILURE;
            }
            else
            {
                do
                {
");
            
            #line 196 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              int k = 0; 
            
            #line default
            #line hidden
            
            #line 197 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              bool first_one = true; 
            
            #line default
            #line hidden
            
            #line 198 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              foreach (field field in type.Items.Where(item => item is field)) 
            
            #line default
            #line hidden
            
            #line 199 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 200 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string field_name = field.name.ToLower().Replace('-', '_'); 
            
            #line default
            #line hidden
            
            #line 201 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string c_type = Program.GetCType(field.type, false).Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 202 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  type field_type = Program.GetTypeByName(field.type); 
            
            #line default
            #line hidden
            
            #line 203 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if ((field_type != null) && (field_type.@class == typeClass.composite)) c_type = field_type.name.ToUpper().Replace('-', '_').Replace(':', '_') + "_HANDLE"; 
            
            #line default
            #line hidden
            
            #line 204 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if (first_one) 
            
            #line default
            #line hidden
            
            #line 205 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 206 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      first_one = false; 
            
            #line default
            #line hidden
            this.Write("                    AMQP_VALUE item_value;\r\n");
            
            #line 208 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("                    /* ");
            
            #line 209 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.name));
            
            #line default
            #line hidden
            this.Write(" */\r\n                    if (list_item_count > ");
            
            #line 210 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(k));
            
            #line default
            #line hidden
            this.Write(")\r\n                    {\r\n                        item_value = amqpvalue_get_list" +
                    "_item(list_value, ");
            
            #line 212 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(k));
            
            #line default
            #line hidden
            this.Write(");\r\n                        if (item_value == NULL)\r\n                        {\r\n");
            
            #line 215 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     if (field.mandatory == "true") 
            
            #line default
            #line hidden
            
            #line 216 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                            {\r\n                                ");
            
            #line 218 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 218 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_handle);\r\n                                result = MU_FAILURE;\r\n                " +
                    "                break;\r\n                            }\r\n");
            
            #line 222 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            
            #line 223 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     else 
            
            #line default
            #line hidden
            
            #line 224 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                            /* do nothing */\r\n");
            
            #line 226 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            this.Write("                        }\r\n                        else\r\n                        " +
                    "{\r\n");
            
            #line 230 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 if (field.type != "*") 
            
            #line default
            #line hidden
            
            #line 231 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            this.Write("                            if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)" +
                    "\r\n                            {\r\n");
            
            #line 234 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     if (field.mandatory == "true") 
            
            #line default
            #line hidden
            
            #line 235 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                                amqpvalue_destroy(item_value);\r\n                 " +
                    "               ");
            
            #line 237 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 237 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_handle);\r\n                                result = MU_FAILURE;\r\n                " +
                    "                break;\r\n");
            
            #line 240 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            
            #line 241 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     else 
            
            #line default
            #line hidden
            
            #line 242 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                                /* no error, field is not mandatory */\r\n");
            
            #line 244 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            this.Write("                            }\r\n                            else\r\n                " +
                    "            {\r\n");
            
            #line 248 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      if (field.multiple != "true") 
            
            #line default
            #line hidden
            
            #line 249 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            this.Write("                                ");
            
            #line 250 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 250 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(";\r\n                                if (amqpvalue_get_");
            
            #line 251 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.type.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(item_value, &");
            
            #line 251 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(") != 0)\r\n");
            
            #line 252 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            
            #line 253 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      else 
            
            #line default
            #line hidden
            
            #line 254 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            this.Write("                                ");
            
            #line 255 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 255 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(" = NULL;\r\n                                AMQP_VALUE ");
            
            #line 256 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_array;\r\n                                if (((amqpvalue_get_type(item_value) != " +
                    "AMQP_TYPE_ARRAY) || (amqpvalue_get_array(item_value, &");
            
            #line 257 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_array) != 0)) &&\r\n                                    (amqpvalue_get_");
            
            #line 258 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.type.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(item_value, &");
            
            #line 258 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(") != 0))\r\n");
            
            #line 259 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            this.Write("                                {\r\n                                    amqpvalue_" +
                    "destroy(item_value);\r\n                                    ");
            
            #line 262 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 262 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_handle);\r\n                                    result = MU_FAILURE;\r\n            " +
                    "                        break;\r\n                                }\r\n");
            
            #line 266 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      if (c_type == "ERROR_HANDLE") 
            
            #line default
            #line hidden
            
            #line 267 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            this.Write("                                else\r\n                                {\r\n        " +
                    "                            error_destroy(");
            
            #line 270 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name.ToLower()));
            
            #line default
            #line hidden
            this.Write(");\r\n                                }\r\n");
            
            #line 272 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            this.Write("                            }\r\n\r\n");
            
            #line 275 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            
            #line 276 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 else 
            
            #line default
            #line hidden
            
            #line 277 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            
            #line 278 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            this.Write("                            amqpvalue_destroy(item_value);\r\n                     " +
                    "   }\r\n                    }\r\n");
            
            #line 282 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     if (field.mandatory == "true") 
            
            #line default
            #line hidden
            
            #line 283 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                    else\r\n                    {\r\n                        result =" +
                    " MU_FAILURE;\r\n                    }\r\n");
            
            #line 288 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            
            #line 289 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  k++; 
            
            #line default
            #line hidden
            
            #line 290 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("\r\n                    ");
            
            #line 292 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value = amqpvalue_clone(value);\r\n\r\n                    resul" +
                    "t = 0;\r\n                } while(0);\r\n            }\r\n        }\r\n    }\r\n\r\n" +
                    "    return result;\r\n}\r\n\r\n");
            
            #line 303 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              int j = 0; 
            
            #line default
            #line hidden
            
            #line 304 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              foreach (field field in type.Items.Where(item => item is field)) 
            
            #line default
            #line hidden
            
            #line 305 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 306 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string field_name = field.name.ToLower().Replace('-', '_'); 
            
            #line default
            #line hidden
            
            #line 307 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string c_type = Program.GetCType(field.type, field.multiple == "true").Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 308 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string single_value_c_type = Program.GetCType(field.type, false).Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 309 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  type field_type = Program.GetTypeByName(field.type); 
            
            #line default
            #line hidden
            
            #line 310 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if ((field_type != null) && (field_type.@class == typeClass.composite)) c_type = field_type.name.ToUpper().Replace('-', '_').Replace(':', '_') + "_HANDLE"; 
            
            #line default
            #line hidden
            this.Write("int ");
            
            #line 311 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_get_");
            
            #line 311 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 311 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 311 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 311 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write("* ");
            
            #line 311 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value)\r\n{\r\n    int result;\r\n\r\n    if (");
            
            #line 315 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(" == NULL)\r\n    {\r\n        result = MU_FAILURE;\r\n    }\r\n    else\r\n    {\r\n        u" +
                    "int32_t item_count;\r\n        ");
            
            #line 322 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 322 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 322 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)");
            
            #line 322 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(";\r\n        if (amqpvalue_get_composite_item_count(");
            
            #line 323 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value, &item_count) != 0)\r\n        {\r\n            result = M" +
                    "U_FAILURE;\r\n        }\r\n        else\r\n        {\r\n            if (item_count <= ");
            
            #line 329 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(j));
            
            #line default
            #line hidden
            this.Write(")\r\n            {\r\n");
            
            #line 331 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.@default != null) 
            
            #line default
            #line hidden
            
            #line 332 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            
            #line 333 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if ((field_type != null) && (field_type.@class == typeClass.restricted) && (field_type.Items != null)) 
            
            #line default
            #line hidden
            
            #line 334 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                *");
            
            #line 335 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 335 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_type.@name.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("_");
            
            #line 335 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.@default.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 336 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 337 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 338 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                *");
            
            #line 339 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 339 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.@default));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 340 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                result = 0;\r\n");
            
            #line 342 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 343 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 344 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                result = MU_FAILURE;\r\n");
            
            #line 346 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("            }\r\n            else\r\n            {\r\n                AMQP_VALUE item_v" +
                    "alue = amqpvalue_get_composite_item_in_place(");
            
            #line 350 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value, ");
            
            #line 350 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(j));
            
            #line default
            #line hidden
            this.Write(");\r\n                if ((item_value == NULL) ||\r\n                    (amqpvalue_g" +
                    "et_type(item_value) == AMQP_TYPE_NULL))\r\n                {\r\n");
            
            #line 354 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.@default != null) 
            
            #line default
            #line hidden
            
            #line 355 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            
            #line 356 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if ((field_type != null) && (field_type.@class == typeClass.restricted) && (field_type.Items != null)) 
            
            #line default
            #line hidden
            
            #line 357 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    *");
            
            #line 358 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 358 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_type.@name.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("_");
            
            #line 358 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.@default.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 359 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 360 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 361 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    *");
            
            #line 362 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 362 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.@default));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 363 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                    result = 0;\r\n");
            
            #line 365 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 366 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 367 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                    result = MU_FAILURE;\r\n");
            
            #line 369 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("                }\r\n                else\r\n                {\r\n");
            
            #line 373 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.multiple == "true") 
            
            #line default
            #line hidden
            
            #line 374 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                    ");
            
            #line 375 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(single_value_c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 375 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_single_value;\r\n");
            
            #line 376 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 377 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.type.Replace('-', '_').Replace(':', '_') == "*") 
            
            #line default
            #line hidden
            
            #line 378 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                    *");
            
            #line 379 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = item_value;\r\n                    result = 0;\r\n");
            
            #line 381 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 382 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 383 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            
            #line 384 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if (field.multiple != "true") 
            
            #line default
            #line hidden
            
            #line 385 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    int get_single_value_result = amqpvalue_get_");
            
            #line 386 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.type.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(item_value, ");
            
            #line 386 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value);\r\n                    if (get_single_value_result != 0)\r\n");
            
            #line 388 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 389 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 390 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    int get_single_value_result;\r\n                    if (amqpval" +
                    "ue_get_type(item_value) != AMQP_TYPE_ARRAY)\r\n                    {\r\n            " +
                    "            get_single_value_result = amqpvalue_get_");
            
            #line 394 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.type.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(item_value, &");
            
            #line 394 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_single_value);\r\n                    }\r\n                    else\r\n               " +
                    "     {\r\n                        (void)memset((void*)&");
            
            #line 398 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_single_value, 0, sizeof(");
            
            #line 398 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_single_value));\r\n                        get_single_value_result = 1;\r\n         " +
                    "           }\r\n\r\n                    if (((amqpvalue_get_type(item_value) != AMQP" +
                    "_TYPE_ARRAY) || (amqpvalue_get_array(item_value, ");
            
            #line 402 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value) != 0)) &&\r\n                        (get_single_value_result != 0))\r\n");
            
            #line 404 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                    {\r\n");
            
            #line 406 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.@default != null) 
            
            #line default
            #line hidden
            
            #line 407 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                        if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL)\r\n  " +
                    "                      {\r\n                            result = MU_FAILURE;\r\n     " +
                    "                   }\r\n                        else\r\n                        {\r\n");
            
            #line 414 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if ((field_type != null) && (field_type.@class == typeClass.restricted) && (field_type.Items != null)) 
            
            #line default
            #line hidden
            
            #line 415 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                            *");
            
            #line 416 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 416 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_type.@name.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("_");
            
            #line 416 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.@default.Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 417 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 418 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 419 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                            *");
            
            #line 420 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 420 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.@default));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 421 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                            result = 0;\r\n                        }\r\n");
            
            #line 424 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 425 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 426 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                        result = MU_FAILURE;\r\n");
            
            #line 428 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("                    }\r\n                    else\r\n                    {\r\n");
            
            #line 432 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if (field.multiple == "true") 
            
            #line default
            #line hidden
            
            #line 433 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                        if (amqpvalue_get_type(item_value) != AMQP_TYPE_ARRAY)\r\n " +
                    "                       {\r\n                            *");
            
            #line 436 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = amqpvalue_create_array();\r\n                            if (*");
            
            #line 437 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(@"_value == NULL)
                            {
                                result = MU_FAILURE;
                            }
                            else
                            {
                                AMQP_VALUE single_amqp_value = amqpvalue_create_");
            
            #line 443 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.type.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 443 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_single_value);\r\n                                if (single_amqp_value == NULL)\r\n" +
                    "                                {\r\n                                    amqpvalue" +
                    "_destroy(*");
            
            #line 446 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value);\r\n                                    result = MU_FAILURE;\r\n             " +
                    "                   }\r\n                                else\r\n                    " +
                    "            {\r\n                                    if (amqpvalue_add_array_item(" +
                    "*");
            
            #line 451 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value, single_amqp_value) != 0)\r\n                                    {\r\n        " +
                    "                                amqpvalue_destroy(*");
            
            #line 453 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(@"_value);
                                        amqpvalue_destroy(single_amqp_value);
                                        result = MU_FAILURE;
                                    }
                                    else
                                    {
                                        if (amqpvalue_set_composite_item(");
            
            #line 459 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value, ");
            
            #line 459 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(j));
            
            #line default
            #line hidden
            this.Write(", *");
            
            #line 459 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value) != 0)\r\n                                        {\r\n                       " +
                    "                     amqpvalue_destroy(*");
            
            #line 461 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(@"_value);
                                            result = MU_FAILURE;
                                        }
                                        else
                                        {
                                            result = 0;
                                        }
                                    }

                                    amqpvalue_destroy(single_amqp_value);
                                }
                                amqpvalue_destroy(*");
            
            #line 472 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value);\r\n                            }\r\n                        }\r\n             " +
                    "           else\r\n                        {\r\n                            result =" +
                    " 0;\r\n                        }\r\n");
            
            #line 479 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 480 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 481 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                        result = 0;\r\n");
            
            #line 483 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                    }\r\n");
            
            #line 485 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("                }\r\n            }\r\n        }\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nin" +
                    "t ");
            
            #line 494 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_set_");
            
            #line 494 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 494 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_HANDLE ");
            
            #line 494 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 494 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 494 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value)\r\n{\r\n    int result;\r\n\r\n    if (");
            
            #line 498 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(" == NULL)\r\n    {\r\n        result = MU_FAILURE;\r\n    }\r\n    else\r\n    {\r\n        ");
            
            #line 504 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE* ");
            
            #line 504 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 504 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToUpper()));
            
            #line default
            #line hidden
            this.Write("_INSTANCE*)");
            
            #line 504 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(";\r\n");
            
            #line 505 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 if (c_type != "AMQP_VALUE") 
            
            #line default
            #line hidden
            
            #line 506 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            this.Write("        AMQP_VALUE ");
            
            #line 507 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value = amqpvalue_create_");
            
            #line 507 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field.type.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 507 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value);\r\n");
            
            #line 508 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            
            #line 509 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 else 
            
            #line default
            #line hidden
            
            #line 510 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            this.Write("        AMQP_VALUE ");
            
            #line 511 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value;\r\n        if (");
            
            #line 512 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value == NULL)\r\n        {\r\n            ");
            
            #line 514 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value = NULL;\r\n        }\r\n        else\r\n        {\r\n            ");
            
            #line 518 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value = amqpvalue_clone(");
            
            #line 518 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value);\r\n        }\r\n");
            
            #line 520 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            this.Write("        if (");
            
            #line 521 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value == NULL)\r\n        {\r\n            result = MU_FAILURE;\r\n        }\r\n   " +
                    "     else\r\n        {\r\n            if (amqpvalue_set_composite_item(");
            
            #line 527 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance->composite_value, ");
            
            #line 527 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(j));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 527 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value) != 0)\r\n            {\r\n                result = MU_FAILURE;\r\n        " +
                    "    }\r\n            else\r\n            {\r\n                result = 0;\r\n           " +
                    " }\r\n\r\n            amqpvalue_destroy(");
            
            #line 536 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_amqp_value);\r\n        }\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\n");
            
            #line 543 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  j++; 
            
            #line default
            #line hidden
            
            #line 544 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 546 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          } 
            
            #line default
            #line hidden
            
            #line 547 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          else if (type.@class == typeClass.restricted) 
            
            #line default
            #line hidden
            
            #line 548 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          { 
            
            #line default
            #line hidden
            
            #line 549 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              string c_type = Program.GetCType(type.source, false).Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 550 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              bool hasDescriptor = (type.Items != null) && (type.Items.Where(item => item is descriptor).Count() > 0); 
            
            #line default
            #line hidden
            this.Write("/* ");
            
            #line 551 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.name));
            
            #line default
            #line hidden
            this.Write(" */\r\n\r\n");
            
            #line 553 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              if (c_type != "AMQP_VALUE") 
            
            #line default
            #line hidden
            
            #line 554 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 555 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if (!hasDescriptor) 
            
            #line default
            #line hidden
            
            #line 556 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 557 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 557 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write(" value)\r\n{\r\n    return amqpvalue_create_");
            
            #line 559 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.source.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(value);\r\n}\r\n");
            
            #line 561 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 562 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  else 
            
            #line default
            #line hidden
            
            #line 563 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 564 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 564 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write(" value)\r\n{\r\n    AMQP_VALUE result;\r\n    AMQP_VALUE described_value = amqpvalue_cr" +
                    "eate_");
            
            #line 567 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.source.ToLower().Replace('-', '_').Replace(':', '_')));
            
            #line default
            #line hidden
            this.Write("(value);\r\n    if (described_value == NULL)\r\n    {\r\n        result = NULL;\r\n    }\r" +
                    "\n    else\r\n    {\r\n        AMQP_VALUE descriptor = amqpvalue_create_ulong(");
            
            #line 574 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Program.GetDescriptorCode(Program.GetDescriptor(type))));
            
            #line default
            #line hidden
            this.Write(@");
        if (descriptor == NULL)
        {
            result = NULL;
        }
        else
        {
            result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value));

            amqpvalue_destroy(descriptor);
        }

        amqpvalue_destroy(described_value);
    }

    return result;
}

bool is_");
            
            #line 592 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_type_by_descriptor(AMQP_VALUE descriptor)\r\n{\r\n    bool result;\r\n\r\n    uint64_t d" +
                    "escriptor_ulong;\r\n    if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) ==" +
                    " 0) &&\r\n        (descriptor_ulong == ");
            
            #line 598 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Program.GetDescriptorCode(Program.GetDescriptor(type)).ToString()));
            
            #line default
            #line hidden
            this.Write("))\r\n    {\r\n        result = true;\r\n    }\r\n    else\r\n    {\r\n        result = false" +
                    ";\r\n    }\r\n\r\n    return result;\r\n}\r\n");
            
            #line 609 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 610 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            
            #line 611 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              else 
            
            #line default
            #line hidden
            
            #line 612 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 613 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if (!hasDescriptor) 
            
            #line default
            #line hidden
            
            #line 614 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 615 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("(AMQP_VALUE value)\r\n{\r\n    return amqpvalue_clone(value);\r\n}\r\n");
            
            #line 619 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 620 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  else 
            
            #line default
            #line hidden
            
            #line 621 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 622 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("(AMQP_VALUE value)\r\n{\r\n    AMQP_VALUE result;\r\n    AMQP_VALUE described_value = a" +
                    "mqpvalue_clone(value);\r\n    if (described_value == NULL)\r\n    {\r\n        result " +
                    "= NULL;\r\n    }\r\n    else\r\n    {\r\n        AMQP_VALUE descriptor = amqpvalue_creat" +
                    "e_ulong(");
            
            #line 632 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Program.GetDescriptorCode(Program.GetDescriptor(type))));
            
            #line default
            #line hidden
            this.Write(@");
        if (descriptor == NULL)
        {
            result = NULL;
        }
        else
        {
            result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value));

            amqpvalue_destroy(descriptor);
        }

        amqpvalue_destroy(described_value);
    }

    return result;
}

bool is_");
            
            #line 650 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("_type_by_descriptor(AMQP_VALUE descriptor)\r\n{\r\n    bool result;\r\n\r\n    uint64_t d" +
                    "escriptor_ulong;\r\n    if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) ==" +
                    " 0) &&\r\n        (descriptor_ulong == ");
            
            #line 656 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Program.GetDescriptorCode(Program.GetDescriptor(type)).ToString()));
            
            #line default
            #line hidden
            this.Write("))\r\n    {\r\n        result = true;\r\n    }\r\n    else\r\n    {\r\n        result = false" +
                    ";\r\n    }\r\n\r\n    return result;\r\n}\r\n");
            
            #line 667 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 668 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 670 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          } 
            
            #line default
            #line hidden
            
            #line 671 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            
            #line 672 "g:\repos\azure-event-hubs-c\deps\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
  } 
            
            #line default
            #line hidden
            return this.GenerationEnvironment.ToString();
        }
    }
    
    #line default
    #line hidden
    #region Base class
    /// <summary>
    /// Base class for this transformation
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")]
    public class amqp_definitions_cBase
    {
        #region Fields
        private global::System.Text.StringBuilder generationEnvironmentField;
        private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField;
        private global::System.Collections.Generic.List<int> indentLengthsField;
        private string currentIndentField = "";
        private bool endsWithNewline;
        private global::System.Collections.Generic.IDictionary<string, object> sessionField;
        #endregion
        #region Properties
        /// <summary>
        /// The string builder that generation-time code is using to assemble generated output
        /// </summary>
        protected System.Text.StringBuilder GenerationEnvironment
        {
            get
            {
                if ((this.generationEnvironmentField == null))
                {
                    this.generationEnvironmentField = new global::System.Text.StringBuilder();
                }
                return this.generationEnvironmentField;
            }
            set
            {
                this.generationEnvironmentField = value;
            }
        }
        /// <summary>
        /// The error collection for the generation process
        /// </summary>
        public System.CodeDom.Compiler.CompilerErrorCollection Errors
        {
            get
            {
                if ((this.errorsField == null))
                {
                    this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection();
                }
                return this.errorsField;
            }
        }
        /// <summary>
        /// A list of the lengths of each indent that was added with PushIndent
        /// </summary>
        private System.Collections.Generic.List<int> indentLengths
        {
            get
            {
                if ((this.indentLengthsField == null))
                {
                    this.indentLengthsField = new global::System.Collections.Generic.List<int>();
                }
                return this.indentLengthsField;
            }
        }
        /// <summary>
        /// Gets the current indent we use when adding lines to the output
        /// </summary>
        public string CurrentIndent
        {
            get
            {
                return this.currentIndentField;
            }
        }
        /// <summary>
        /// Current transformation session
        /// </summary>
        public virtual global::System.Collections.Generic.IDictionary<string, object> Session
        {
            get
            {
                return this.sessionField;
            }
            set
            {
                this.sessionField = value;
            }
        }
        #endregion
        #region Transform-time helpers
        /// <summary>
        /// Write text directly into the generated output
        /// </summary>
        public void Write(string textToAppend)
        {
            if (string.IsNullOrEmpty(textToAppend))
            {
                return;
            }
            // If we're starting off, or if the previous text ended with a newline,
            // we have to append the current indent first.
            if (((this.GenerationEnvironment.Length == 0) 
                        || this.endsWithNewline))
            {
                this.GenerationEnvironment.Append(this.currentIndentField);
                this.endsWithNewline = false;
            }
            // Check if the current text ends with a newline
            if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture))
            {
                this.endsWithNewline = true;
            }
            // This is an optimization. If the current indent is "", then we don't have to do any
            // of the more complex stuff further down.
            if ((this.currentIndentField.Length == 0))
            {
                this.GenerationEnvironment.Append(textToAppend);
                return;
            }
            // Everywhere there is a newline in the text, add an indent after it
            textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField));
            // If the text ends with a newline, then we should strip off the indent added at the very end
            // because the appropriate indent will be added when the next time Write() is called
            if (this.endsWithNewline)
            {
                this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length));
            }
            else
            {
                this.GenerationEnvironment.Append(textToAppend);
            }
        }
        /// <summary>
        /// Write text directly into the generated output
        /// </summary>
        public void WriteLine(string textToAppend)
        {
            this.Write(textToAppend);
            this.GenerationEnvironment.AppendLine();
            this.endsWithNewline = true;
        }
        /// <summary>
        /// Write formatted text directly into the generated output
        /// </summary>
        public void Write(string format, params object[] args)
        {
            this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
        }
        /// <summary>
        /// Write formatted text directly into the generated output
        /// </summary>
        public void WriteLine(string format, params object[] args)
        {
            this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
        }
        /// <summary>
        /// Raise an error
        /// </summary>
        public void Error(string message)
        {
            System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
            error.ErrorText = message;
            this.Errors.Add(error);
        }
        /// <summary>
        /// Raise a warning
        /// </summary>
        public void Warning(string message)
        {
            System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
            error.ErrorText = message;
            error.IsWarning = true;
            this.Errors.Add(error);
        }
        /// <summary>
        /// Increase the indent
        /// </summary>
        public void PushIndent(string indent)
        {
            if ((indent == null))
            {
                throw new global::System.ArgumentNullException("indent");
            }
            this.currentIndentField = (this.currentIndentField + indent);
            this.indentLengths.Add(indent.Length);
        }
        /// <summary>
        /// Remove the last indent that was added with PushIndent
        /// </summary>
        public string PopIndent()
        {
            string returnValue = "";
            if ((this.indentLengths.Count > 0))
            {
                int indentLength = this.indentLengths[(this.indentLengths.Count - 1)];
                this.indentLengths.RemoveAt((this.indentLengths.Count - 1));
                if ((indentLength > 0))
                {
                    returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength));
                    this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
                }
            }
            return returnValue;
        }
        /// <summary>
        /// Remove any indentation
        /// </summary>
        public void ClearIndent()
        {
            this.indentLengths.Clear();
            this.currentIndentField = "";
        }
        #endregion
        #region ToString Helpers
        /// <summary>
        /// Utility class to produce culture-oriented representation of an object as a string.
        /// </summary>
        public class ToStringInstanceHelper
        {
            private System.IFormatProvider formatProviderField  = global::System.Globalization.CultureInfo.InvariantCulture;
            /// <summary>
            /// Gets or sets format provider to be used by ToStringWithCulture method.
            /// </summary>
            public System.IFormatProvider FormatProvider
            {
                get
                {
                    return this.formatProviderField ;
                }
                set
                {
                    if ((value != null))
                    {
                        this.formatProviderField  = value;
                    }
                }
            }
            /// <summary>
            /// This is called from the compile/run appdomain to convert objects within an expression block to a string
            /// </summary>
            public string ToStringWithCulture(object objectToConvert)
            {
                if ((objectToConvert == null))
                {
                    throw new global::System.ArgumentNullException("objectToConvert");
                }
                System.Type t = objectToConvert.GetType();
                System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] {
                            typeof(System.IFormatProvider)});
                if ((method == null))
                {
                    return objectToConvert.ToString();
                }
                else
                {
                    return ((string)(method.Invoke(objectToConvert, new object[] {
                                this.formatProviderField })));
                }
            }
        }
        private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper();
        /// <summary>
        /// Helper to produce culture-oriented representation of an object as a string
        /// </summary>
        public ToStringInstanceHelper ToStringHelper
        {
            get
            {
                return this.toStringHelperField;
            }
        }
        #endregion
    }
    #endregion
}
