org.bridj
Class CRuntime

java.lang.Object
  extended by org.bridj.AbstractBridJRuntime
      extended by org.bridj.CRuntime
All Implemented Interfaces:
BridJRuntime
Direct Known Subclasses:
CPPRuntime, ObjectiveCRuntime

public class CRuntime
extends AbstractBridJRuntime

C runtime (used by default when no Runtime annotation is found).
Deals with registration and lifecycle of structs, functions, callbacks.
A shared C runtime instance can be retrieved with getInstance().

Author:
ochafik

Nested Class Summary
 class CRuntime.CTypeInfo<T extends NativeObject>
           
static class CRuntime.MethodCallInfoBuilder
           
 
Nested classes/interfaces inherited from interface org.bridj.BridJRuntime
BridJRuntime.TypeInfo<T extends NativeObject>
 
Field Summary
static String PROPERTY_bridj_c_defaultObjectSize
           
 
Constructor Summary
CRuntime()
          Deprecated. use getInstance() instead
 
Method Summary
<T extends NativeObject>
Pointer<T>
allocate(Class<T> type, int constructorId, Object... args)
           
static
<T> Pointer<T>
createCToJavaCallback(MethodCallInfo mci, Type t)
           
<T extends NativeObject>
Class<? extends T>
getActualInstanceClass(Pointer<T> pInstance, Type officialType)
           
 org.bridj.CallbackNativeImplementer getCallbackNativeImplementer()
           
 int getDefaultStructSize()
           
 DynamicFunctionFactory getDynamicFunctionFactory(NativeLibrary library, Convention.Style callingConvention, Type returnType, Type... parameterTypes)
          Get a shared factory of native function wrappers that have a given signatures.
static CRuntime getInstance()
           
<T extends NativeObject>
Class<? extends T>
getTypeForCast(Type type)
           
<T extends NativeObject>
BridJRuntime.TypeInfo<T>
getTypeInfo(Type type)
           
 boolean isAvailable()
           
 void register(Type type)
           
 long sizeOf(Type structType, StructIO io)
           
 void unregister(Type type)
           
 
Methods inherited from class org.bridj.AbstractBridJRuntime
getType, isOverridenSignature
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_bridj_c_defaultObjectSize

public static final String PROPERTY_bridj_c_defaultObjectSize
See Also:
Constant Field Values
Constructor Detail

CRuntime

@Deprecated
public CRuntime()
Deprecated. use getInstance() instead

Method Detail

getCallbackNativeImplementer

public org.bridj.CallbackNativeImplementer getCallbackNativeImplementer()

isAvailable

public boolean isAvailable()

getInstance

public static CRuntime getInstance()

getActualInstanceClass

public <T extends NativeObject> Class<? extends T> getActualInstanceClass(Pointer<T> pInstance,
                                                                          Type officialType)

getTypeInfo

public <T extends NativeObject> BridJRuntime.TypeInfo<T> getTypeInfo(Type type)

register

public void register(Type type)

unregister

public void unregister(Type type)
Specified by:
unregister in interface BridJRuntime
Overrides:
unregister in class AbstractBridJRuntime

allocate

public <T extends NativeObject> Pointer<T> allocate(Class<T> type,
                                                    int constructorId,
                                                    Object... args)

getDefaultStructSize

public int getDefaultStructSize()

sizeOf

public long sizeOf(Type structType,
                   StructIO io)

getTypeForCast

public <T extends NativeObject> Class<? extends T> getTypeForCast(Type type)

getDynamicFunctionFactory

public DynamicFunctionFactory getDynamicFunctionFactory(NativeLibrary library,
                                                        Convention.Style callingConvention,
                                                        Type returnType,
                                                        Type... parameterTypes)
Get a shared factory of native function wrappers that have a given signatures.

Parameters:
library - library to which the allocated native thunks will be bound (can be null, in which case the native allocations will be bound to BridJ.getOrphanEntities())
callingConvention - calling convention used by the functions (if null, default is typically Convention.Style.CDecl)
returnType - return type of the functions
parameterTypes - parameter types of the functions Also see DynamicFunction and Pointer.asDynamicFunction(org.bridj.ann.Convention.Style, java.lang.reflect.Type, java.lang.reflect.Type[]).

createCToJavaCallback

public static <T> Pointer<T> createCToJavaCallback(MethodCallInfo mci,
                                                   Type t)


Copyright © 2009-2013. All Rights Reserved.