org.jruby.ext.ffi.jffi
Class Factory

java.lang.Object
  extended by org.jruby.ext.ffi.Factory
      extended by org.jruby.ext.ffi.jffi.Factory

public class Factory
extends Factory


Nested Class Summary
static class Factory.LastError
           
 
Constructor Summary
Factory()
           
 
Method Summary
 int alignmentOf(NativeType type)
           
 AllocatedDirectMemoryIO allocateDirectMemory(Ruby runtime, int size, boolean clear)
          Allocates memory on the native C heap and wraps it in a MemoryIO accessor.
 AllocatedDirectMemoryIO allocateDirectMemory(Ruby runtime, int size, int align, boolean clear)
          Allocates memory on the native C heap and wraps it in a MemoryIO accessor.
 CallbackManager getCallbackManager()
           
 void init(Ruby runtime, RubyModule ffi)
          Registers FFI ruby classes/modules
 Function newFunction(Ruby runtime, Pointer address, CallbackInfo cbInfo)
           
 int sizeOf(NativeType type)
           
 DirectMemoryIO wrapDirectMemory(Ruby runtime, long address)
          Wraps a native C memory address in a MemoryIO accessor.
 
Methods inherited from class org.jruby.ext.ffi.Factory
getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory

public Factory()
Method Detail

init

public void init(Ruby runtime,
                 RubyModule ffi)
Description copied from class: Factory
Registers FFI ruby classes/modules

Overrides:
init in class Factory

allocateDirectMemory

public AllocatedDirectMemoryIO allocateDirectMemory(Ruby runtime,
                                                    int size,
                                                    boolean clear)
Allocates memory on the native C heap and wraps it in a MemoryIO accessor.

Specified by:
allocateDirectMemory in class Factory
Parameters:
size - The number of bytes to allocate.
clear - If the memory should be cleared.
Returns:
A new MemoryIO.

allocateDirectMemory

public AllocatedDirectMemoryIO allocateDirectMemory(Ruby runtime,
                                                    int size,
                                                    int align,
                                                    boolean clear)
Allocates memory on the native C heap and wraps it in a MemoryIO accessor.

Specified by:
allocateDirectMemory in class Factory
Parameters:
size - The number of bytes to allocate.
align - The minimum alignment of the memory
clear - If the memory should be cleared.
Returns:
A new MemoryIO.

wrapDirectMemory

public DirectMemoryIO wrapDirectMemory(Ruby runtime,
                                       long address)
Description copied from class: Factory
Wraps a native C memory address in a MemoryIO accessor.

Specified by:
wrapDirectMemory in class Factory
address - The native address to wrap.
Returns:
A new MemoryIO.

newFunction

public Function newFunction(Ruby runtime,
                            Pointer address,
                            CallbackInfo cbInfo)
Specified by:
newFunction in class Factory

getCallbackManager

public CallbackManager getCallbackManager()
Specified by:
getCallbackManager in class Factory

sizeOf

public int sizeOf(NativeType type)
Specified by:
sizeOf in class Factory

alignmentOf

public int alignmentOf(NativeType type)
Specified by:
alignmentOf in class Factory


Copyright © 2002-2009 JRuby Team. All Rights Reserved.