// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gst.Sdp {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	[StructLayout(LayoutKind.Sequential)]
	public partial struct SDPBandwidth : IEquatable<SDPBandwidth> {

		public string Bwtype;
		public uint Bandwidth;

		public static Gst.Sdp.SDPBandwidth Zero = new Gst.Sdp.SDPBandwidth ();

		public static Gst.Sdp.SDPBandwidth New(IntPtr raw) {
			if (raw == IntPtr.Zero)
				return Gst.Sdp.SDPBandwidth.Zero;
			return (Gst.Sdp.SDPBandwidth) Marshal.PtrToStructure (raw, typeof (Gst.Sdp.SDPBandwidth));
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_sdp_bandwidth_clear(IntPtr raw);

		public Gst.Sdp.SDPResult Clear() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			int raw_ret = gst_sdp_bandwidth_clear(this_as_native);
			Gst.Sdp.SDPResult ret = (Gst.Sdp.SDPResult) raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_sdp_bandwidth_set(IntPtr raw, IntPtr bwtype, uint bandwidth);

		public Gst.Sdp.SDPResult Set(string bwtype, uint bandwidth) {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr native_bwtype = GLib.Marshaller.StringToPtrGStrdup (bwtype);
			int raw_ret = gst_sdp_bandwidth_set(this_as_native, native_bwtype, bandwidth);
			Gst.Sdp.SDPResult ret = (Gst.Sdp.SDPResult) raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			GLib.Marshaller.Free (native_bwtype);
			return ret;
		}

		static void ReadNative (IntPtr native, ref Gst.Sdp.SDPBandwidth target)
		{
			target = New (native);
		}

		public bool Equals (SDPBandwidth other)
		{
			return true && Bwtype.Equals (other.Bwtype) && Bandwidth.Equals (other.Bandwidth);
		}

		public override bool Equals (object other)
		{
			return other is SDPBandwidth && Equals ((SDPBandwidth) other);
		}

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Bwtype.GetHashCode () ^ Bandwidth.GetHashCode ();
		}

		private static GLib.GType GType {
			get { return GLib.GType.Pointer; }
		}
#endregion
	}
}
