public EnumFieldIO(ByteOrder order) { this.op = MemoryOp.getMemoryOp(NativeType.INT, order); }
NumberFieldIO(Type type, ByteOrder order) { this.op = MemoryOp.getMemoryOp(type, order); }
NumberFieldIO(Type type, ByteOrder order) { this.op = MemoryOp.getMemoryOp(type, order); }
public EnumFieldIO(ByteOrder order) { this.op = MemoryOp.getMemoryOp(NativeType.INT, order); }
public static MemoryOp getMemoryOp(NativeType type) { return getMemoryOp(type, ByteOrder.nativeOrder()); }
public static MemoryOp getMemoryOp(NativeType type) { return getMemoryOp(type, ByteOrder.nativeOrder()); }
public static MemoryOp getMemoryOp(Type type) { return getMemoryOp(type, ByteOrder.nativeOrder()); }
public static MemoryOp getMemoryOp(Type type) { return getMemoryOp(type, ByteOrder.nativeOrder()); }
public static MemoryOp getMemoryOp(NativeType type) { return getMemoryOp(type, ByteOrder.nativeOrder()); }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
private static MemoryOp getArrayComponentMemoryOp(Type.Array arrayType) { Type componentType = arrayType.getComponentType(); MemoryOp op = componentType instanceof Type.Array ? new MultiDimensionArrayOp((Type.Array) componentType) : MemoryOp.getMemoryOp(componentType); if (op == null) { throw arrayType.getRuntime().newNotImplementedError("unsupported array field type: " + arrayType.getComponentType()); } return op; }
private static MemoryOp getArrayComponentMemoryOp(Type.Array arrayType) { Type componentType = arrayType.getComponentType(); MemoryOp op = componentType instanceof Type.Array ? new MultiDimensionArrayOp((Type.Array) componentType) : MemoryOp.getMemoryOp(componentType); if (op == null) { throw arrayType.getRuntime().newNotImplementedError("unsupported array field type: " + arrayType.getComponentType()); } return op; }
private static MemoryOp getArrayComponentMemoryOp(Type.Array arrayType) { Type componentType = arrayType.getComponentType(); MemoryOp op = componentType instanceof Type.Array ? new MultiDimensionArrayOp((Type.Array) componentType) : MemoryOp.getMemoryOp(componentType); if (op == null) { throw arrayType.getRuntime().newNotImplementedError("unsupported array field type: " + arrayType.getComponentType()); } return op; }
private static MemoryOp getArrayComponentMemoryOp(Type.Array arrayType) { Type componentType = arrayType.getComponentType(); MemoryOp op = componentType instanceof Type.Array ? new MultiDimensionArrayOp((Type.Array) componentType) : MemoryOp.getMemoryOp(componentType); if (op == null) { throw arrayType.getRuntime().newNotImplementedError("unsupported array field type: " + arrayType.getComponentType()); } return op; }
@JRubyMethod(name = { "read_array_of_type" }, required = 2) public IRubyObject read_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject lenArg) { Type type = context.runtime.getFFI().getTypeResolver().findType(context.runtime, typeArg); MemoryOp op = MemoryOp.getMemoryOp(type); if (op == null) { throw context.runtime.newTypeError("cannot get memory reader for type " + type); } int len = checkArrayLength(lenArg); RubyArray arr = RubyArray.newArray(context.runtime, len); for (int i = 0, off = 0; i < len; i++, off += type.size) { arr.add(op.get(context, getMemoryIO(), off)); } return arr; }
@JRubyMethod(name = { "write_array_of_type" }, required = 2) public IRubyObject write_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject aryArg) { Type type = context.runtime.getFFI().getTypeResolver().findType(context.runtime, typeArg); MemoryOp op = MemoryOp.getMemoryOp(type); if (op == null) { throw context.runtime.newTypeError("cannot get memory writer for type " + type); } RubyArray arr = aryArg.convertToArray(); int len = arr.size(); for (int i = 0, off = 0; i < len; i++, off += type.size) { op.put(context, getMemoryIO(), off, arr.entry(i)); } return this; }
@JRubyMethod(name = { "write_array_of_type" }, required = 2) public IRubyObject write_array_of_type(ThreadContext context, IRubyObject typeArg, IRubyObject aryArg) { Type type = context.runtime.getFFI().getTypeResolver().findType(context.runtime, typeArg); MemoryOp op = MemoryOp.getMemoryOp(type); if (op == null) { throw context.runtime.newTypeError("cannot get memory writer for type " + type); } RubyArray arr = aryArg.convertToArray(); int len = arr.size(); for (int i = 0, off = 0; i < len; i++, off += type.size) { op.put(context, getMemoryIO(), off, arr.entry(i)); } return this; }