Package org.jruby.ext.ffi

Examples of org.jruby.ext.ffi.MappedType


                case ULONG:
                    return Platform.getPlatform().longSize() == 32;
            }

        } else if (paramType instanceof MappedType) {
            MappedType mt = (MappedType) paramType;
            return isFastIntParam(mt.getRealType()) && !mt.isReferenceRequired() && !mt.isPostInvokeRequired();

        }

        return false;
    }
View Full Code Here


    final IntParameterConverter getIntParameterConverter(Type type, IRubyObject enums) {
        if (type instanceof Type.Builtin) {
            return getIntParameterConverter(type.getNativeType(), enums);

        } else if (type instanceof MappedType) {
            MappedType ctype = (MappedType) type;
            return new MappedParameterConverter(getIntParameterConverter(ctype.getRealType(), enums), ctype);

        } else {
            return null;
        }
    }
View Full Code Here

    final IntResultConverter getIntResultConverter(Type type) {
        if (type instanceof Type.Builtin) {
            return getIntResultConverter(type.getNativeType());

        } else if (type instanceof MappedType) {
            MappedType ctype = (MappedType) type;
            return new MappedResultConverter(getIntResultConverter(ctype.getRealType()), ctype);

        } else {
            return null;
        }
    }
View Full Code Here

                case ULONG:
                    return true;
            }

        } else if (type instanceof MappedType) {
            MappedType mt = (MappedType) type;
            return isFastLongResult(mt.getRealType()) && !mt.isReferenceRequired() && !mt.isPostInvokeRequired();


        }
        return false;
    }
View Full Code Here

    final LongParameterConverter getLongParameterConverter(Type type, IRubyObject enums) {
        if (type instanceof Type.Builtin) {
            return getLongParameterConverter(type.getNativeType(), enums);

        } else if (type instanceof MappedType) {
            MappedType mtype = (MappedType) type;
            return new MappedParameterConverter(getLongParameterConverter(mtype.getRealType(), enums), mtype);
       
        } else {
            throw new IllegalArgumentException("Unknown type " + type);
        }
    }
View Full Code Here

    final LongResultConverter getLongResultConverter(Type type) {
        if (type instanceof Type.Builtin) {
            return getLongResultConverter(type.getNativeType());

        } else if (type instanceof MappedType) {
            MappedType mtype = (MappedType) type;
            return new MappedResultConverter(getLongResultConverter(mtype.getRealType()), mtype);
       
        } else {
            throw new IllegalArgumentException("unsupported return type " + type);
        }
View Full Code Here

        } else if (returnType instanceof StructByValue) {
            return new StructByValueInvoker((StructByValue) returnType);
       
        } else if (returnType instanceof MappedType) {
            MappedType ctype = (MappedType) returnType;
            return new MappedTypeInvoker(getFunctionInvoker(ctype.getRealType()), ctype);
        }

        throw returnType.getRuntime().newArgumentError("Cannot get FunctionInvoker for " + returnType);
    }
View Full Code Here

        } else if (type instanceof org.jruby.ext.ffi.StructByValue) {
            return new StructByValueMarshaller((org.jruby.ext.ffi.StructByValue) type);
       
        } else if (type instanceof org.jruby.ext.ffi.MappedType) {
            MappedType ctype = (MappedType) type;
            return new MappedTypeMarshaller(getMarshaller(ctype.getRealType(), convention, enums), ctype);

        } else {
            return null;
        }
    }
View Full Code Here

            } else {
                throw runtime.newTypeError(value, runtime.fastGetModule("FFI").fastGetClass("Struct"));
            }

        } else if (type instanceof MappedType) {
            MappedType mappedType = (MappedType) type;
            setReturnValue(runtime, mappedType.getRealType(), buffer, mappedType.toNative(runtime.getCurrentContext(), value));

        } else {
            buffer.setLongReturn(0L);
            throw runtime.newRuntimeError("unsupported return type from struct: " + type);
        }
View Full Code Here

            return sbv.getStructClass().newInstance(runtime.getCurrentContext(),
                        new IRubyObject[] { new Pointer(runtime, memory) },
                        Block.NULL_BLOCK);

        } else if (type instanceof MappedType) {
            MappedType mappedType = (MappedType) type;
            return mappedType.fromNative(runtime.getCurrentContext(), fromNative(runtime, mappedType.getRealType(), buffer, index));

        } else {
            throw runtime.newTypeError("unsupported callback parameter type: " + type);
        }
View Full Code Here

TOP

Related Classes of org.jruby.ext.ffi.MappedType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.