org.bridj.cpp
Class CPPRuntime

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

public class CPPRuntime
extends CRuntime

C++ runtime (derives from the C runtime).
Deals with registration and lifecycle of C++ classes and methods (virtual or not).

Author:
ochafik

Nested Class Summary
protected static interface CPPRuntime.ClassTypeVariableExtractor
           
static class CPPRuntime.CPPDestructor
           
 class CPPRuntime.CPPTypeInfo<T extends CPPObject>
           
static class CPPRuntime.MemoryOperators
           
protected static interface CPPRuntime.MethodTypeVariableExtractor
           
protected static class CPPRuntime.VirtMeth
           
 
Nested classes/interfaces inherited from class org.bridj.CRuntime
CRuntime.CTypeInfo<T extends NativeObject>, CRuntime.MethodCallInfoBuilder
 
Nested classes/interfaces inherited from interface org.bridj.BridJRuntime
BridJRuntime.TypeInfo<T extends NativeObject>
 
Field Summary
static int DEFAULT_CONSTRUCTOR
           
static int SKIP_CONSTRUCTOR
           
 
Fields inherited from class org.bridj.CRuntime
PROPERTY_bridj_c_defaultObjectSize, rootCallbackClasses
 
Constructor Summary
CPPRuntime()
           
 
Method Summary
protected  CPPRuntime.ClassTypeVariableExtractor createClassTypeVariableExtractor(TypeVariable<Class<?>> var)
           
protected  CPPRuntime.MethodTypeVariableExtractor createMethodTypeVariableExtractor(TypeVariable<?> var)
           
<T extends NativeObject>
Class<? extends T>
getActualInstanceClass(Pointer<T> pInstance, Type officialType)
           
protected static int getAnnotatedTemplateTypeVariableIndexInArguments(TypeVariable<?> var)
           
<T extends CPPObject>
CPPRuntime.CPPTypeInfo<T>
getCPPTypeInfo(Type type)
           
static CPPRuntime getInstance()
           
 CPPRuntime.MemoryOperators getMemoryOperators()
           
 int getPositionInVirtualTable(Pointer<Pointer<?>> pVirtualTable, Method method, NativeLibrary library)
           
 Object[] getTemplateParameters(CPPObject object, Class<?> typeClass)
           
<T extends NativeObject>
BridJRuntime.TypeInfo<T>
getTypeInfo(Type type)
           
 int getVirtualMethodsCount(Class<?> type)
           
protected  boolean installRegularVTablePtr(Type type, NativeLibrary library, Pointer<?> peer)
           
protected  boolean installSyntheticVTablePtr(Type type, NativeLibrary library, Pointer<?> peer)
           
protected  void listVirtualMethods(Class<?> type, List<CPPRuntime.VirtMeth> out)
           
protected
<T extends CPPObject>
Pointer<T>
newCPPInstance(T instance, Type type, int constructorId, Object... args)
           
protected  void registerNativeMethod(Class<?> type, NativeLibrary typeLibrary, Method method, NativeLibrary methodLibrary, NativeEntities.Builder builder, CRuntime.MethodCallInfoBuilder methodCallInfoBuilder)
           
 void setTemplateParameters(CPPObject object, Class<?> typeClass, Object[] params)
           
protected  org.bridj.cpp.CPPRuntime.VTable synthetizeVirtualTable(Type type, Pointer<Pointer> parentVTablePtr, List<CPPRuntime.VirtMeth> methods, NativeLibrary library)
           
 
Methods inherited from class org.bridj.CRuntime
allocate, createCToJavaCallback, getCallbackNativeImplementer, getDefaultStructSize, getDynamicFunctionFactory, getNativeLibrary, getSeverityOfMissingSymbol, getTypeForCast, getUniqueAbstractCallbackMethod, isAvailable, register, registerCallbackInstance, registerFamily, setNativeObjectPeer, sizeOf
 
Methods inherited from class org.bridj.AbstractBridJRuntime
findConstructor, getType, isOverride, isOverridenSignature, log, log, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONSTRUCTOR

public static final int DEFAULT_CONSTRUCTOR
See Also:
Constant Field Values

SKIP_CONSTRUCTOR

public static final int SKIP_CONSTRUCTOR
See Also:
Constant Field Values
Constructor Detail

CPPRuntime

public CPPRuntime()
Method Detail

getInstance

public static CPPRuntime getInstance()

getTemplateParameters

public Object[] getTemplateParameters(CPPObject object,
                                      Class<?> typeClass)

setTemplateParameters

public void setTemplateParameters(CPPObject object,
                                  Class<?> typeClass,
                                  Object[] params)

getAnnotatedTemplateTypeVariableIndexInArguments

protected static int getAnnotatedTemplateTypeVariableIndexInArguments(TypeVariable<?> var)

createClassTypeVariableExtractor

protected CPPRuntime.ClassTypeVariableExtractor createClassTypeVariableExtractor(TypeVariable<Class<?>> var)

createMethodTypeVariableExtractor

protected CPPRuntime.MethodTypeVariableExtractor createMethodTypeVariableExtractor(TypeVariable<?> var)

getActualInstanceClass

public <T extends NativeObject> Class<? extends T> getActualInstanceClass(Pointer<T> pInstance,
                                                                          Type officialType)
Specified by:
getActualInstanceClass in interface BridJRuntime
Overrides:
getActualInstanceClass in class CRuntime

getVirtualMethodsCount

public int getVirtualMethodsCount(Class<?> type)

listVirtualMethods

protected void listVirtualMethods(Class<?> type,
                                  List<CPPRuntime.VirtMeth> out)

registerNativeMethod

protected void registerNativeMethod(Class<?> type,
                                    NativeLibrary typeLibrary,
                                    Method method,
                                    NativeLibrary methodLibrary,
                                    NativeEntities.Builder builder,
                                    CRuntime.MethodCallInfoBuilder methodCallInfoBuilder)
                             throws FileNotFoundException
Overrides:
registerNativeMethod in class CRuntime
Throws:
FileNotFoundException

getMemoryOperators

public CPPRuntime.MemoryOperators getMemoryOperators()

getPositionInVirtualTable

public int getPositionInVirtualTable(Pointer<Pointer<?>> pVirtualTable,
                                     Method method,
                                     NativeLibrary library)

installRegularVTablePtr

protected boolean installRegularVTablePtr(Type type,
                                          NativeLibrary library,
                                          Pointer<?> peer)

installSyntheticVTablePtr

protected boolean installSyntheticVTablePtr(Type type,
                                            NativeLibrary library,
                                            Pointer<?> peer)

synthetizeVirtualTable

protected org.bridj.cpp.CPPRuntime.VTable synthetizeVirtualTable(Type type,
                                                                 Pointer<Pointer> parentVTablePtr,
                                                                 List<CPPRuntime.VirtMeth> methods,
                                                                 NativeLibrary library)

newCPPInstance

protected <T extends CPPObject> Pointer<T> newCPPInstance(T instance,
                                                          Type type,
                                                          int constructorId,
                                                          Object... args)

getTypeInfo

public <T extends NativeObject> BridJRuntime.TypeInfo<T> getTypeInfo(Type type)
Specified by:
getTypeInfo in interface BridJRuntime
Overrides:
getTypeInfo in class CRuntime

getCPPTypeInfo

public <T extends CPPObject> CPPRuntime.CPPTypeInfo<T> getCPPTypeInfo(Type type)


Copyright © 2009-2012. All Rights Reserved.