// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version: 17.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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
  { 
            
            #line default
            #line hidden
            
            #line 26 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      List<type> types = new List<type>(); 
            
            #line default
            #line hidden
            
            #line 27 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      foreach (type type in types) 
            
            #line default
            #line hidden
            
            #line 29 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            
            #line 30 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          string type_name = type.name.ToLower().Replace('-', '_'); 
            
            #line default
            #line hidden
            
            #line 31 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          if (type.@class == typeClass.composite) 
            
            #line default
            #line hidden
            
            #line 32 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          { 
            
            #line default
            #line hidden
            
            #line 33 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              string arg_list = Program.GetMandatoryArgList(type); 
            
            #line default
            #line hidden
            
            #line 42 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              if (mandatory_args.Count() > 0) 
            
            #line default
            #line hidden
            
            #line 66 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            this.Write("        else\r\n        {\r\n");
            
            #line 69 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  for (int i = 0; i < mandatory_args.Count(); i++) 
            
            #line default
            #line hidden
            
            #line 70 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 71 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("            int result = 0;\r\n\r\n");
            
            #line 76 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  for (int i = 0; i < mandatory_args.Count(); i++) 
            
            #line default
            #line hidden
            
            #line 77 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 78 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (mandatory_args[i].Key.multiple != "true") 
            
            #line default
            #line hidden
            
            #line 81 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("            ");
            
            #line 82 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 84 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 85 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("            ");
            
            #line 86 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("            if ((result == 0) && (amqpvalue_set_composite_item(");
            
            #line 88 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 94 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  for (int i = 0; i < mandatory_args.Count(); i++) 
            
            #line default
            #line hidden
            
            #line 95 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 96 "C:\code\s1\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 "C:\code\s1\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 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("            if (result != 0)\r\n            {\r\n                ");
            
            #line 101 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(");
            
            #line 101 "C:\code\s1\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 102 "C:\code\s1\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");
            
            #line 105 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("    }\r\n\r\n    return ");
            
            #line 108 "C:\code\s1\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 111 "C:\code\s1\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 111 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_clone(");
            
            #line 111 "C:\code\s1\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 113 "C:\code\s1\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 113 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 113 "C:\code\s1\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 113 "C:\code\s1\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 114 "C:\code\s1\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 116 "C:\code\s1\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 116 "C:\code\s1\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 117 "C:\code\s1\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 119 "C:\code\s1\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 120 "C:\code\s1\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 124 "C:\code\s1\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 127 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(");
            
            #line 127 "C:\code\s1\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 127 "C:\code\s1\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 129 "C:\code\s1\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 131 "C:\code\s1\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 131 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 131 "C:\code\s1\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 131 "C:\code\s1\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 132 "C:\code\s1\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 133 "C:\code\s1\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 137 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 137 "C:\code\s1\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 137 "C:\code\s1\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 141 "C:\code\s1\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 147 "C:\code\s1\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 147 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 147 "C:\code\s1\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 147 "C:\code\s1\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 148 "C:\code\s1\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 154 "C:\code\s1\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 160 "C:\code\s1\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 173 "C:\code\s1\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 173 "C:\code\s1\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 173 "C:\code\s1\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 176 "C:\code\s1\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 176 "C:\code\s1\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 176 "C:\code\s1\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 176 "C:\code\s1\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 177 "C:\code\s1\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 177 "C:\code\s1\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 178 "C:\code\s1\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 187 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 187 "C:\code\s1\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 201 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              int k = 0; 
            
            #line default
            #line hidden
            
            #line 202 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              bool first_one = true; 
            
            #line default
            #line hidden
            
            #line 203 "C:\code\s1\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 204 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 205 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string field_name = field.name.ToLower().Replace('-', '_'); 
            
            #line default
            #line hidden
            
            #line 206 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string c_type = Program.GetCType(field.type, false).Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 207 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  type field_type = Program.GetTypeByName(field.type); 
            
            #line default
            #line hidden
            
            #line 208 "C:\code\s1\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 209 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if (first_one) 
            
            #line default
            #line hidden
            
            #line 210 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            
            #line 211 "C:\code\s1\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 213 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            this.Write("                    /* ");
            
            #line 214 "C:\code\s1\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 215 "C:\code\s1\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 217 "C:\code\s1\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 220 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     if (field.mandatory == "true") 
            
            #line default
            #line hidden
            
            #line 221 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                            {\r\n                                ");
            
            #line 223 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 223 "C:\code\s1\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 227 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            
            #line 228 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     else 
            
            #line default
            #line hidden
            
            #line 229 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                            /* do nothing */\r\n");
            
            #line 231 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            this.Write("                        }\r\n                        else\r\n                        " +
                    "{\r\n");
            
            #line 235 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 if (field.type != "*") 
            
            #line default
            #line hidden
            
            #line 236 "C:\code\s1\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 239 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     if (field.mandatory == "true") 
            
            #line default
            #line hidden
            
            #line 240 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                                amqpvalue_destroy(item_value);\r\n                 " +
                    "               ");
            
            #line 242 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 242 "C:\code\s1\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 245 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            
            #line 246 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     else 
            
            #line default
            #line hidden
            
            #line 247 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     { 
            
            #line default
            #line hidden
            this.Write("                                /* no error, field is not mandatory */\r\n");
            
            #line 249 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            this.Write("                            }\r\n                            else\r\n                " +
                    "            {\r\n");
            
            #line 253 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      if (field.multiple != "true") 
            
            #line default
            #line hidden
            
            #line 254 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            this.Write("                                ");
            
            #line 255 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 255 "C:\code\s1\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 256 "C:\code\s1\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 256 "C:\code\s1\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 257 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            
            #line 258 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      else 
            
            #line default
            #line hidden
            
            #line 259 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            this.Write("                                ");
            
            #line 260 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 260 "C:\code\s1\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 261 "C:\code\s1\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 262 "C:\code\s1\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 263 "C:\code\s1\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 263 "C:\code\s1\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 264 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            this.Write("                                {\r\n                                    amqpvalue_" +
                    "destroy(item_value);\r\n                                    ");
            
            #line 267 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_destroy(*");
            
            #line 267 "C:\code\s1\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 271 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      if (c_type == "ERROR_HANDLE") 
            
            #line default
            #line hidden
            
            #line 272 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      { 
            
            #line default
            #line hidden
            this.Write("                                else\r\n                                {\r\n        " +
                    "                            error_destroy(");
            
            #line 275 "C:\code\s1\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 277 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            this.Write("                            }\r\n\r\n");
            
            #line 280 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            
            #line 281 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 else 
            
            #line default
            #line hidden
            
            #line 282 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            
            #line 283 "C:\code\s1\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 287 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     if (field.mandatory == "true") 
            
            #line default
            #line hidden
            
            #line 288 "C:\code\s1\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                        break;\r\n                    }\r\n");
            
            #line 294 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                     } 
            
            #line default
            #line hidden
            
            #line 295 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  k++; 
            
            #line default
            #line hidden
            
            #line 296 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("\r\n                    ");
            
            #line 298 "C:\code\s1\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    retu" +
                    "rn result;\r\n}\r\n\r\n");
            
            #line 309 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              int j = 0; 
            
            #line default
            #line hidden
            
            #line 310 "C:\code\s1\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 311 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 312 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  string field_name = field.name.ToLower().Replace('-', '_'); 
            
            #line default
            #line hidden
            
            #line 313 "C:\code\s1\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 314 "C:\code\s1\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 315 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  type field_type = Program.GetTypeByName(field.type); 
            
            #line default
            #line hidden
            
            #line 316 "C:\code\s1\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 317 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_get_");
            
            #line 317 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 317 "C:\code\s1\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 317 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 317 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write("* ");
            
            #line 317 "C:\code\s1\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 321 "C:\code\s1\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 328 "C:\code\s1\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 328 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 328 "C:\code\s1\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 328 "C:\code\s1\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 329 "C:\code\s1\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 335 "C:\code\s1\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 337 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.@default != null) 
            
            #line default
            #line hidden
            
            #line 338 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            
            #line 339 "C:\code\s1\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 340 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                *");
            
            #line 341 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 341 "C:\code\s1\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 341 "C:\code\s1\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 342 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 343 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 344 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                *");
            
            #line 345 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 345 "C:\code\s1\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 346 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                result = 0;\r\n");
            
            #line 348 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 349 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 350 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                result = MU_FAILURE;\r\n");
            
            #line 352 "C:\code\s1\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 356 "C:\code\s1\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 356 "C:\code\s1\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 360 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.@default != null) 
            
            #line default
            #line hidden
            
            #line 361 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            
            #line 362 "C:\code\s1\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 363 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    *");
            
            #line 364 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 364 "C:\code\s1\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 364 "C:\code\s1\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 365 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 366 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 367 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    *");
            
            #line 368 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 368 "C:\code\s1\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 369 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                    result = 0;\r\n");
            
            #line 371 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 372 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 373 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                    result = MU_FAILURE;\r\n");
            
            #line 375 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("                }\r\n                else\r\n                {\r\n");
            
            #line 379 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.multiple == "true") 
            
            #line default
            #line hidden
            
            #line 380 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                    ");
            
            #line 381 "C:\code\s1\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 381 "C:\code\s1\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 382 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 383 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.type.Replace('-', '_').Replace(':', '_') == "*") 
            
            #line default
            #line hidden
            
            #line 384 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                    *");
            
            #line 385 "C:\code\s1\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 387 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 388 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 389 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            
            #line 390 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if (field.multiple != "true") 
            
            #line default
            #line hidden
            
            #line 391 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                    int get_single_value_result = amqpvalue_get_");
            
            #line 392 "C:\code\s1\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 392 "C:\code\s1\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 394 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 395 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 396 "C:\code\s1\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 400 "C:\code\s1\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 400 "C:\code\s1\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 404 "C:\code\s1\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 404 "C:\code\s1\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 408 "C:\code\s1\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 410 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                    {\r\n");
            
            #line 412 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      if (field.@default != null) 
            
            #line default
            #line hidden
            
            #line 413 "C:\code\s1\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 420 "C:\code\s1\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 421 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                            *");
            
            #line 422 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 422 "C:\code\s1\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 422 "C:\code\s1\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 423 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 424 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 425 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                            *");
            
            #line 426 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("_value = ");
            
            #line 426 "C:\code\s1\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 427 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                            result = 0;\r\n                        }\r\n");
            
            #line 430 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            
            #line 431 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      else 
            
            #line default
            #line hidden
            
            #line 432 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      { 
            
            #line default
            #line hidden
            this.Write("                        result = MU_FAILURE;\r\n");
            
            #line 434 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                      } 
            
            #line default
            #line hidden
            this.Write("                    }\r\n                    else\r\n                    {\r\n");
            
            #line 438 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          if (field.multiple == "true") 
            
            #line default
            #line hidden
            
            #line 439 "C:\code\s1\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 442 "C:\code\s1\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 443 "C:\code\s1\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 449 "C:\code\s1\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 449 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(@"_single_value);
                                if (single_amqp_value == NULL)
                                {
                                    result = MU_FAILURE;
                                }
                                else
                                {
                                    if (amqpvalue_add_array_item(*");
            
            #line 456 "C:\code\s1\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)
                                    {
                                        result = MU_FAILURE;
                                    }
                                    else
                                    {
                                        if (amqpvalue_set_composite_item(");
            
            #line 462 "C:\code\s1\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 462 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(j));
            
            #line default
            #line hidden
            this.Write(", *");
            
            #line 462 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write(@"_value) != 0)
                                        {
                                            result = MU_FAILURE;
                                        }
                                        else
                                        {
                                            result = 0;
                                        }
                                    }

                                    amqpvalue_destroy(single_amqp_value);
                                }
                                amqpvalue_destroy(*");
            
            #line 474 "C:\code\s1\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 481 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            
            #line 482 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          else 
            
            #line default
            #line hidden
            
            #line 483 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          { 
            
            #line default
            #line hidden
            this.Write("                        result = 0;\r\n");
            
            #line 485 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                          } 
            
            #line default
            #line hidden
            this.Write("                    }\r\n");
            
            #line 487 "C:\code\s1\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 496 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_set_");
            
            #line 496 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(field_name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 496 "C:\code\s1\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 496 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 496 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(c_type));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 496 "C:\code\s1\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 500 "C:\code\s1\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 506 "C:\code\s1\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 506 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name));
            
            #line default
            #line hidden
            this.Write("_instance = (");
            
            #line 506 "C:\code\s1\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 506 "C:\code\s1\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 507 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 if (c_type != "AMQP_VALUE") 
            
            #line default
            #line hidden
            
            #line 508 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            this.Write("        AMQP_VALUE ");
            
            #line 509 "C:\code\s1\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 509 "C:\code\s1\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 509 "C:\code\s1\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 510 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            
            #line 511 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 else 
            
            #line default
            #line hidden
            
            #line 512 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 { 
            
            #line default
            #line hidden
            this.Write("        AMQP_VALUE ");
            
            #line 513 "C:\code\s1\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 514 "C:\code\s1\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 516 "C:\code\s1\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 520 "C:\code\s1\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 520 "C:\code\s1\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 522 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
 } 
            
            #line default
            #line hidden
            this.Write("        if (");
            
            #line 523 "C:\code\s1\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 529 "C:\code\s1\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 529 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(j));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 529 "C:\code\s1\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 538 "C:\code\s1\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 545 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  j++; 
            
            #line default
            #line hidden
            
            #line 546 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 548 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          } 
            
            #line default
            #line hidden
            
            #line 549 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          else if (type.@class == typeClass.restricted) 
            
            #line default
            #line hidden
            
            #line 550 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          { 
            
            #line default
            #line hidden
            
            #line 551 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              string c_type = Program.GetCType(type.source, false).Replace('-', '_').Replace(':', '_'); 
            
            #line default
            #line hidden
            
            #line 552 "C:\code\s1\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 553 "C:\code\s1\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 555 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              if (c_type != "AMQP_VALUE") 
            
            #line default
            #line hidden
            
            #line 556 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 557 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if (!hasDescriptor) 
            
            #line default
            #line hidden
            
            #line 558 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 559 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 559 "C:\code\s1\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 561 "C:\code\s1\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 563 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 564 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  else 
            
            #line default
            #line hidden
            
            #line 565 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 566 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type_name.ToLower()));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 566 "C:\code\s1\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 569 "C:\code\s1\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 576 "C:\code\s1\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 594 "C:\code\s1\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 600 "C:\code\s1\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 611 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 612 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            
            #line 613 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              else 
            
            #line default
            #line hidden
            
            #line 614 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              { 
            
            #line default
            #line hidden
            
            #line 615 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  if (!hasDescriptor) 
            
            #line default
            #line hidden
            
            #line 616 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 617 "C:\code\s1\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 621 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 622 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  else 
            
            #line default
            #line hidden
            
            #line 623 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  { 
            
            #line default
            #line hidden
            this.Write("AMQP_VALUE amqpvalue_create_");
            
            #line 624 "C:\code\s1\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 634 "C:\code\s1\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 652 "C:\code\s1\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 658 "C:\code\s1\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 669 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
                  } 
            
            #line default
            #line hidden
            
            #line 670 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
              } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 672 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
          } 
            
            #line default
            #line hidden
            
            #line 673 "C:\code\s1\azure-uamqp-c\uamqp_generator\amqp_definitions_c.tt"
      } 
            
            #line default
            #line hidden
            
            #line 674 "C:\code\s1\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", "17.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>
        public 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
}
