All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jruby.ext.ffi.jffi.DelegatingPointerParameterStrategy Maven / Gradle / Ivy

There is a newer version: 9.4.9.0
Show newest version
package org.jruby.ext.ffi.jffi;

import com.kenai.jffi.ObjectParameterType;
import org.jruby.ext.ffi.MemoryIO;
import org.jruby.runtime.builtin.IRubyObject;

/**
 *
 */
public final class DelegatingPointerParameterStrategy extends PointerParameterStrategy {
    private static final ObjectParameterType OBJECT_TYPE = ObjectParameterType.create(ObjectParameterType.ARRAY, ObjectParameterType.ComponentType.BYTE);
    private final IRubyObject value;
    private final PointerParameterStrategy strategy;

    public DelegatingPointerParameterStrategy(IRubyObject value, PointerParameterStrategy strategy) {
        super(strategy.isDirect(), strategy.isReferenceRequired(), OBJECT_TYPE);
        this.value = value;
        this.strategy = strategy;
    }

    @Override
    public long address(Object parameter) {
        return strategy.address(value);
    }

    @Override
    public Object object(Object parameter) {
        return strategy.object(value);
    }

    @Override
    public int offset(Object parameter) {
        return strategy.offset(value);
    }

    @Override
    public int length(Object parameter) {
        return strategy.length(value);
    }

    @Override
    public MemoryIO getMemoryIO(Object parameter) {
        return strategy.getMemoryIO(value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy