2 using System.Runtime.InteropServices;
3 using System.Reflection.Emit;
7 namespace DBus.DBusType
10 /// 64-bit unsigned integer.
12 public class UInt64 : IDBusType
14 public const char Code = 't';
15 private System.UInt64 val;
21 public UInt64(System.UInt64 val, Service service)
26 public UInt64(IntPtr iter, Service service)
28 this.val = dbus_message_iter_get_uint64(iter);
31 public void Append(IntPtr iter)
33 if (!dbus_message_iter_append_uint64(iter, val))
34 throw new ApplicationException("Failed to append UINT64 argument:" + val);
37 public static bool Suits(System.Type type)
39 switch (type.ToString()) {
41 case "System.UInt64&":
48 public static void EmitMarshalIn(ILGenerator generator, Type type)
51 generator.Emit(OpCodes.Ldind_I8);
55 public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
57 generator.Emit(OpCodes.Unbox, type);
58 generator.Emit(OpCodes.Ldind_I8);
60 generator.Emit(OpCodes.Stind_I8);
69 public object Get(System.Type type)
71 switch (type.ToString())
74 case "System.UInt64&":
77 throw new ArgumentException("Cannot cast DBus.Type.UInt64 to type '" + type.ToString() + "'");
82 private extern static System.UInt64 dbus_message_iter_get_uint64(IntPtr iter);
85 private extern static bool dbus_message_iter_append_uint64(IntPtr iter, System.UInt64 value);