protected int write(ref dll.args arg, byte[] src) { if (src.Length > arg.buffsz) { return(dll.OOM); } Marshal.Copy(src, 0, arg.buff, src.Length); return(src.Length); }
protected int read(ref dll.args arg, out int val) { val = 0; if (arg.buffsz < sizeof(int)) { return(dll.ERROR); } val = BitConverter.ToInt32(read(ref arg), 0); return(arg.buffsz); }
protected int read(ref dll.args arg, out bool val) { val = false; if (arg.buffsz < 1) { return(dll.ERROR); } val = BitConverter.ToBoolean(read(ref arg), 0); return(arg.buffsz); }
protected int read(ref dll.args arg, out float val) { val = 0.0f; if (arg.buffsz < sizeof(float)) { return(dll.ERROR); } val = BitConverter.ToSingle(read(ref arg), 0); return(arg.buffsz); }
protected int read(ref dll.args arg, out byte[] val) { val = read(ref arg); return(arg.buffsz); }
private byte[] read(ref dll.args arg) { byte[] ret = new byte[arg.buffsz]; Marshal.Copy(arg.buff, ret, 0, ret.Length); return(ret); }
protected int write(ref dll.args arg, int val) { byte[] src = BitConverter.GetBytes(val); return(write(ref arg, src)); }
private static int decode_cb(ref dll.args arg) { wire obj = uds[arg.ud]; return(obj._decode_field(ref arg)); }
protected abstract int _decode_field(ref dll.args arg);