Package com.jogamp.gluegen
Class JavaMethodBindingEmitter
- java.lang.Object
-
- com.jogamp.gluegen.FunctionEmitter
-
- com.jogamp.gluegen.JavaMethodBindingEmitter
-
- Direct Known Subclasses:
ProcAddressJavaMethodBindingEmitter
public class JavaMethodBindingEmitter extends FunctionEmitter
An emitter that emits only the interface for a Java<->C JNI binding.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJavaMethodBindingEmitter.DefaultCommentEmitterClass that emits a generic comment for JavaMethodBindingEmitters; the comment includes the C signature of the native method that is being bound by the emitter java method.protected classJavaMethodBindingEmitter.InterfaceCommentEmitter-
Nested classes/interfaces inherited from class com.jogamp.gluegen.FunctionEmitter
FunctionEmitter.EmissionModifier
-
-
Field Summary
Fields Modifier and Type Field Description static FunctionEmitter.EmissionModifierABSTRACTprotected MethodBindingbindingprotected CommentEmitterdefaultInterfaceCommentEmitterprotected CommentEmitterdefaultJavaCommentEmitterprotected List<String>epiloguestatic FunctionEmitter.EmissionModifierFINALstatic FunctionEmitter.EmissionModifierNATIVEstatic FunctionEmitter.EmissionModifierPRIVATEprotected List<String>prologuestatic FunctionEmitter.EmissionModifierPROTECTEDstatic FunctionEmitter.EmissionModifierPUBLICstatic FunctionEmitter.EmissionModifierSYNCHRONIZEDprotected booleantagNativeBindingprotected booleanuseNIODirectOnly-
Fields inherited from class com.jogamp.gluegen.FunctionEmitter
cfg, STATIC
-
-
Constructor Summary
Constructors Constructor Description JavaMethodBindingEmitter(JavaMethodBindingEmitter arg)JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType, String unsupportedExceptionType, boolean emitBody, boolean tagNativeBinding, boolean eraseBufferAndArrayTypes, boolean useNIOOnly, boolean useNIODirectOnly, boolean forDirectBufferImplementation, boolean forIndirectBufferAndArrayImplementation, boolean isUnimplemented, boolean isInterface, boolean isNativeMethod, boolean isPrivateNativeMethod, JavaConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String[]argumentNameArray()protected StringbyteOffsetArgName(int i)protected static StringbyteOffsetArgName(String s)protected StringbyteOffsetArrayArgName(int i)protected intemitArguments(PrintWriter writer)Returns the number of arguments emitted.protected voidemitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer)protected voidemitBody(PrintWriter writer)protected voidemitCall(MethodBinding binding, PrintWriter writer)protected intemitCallArguments(MethodBinding binding, PrintWriter writer)protected voidemitCallResultReturn(MethodBinding binding, PrintWriter writer)protected voidemitCompoundArrayCopies(MethodBinding binding, PrintWriter writer)protected voidemitName(PrintWriter writer)protected voidemitPostCallCleanup(MethodBinding binding, PrintWriter writer)protected voidemitPreCallSetup(MethodBinding binding, PrintWriter writer)protected voidemitPrologueOrEpilogue(List<String> code, PrintWriter writer)protected voidemitReturnType(PrintWriter writer)protected voidemitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer)protected StringerasedTypeString(JavaType type, boolean skipBuffers)protected StringgetArgumentName(int i)protected StringgetBaseIndentString()MethodBindinggetBinding()protected StringgetCommentEndString()protected StringgetCommentStartString()FunctionSymbolgetCSymbol()StringgetImplName()StringgetInterfaceName()protected StringgetNativeImplMethodName()StringgetNativeName()protected StringgetReturnedArrayLengthComment()protected StringgetReturnedArrayLengthExpression()protected StringgetReturnTypeString(boolean skipArray)StringgetRuntimeExceptionType()The type of exception (must subclassjava.lang.RuntimeException) raised if runtime checks fail in the generated code.StringgetUnsupportedExceptionType()booleanisForDirectBufferImplementation()booleanisForIndirectBufferAndArrayImplementation()booleanisNativeMethod()protected StringisNIOArgName(int i)protected StringisNIOArgName(String s)booleanisPrivateNativeMethod()static StringjavaThisArgumentName()protected StringoffsetArgName(int i)voidsetEmitBody(boolean emitBody)Accessor for subclasses.voidsetEpilogue(List<String> epilogue)Sets the manually-generated epilogue code for this emitter.voidsetEraseBufferAndArrayTypes(boolean erase)Accessor for subclasses.voidsetForDirectBufferImplementation(boolean direct)Accessor for subclasses.voidsetForIndirectBufferAndArrayImplementation(boolean indirect)Accessor for subclasses.voidsetPrivateNativeMethod(boolean v)Accessor for subclasses.voidsetPrologue(List<String> prologue)Sets the manually-generated prologue code for this emitter.voidsetReturnedArrayLengthExpression(String expr)If the underlying function returns an array (currently only arrays of compound types are supported) as opposed to a pointer to an object, this method should be called to provide a MessageFormat string containing an expression that computes the number of elements of the returned array.protected voidsetReturnedArrayLengthExpression(String expr, boolean onlyForComments)booleansignatureOnly()Indicates whether this emitter will print only a signature, or whether it will emit Java code for the body of the method as well.-
Methods inherited from class com.jogamp.gluegen.FunctionEmitter
addModifier, addModifiers, clearModifiers, emit, emit, emitDocComment, emitModifiers, emitSignature, getCommentEmitter, getDefaultOutput, getModifiers, hasModifier, isInterface, removeModifier, setCommentEmitter, toString
-
-
-
-
Field Detail
-
PUBLIC
public static final FunctionEmitter.EmissionModifier PUBLIC
-
PROTECTED
public static final FunctionEmitter.EmissionModifier PROTECTED
-
PRIVATE
public static final FunctionEmitter.EmissionModifier PRIVATE
-
ABSTRACT
public static final FunctionEmitter.EmissionModifier ABSTRACT
-
FINAL
public static final FunctionEmitter.EmissionModifier FINAL
-
NATIVE
public static final FunctionEmitter.EmissionModifier NATIVE
-
SYNCHRONIZED
public static final FunctionEmitter.EmissionModifier SYNCHRONIZED
-
defaultJavaCommentEmitter
protected final CommentEmitter defaultJavaCommentEmitter
-
defaultInterfaceCommentEmitter
protected final CommentEmitter defaultInterfaceCommentEmitter
-
tagNativeBinding
protected final boolean tagNativeBinding
-
useNIODirectOnly
protected final boolean useNIODirectOnly
-
binding
protected final MethodBinding binding
-
-
Constructor Detail
-
JavaMethodBindingEmitter
public JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType, String unsupportedExceptionType, boolean emitBody, boolean tagNativeBinding, boolean eraseBufferAndArrayTypes, boolean useNIOOnly, boolean useNIODirectOnly, boolean forDirectBufferImplementation, boolean forIndirectBufferAndArrayImplementation, boolean isUnimplemented, boolean isInterface, boolean isNativeMethod, boolean isPrivateNativeMethod, JavaConfiguration configuration)
-
JavaMethodBindingEmitter
public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg)
-
-
Method Detail
-
getBinding
public final MethodBinding getBinding()
-
isNativeMethod
public boolean isNativeMethod()
-
isPrivateNativeMethod
public boolean isPrivateNativeMethod()
-
isForDirectBufferImplementation
public boolean isForDirectBufferImplementation()
-
isForIndirectBufferAndArrayImplementation
public boolean isForIndirectBufferAndArrayImplementation()
-
getInterfaceName
public String getInterfaceName()
- Specified by:
getInterfaceNamein classFunctionEmitter
-
getImplName
public String getImplName()
- Specified by:
getImplNamein classFunctionEmitter
-
getNativeName
public String getNativeName()
- Specified by:
getNativeNamein classFunctionEmitter
-
getCSymbol
public FunctionSymbol getCSymbol()
- Specified by:
getCSymbolin classFunctionEmitter
-
getArgumentName
protected String getArgumentName(int i)
-
getRuntimeExceptionType
public String getRuntimeExceptionType()
The type of exception (must subclassjava.lang.RuntimeException) raised if runtime checks fail in the generated code.
-
getUnsupportedExceptionType
public String getUnsupportedExceptionType()
-
setReturnedArrayLengthExpression
public void setReturnedArrayLengthExpression(String expr)
If the underlying function returns an array (currently only arrays of compound types are supported) as opposed to a pointer to an object, this method should be called to provide a MessageFormat string containing an expression that computes the number of elements of the returned array. The parameters to the MessageFormat expression are the names of the incoming Java arguments.
-
setReturnedArrayLengthExpression
protected void setReturnedArrayLengthExpression(String expr, boolean onlyForComments)
-
getReturnedArrayLengthExpression
protected String getReturnedArrayLengthExpression()
-
getReturnedArrayLengthComment
protected String getReturnedArrayLengthComment()
-
setPrologue
public void setPrologue(List<String> prologue)
Sets the manually-generated prologue code for this emitter.
-
setEpilogue
public void setEpilogue(List<String> epilogue)
Sets the manually-generated epilogue code for this emitter.
-
signatureOnly
public boolean signatureOnly()
Indicates whether this emitter will print only a signature, or whether it will emit Java code for the body of the method as well.
-
setEmitBody
public void setEmitBody(boolean emitBody)
Accessor for subclasses.
-
setEraseBufferAndArrayTypes
public void setEraseBufferAndArrayTypes(boolean erase)
Accessor for subclasses.
-
setPrivateNativeMethod
public void setPrivateNativeMethod(boolean v)
Accessor for subclasses.
-
setForDirectBufferImplementation
public void setForDirectBufferImplementation(boolean direct)
Accessor for subclasses.
-
setForIndirectBufferAndArrayImplementation
public void setForIndirectBufferAndArrayImplementation(boolean indirect)
Accessor for subclasses.
-
emitReturnType
protected void emitReturnType(PrintWriter writer)
- Specified by:
emitReturnTypein classFunctionEmitter
-
getReturnTypeString
protected String getReturnTypeString(boolean skipArray)
-
emitName
protected void emitName(PrintWriter writer)
- Specified by:
emitNamein classFunctionEmitter
-
emitArguments
protected int emitArguments(PrintWriter writer)
Description copied from class:FunctionEmitterReturns the number of arguments emitted.- Specified by:
emitArgumentsin classFunctionEmitter
-
getNativeImplMethodName
protected String getNativeImplMethodName()
-
byteOffsetArgName
protected String byteOffsetArgName(int i)
-
isNIOArgName
protected String isNIOArgName(int i)
-
byteOffsetArrayArgName
protected String byteOffsetArrayArgName(int i)
-
offsetArgName
protected String offsetArgName(int i)
-
emitBody
protected void emitBody(PrintWriter writer)
- Specified by:
emitBodyin classFunctionEmitter
-
emitPrologueOrEpilogue
protected void emitPrologueOrEpilogue(List<String> code, PrintWriter writer)
-
emitPreCallSetup
protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer)
-
emitArrayLengthAndNIOBufferChecks
protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer)
-
emitCompoundArrayCopies
protected void emitCompoundArrayCopies(MethodBinding binding, PrintWriter writer)
-
emitCall
protected void emitCall(MethodBinding binding, PrintWriter writer)
-
emitReturnVariableSetupAndCall
protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer)
-
emitCallArguments
protected int emitCallArguments(MethodBinding binding, PrintWriter writer)
-
emitPostCallCleanup
protected void emitPostCallCleanup(MethodBinding binding, PrintWriter writer)
-
emitCallResultReturn
protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer)
-
argumentNameArray
protected String[] argumentNameArray()
-
javaThisArgumentName
public static String javaThisArgumentName()
-
getCommentStartString
protected String getCommentStartString()
- Overrides:
getCommentStartStringin classFunctionEmitter
-
getCommentEndString
protected String getCommentEndString()
- Overrides:
getCommentEndStringin classFunctionEmitter
-
getBaseIndentString
protected String getBaseIndentString()
- Overrides:
getBaseIndentStringin classFunctionEmitter
-
-