2
using System.Runtime.InteropServices;
3
using System.Reflection.Emit;
7
namespace DBus.DBusType
12
public class Double : IDBusType
14
public const char Code = 'd';
15
private System.Double val;
21
public Double(System.Double val, Service service)
26
public Double(IntPtr iter, Service service)
28
dbus_message_iter_get_basic (iter, out this.val);
31
public void Append(IntPtr iter)
33
if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
34
throw new ApplicationException("Failed to append DOUBLE argument:" + val);
37
public static bool Suits(System.Type type)
39
switch (type.ToString()) {
41
case "System.Double&":
48
public static void EmitMarshalIn(ILGenerator generator, Type type)
51
generator.Emit(OpCodes.Ldind_R8);
55
public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
57
generator.Emit(OpCodes.Unbox, type);
58
generator.Emit(OpCodes.Ldind_R8);
60
generator.Emit(OpCodes.Stind_R8);
69
public object Get(System.Type type)
71
switch (type.ToString()) {
73
case "System.Double&":
76
throw new ArgumentException("Cannot cast DBus.Type.Double to type '" + type.ToString() + "'");
81
private extern static void dbus_message_iter_get_basic (IntPtr iter, out double value);
84
private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref double value);