当前位置: 首页>>代码示例>>Java>>正文


Java PointerIO类代码示例

本文整理汇总了Java中org.bridj.PointerIO的典型用法代码示例。如果您正苦于以下问题:Java PointerIO类的具体用法?Java PointerIO怎么用?Java PointerIO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PointerIO类属于org.bridj包,在下文中一共展示了PointerIO类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBridJPointer

import org.bridj.PointerIO; //导入依赖的package包/类
private static final <T> Pointer<T> getBridJPointer(final long pBufferAddress,
													final long pBufferLength,
													final Class<T> pTargetClass)
{

	final PointerIO<?> lPointerIO = PointerIO.getInstance(pTargetClass);
	final Releaser lReleaser = new Releaser()
	{

		@Override
		public void release(Pointer<?> pP)
		{
			// can't control life-cycle of
		}
	};

	@SuppressWarnings("unchecked")
	final Pointer<T> lPointerToAddress = (Pointer<T>) Pointer.pointerToAddress(	pBufferAddress,
																				pBufferLength,
																				lPointerIO,
																				lReleaser);

	return lPointerToAddress;

}
 
开发者ID:ClearVolume,项目名称:ClearVolume,代码行数:26,代码来源:ClearVolumeC.java

示例2: getArrayIO

import org.bridj.PointerIO; //导入依赖的package包/类
static <T> PointerIO<T> getArrayIO(Object array) {
       #foreach ($prim in $primitives)
	if (array instanceof ${prim.Name}[])
		return (PointerIO)CommonPointerIOs.${prim.Name}IO;
	#end
	return PointerIO.getInstance(array.getClass().getComponentType());
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:8,代码来源:PointerIO.java

示例3: getInstance

import org.bridj.PointerIO; //导入依赖的package包/类
public static <S extends StructObject> PointerIO<S> getInstance(StructIO s) {
    PointerIO io = structIOs.get(s);
    if (io == null) {
        io = new CommonPointerIOs.StructPointerIO(s);
        PointerIO previousIO = structIOs.putIfAbsent(s, io);
        if (previousIO != null)
            io = previousIO;
    }
    return io;
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:11,代码来源:PointerIO.java

示例4: getBufferPrimitiveInstance

import org.bridj.PointerIO; //导入依赖的package包/类
public static <P> PointerIO<P> getBufferPrimitiveInstance(Buffer buffer) {
      #foreach ($prim in $primitivesNoBool)
if (buffer instanceof ${prim.BufferName})
          return (PointerIO)CommonPointerIOs.${prim.Name}IO;
#end
      throw new UnsupportedOperationException();
  }
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:8,代码来源:PointerIO.java

示例5: allocateCOMMemory

import org.bridj.PointerIO; //导入依赖的package包/类
protected <V> Pointer<V> allocateCOMMemory(PointerIO<V> pointerIO) {
    return allocateCOMMemory(pointerIO.getTargetSize(), pointerIO);
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:4,代码来源:COMRuntime.java

示例6: newCPPInstance

import org.bridj.PointerIO; //导入依赖的package包/类
protected <T extends CPPObject> Pointer<T> newCPPInstance(T instance, final Type type, int constructorId, Object... args) {
    Pointer<T> peer = null;
    try {
        final Class<T> typeClass = Utils.getClass(type);
        NativeLibrary lib = BridJ.getNativeLibrary(typeClass);

        if (BridJ.debug) {
            info("Creating C++ instance of type " + type + " with args " + Arrays.asList(args));
        }
        Pointer.Releaser releaser = newCPPReleaser(type, typeClass, lib);

        long size = sizeOf(type, null);
        peer = (Pointer) Pointer.allocateBytes(PointerIO.getInstance(type), size, releaser).as(type);

        DynamicFunction<?> constructor = constructorId == SKIP_CONSTRUCTOR ? null : getConstructor(typeClass, type, lib, constructorId);

        if (lib != null && CPPObject.class.isAssignableFrom(typeClass)) {
            installRegularVTablePtr(type, lib, peer);
        } else {
            // TODO ObjCObject : call alloc on class type !!
        }

        // Calling the constructor with the non-template parameters :
        if (constructor != null) {
            Object[] consThisArgs = new Object[1 + args.length];
            consThisArgs[0] = peer;
            System.arraycopy(args, 0, consThisArgs, 1, args.length);

            constructor.apply(consThisArgs);
        }

        // Install synthetic virtual table and associate the Java instance to the corresponding native pointer : 
        if (CPPObject.class.isAssignableFrom(typeClass)) {
            if (installSyntheticVTablePtr(type, lib, peer)) {
                BridJ.setJavaObjectFromNativePeer(peer.getPeer(), instance);
            }
        } else {
            // TODO ObjCObject : call alloc on class type !!
        }
        return peer;
    } catch (Exception ex) {
        ex.printStackTrace();
        if (peer != null) {
            peer.release();
        }
        throw new RuntimeException("Failed to allocate new instance of type " + type, ex);
    }
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:49,代码来源:CPPRuntime.java

示例7: PointerIO

import org.bridj.PointerIO; //导入依赖的package包/类
public PointerIO(Type targetType, int targetSize, Class<?> typedPointerClass) {
	this.targetType = targetType;
	this.targetSize = targetSize;
	this.typedPointerClass = typedPointerClass;
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:6,代码来源:PointerIO.java

示例8: getReferenceIO

import org.bridj.PointerIO; //导入依赖的package包/类
PointerIO<Pointer<T>> getReferenceIO() {
	return new CommonPointerIOs.PointerPointerIO<T>(this);
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:4,代码来源:PointerIO.java

示例9: getPointerInstance

import org.bridj.PointerIO; //导入依赖的package包/类
public static <T> PointerIO<Pointer<T>> getPointerInstance(Type target) {
	return getPointerInstance((PointerIO<T>)getInstance(target));
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:4,代码来源:PointerIO.java

示例10: getArrayInstance

import org.bridj.PointerIO; //导入依赖的package包/类
public static <T> PointerIO<Pointer<T>> getArrayInstance(PointerIO<T> targetIO, long[] dimensions, int iDimension) {
	return new CommonPointerIOs.PointerArrayIO<T>(targetIO, dimensions, iDimension);
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:4,代码来源:PointerIO.java

示例11: getTimeTInstance

import org.bridj.PointerIO; //导入依赖的package包/类
public static PointerIO<TimeT> getTimeTInstance() {
   return (PointerIO)CommonPointerIOs.TimeTIO;
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:4,代码来源:PointerIO.java


注:本文中的org.bridj.PointerIO类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。