Top Description Inners Fields Constructors Methods
com.jogamp.gluegen

public Class JavaMethodBindingEmitter

extends FunctionEmitter
Class Inheritance
Known Direct Subclasses
com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter
Imports
com.jogamp.gluegen.cgram.HeaderParser, com.jogamp.gluegen.cgram.types.AliasedSymbol, .ArrayType, .EnumType, .FunctionSymbol, .Type, java.io.PrintWriter, java.text.MessageFormat, java.util.Iterator, .List, .Set

An emitter that emits only the interface for a Java<->C JNI binding.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
JavaMethodBindingEmitter.DefaultCommentEmitter

Class 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 class

Field Summary

Modifier and TypeField and Description
public static final FunctionEmitter.EmissionModifier
protected final MethodBinding
private static final String
protected final CommentEmitter
protected final CommentEmitter
private boolean
protected List<String>
private boolean
public static final FunctionEmitter.EmissionModifier
private boolean
private boolean
private final boolean
private boolean
private final boolean
public static final FunctionEmitter.EmissionModifier
public static final FunctionEmitter.EmissionModifier
protected List<String>
public static final FunctionEmitter.EmissionModifier
public static final FunctionEmitter.EmissionModifier
private String
private boolean
private final String
public static final FunctionEmitter.EmissionModifier
protected final boolean
private final String
protected final boolean
private final boolean
Inherited from com.jogamp.gluegen.FunctionEmitter:
cfgSTATIC

Constructor Summary

AccessConstructor and Description
public
JavaMethodBindingEmitter(final MethodBinding binding, final PrintWriter output, final String runtimeExceptionType, final String unsupportedExceptionType, final boolean emitBody, final boolean tagNativeBinding, final boolean eraseBufferAndArrayTypes, final boolean useNIOOnly, final boolean useNIODirectOnly, final boolean forDirectBufferImplementation, final boolean forIndirectBufferAndArrayImplementation, final boolean isUnimplemented, final boolean isInterface, final boolean isNativeMethod, final boolean isPrivateNativeMethod, final JavaConfiguration configuration)

public

Method Summary

Modifier and TypeMethod and Description
protected String[]
protected String
byteOffsetArgName(final int i)

protected static String
protected String
protected int
emitArguments(final PrintWriter writer)

Implements abstract com.jogamp.gluegen.FunctionEmitter.emitArguments.

Returns the number of arguments emitted.
protected void
protected void
protected void
emitCall(final MethodBinding binding, final PrintWriter writer)

protected int
emitCallArguments(final MethodBinding binding, final PrintWriter writer)

protected void
emitCallResultReturn(final MethodBinding binding, final PrintWriter writer)

protected void
emitCompoundArrayCopies(final MethodBinding binding, final PrintWriter writer)

protected void
protected void
emitPostCallCleanup(final MethodBinding binding, final PrintWriter writer)

protected void
emitPreCallSetup(final MethodBinding binding, final PrintWriter writer)

protected void
emitPrologueOrEpilogue(final List<String> code, final PrintWriter writer)

protected void
protected void
protected String
erasedTypeString(final JavaType type, final boolean skipBuffers)

protected String
getArgumentName(final int i)

protected String
public final MethodBinding
protected String
protected String
public FunctionSymbol
public String
public String
protected String
public String
protected String
protected String
protected String
getReturnTypeString(final boolean skipArray)

public String
getRuntimeExceptionType()

The type of exception (must subclass java.lang.RuntimeException) raised if runtime checks fail in the generated code.

public String
public boolean
public boolean
public boolean
protected String
isNIOArgName(final int i)

protected String
public boolean
public static String
protected String
offsetArgName(final int i)

public void
setEmitBody(final boolean emitBody)

Accessor for subclasses.

public void
setEpilogue(final List<String> epilogue)

Sets the manually-generated epilogue code for this emitter.

public void
setEraseBufferAndArrayTypes(final boolean erase)

Accessor for subclasses.

public void
setForDirectBufferImplementation(final boolean direct)

Accessor for subclasses.

public void
setForIndirectBufferAndArrayImplementation(final boolean indirect)

Accessor for subclasses.

public void
setPrivateNativeMethod(final boolean v)

Accessor for subclasses.

public void
setPrologue(final List<String> prologue)

Sets the manually-generated prologue code for this emitter.

public void
setReturnedArrayLengthExpression(final 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 void
setReturnedArrayLengthExpression(final String expr, final boolean onlyForComments)

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.

Inherited from com.jogamp.gluegen.FunctionEmitter:
addModifieraddModifiersclearModifiersemitemitemitDocCommentemitModifiersemitSignaturegetCommentEmittergetDefaultOutputgetModifiershasModifierisInterfaceremoveModifiersetCommentEmittertoString

Field Detail

ABSTRACTback to summary
public static final FunctionEmitter.EmissionModifier ABSTRACT
bindingback to summary
protected final MethodBinding binding
COMPOUND_ARRAY_SUFFIXback to summary
private static final String COMPOUND_ARRAY_SUFFIX
defaultInterfaceCommentEmitterback to summary
protected final CommentEmitter defaultInterfaceCommentEmitter
defaultJavaCommentEmitterback to summary
protected final CommentEmitter defaultJavaCommentEmitter
emitBodyback to summary
private boolean emitBody
epilogueback to summary
protected List<String> epilogue
eraseBufferAndArrayTypesback to summary
private boolean eraseBufferAndArrayTypes
FINALback to summary
public static final FunctionEmitter.EmissionModifier FINAL
forDirectBufferImplementationback to summary
private boolean forDirectBufferImplementation
forIndirectBufferAndArrayImplementationback to summary
private boolean forIndirectBufferAndArrayImplementation
isNativeMethodback to summary
private final boolean isNativeMethod
isPrivateNativeMethodback to summary
private boolean isPrivateNativeMethod
isUnimplementedback to summary
private final boolean isUnimplemented
NATIVEback to summary
public static final FunctionEmitter.EmissionModifier NATIVE
PRIVATEback to summary
public static final FunctionEmitter.EmissionModifier PRIVATE
prologueback to summary
protected List<String> prologue
PROTECTEDback to summary
public static final FunctionEmitter.EmissionModifier PROTECTED
PUBLICback to summary
public static final FunctionEmitter.EmissionModifier PUBLIC
returnedArrayLengthExpressionback to summary
private String returnedArrayLengthExpression
returnedArrayLengthExpressionOnlyForCommentsback to summary
private boolean returnedArrayLengthExpressionOnlyForComments
runtimeExceptionTypeback to summary
private final String runtimeExceptionType
SYNCHRONIZEDback to summary
public static final FunctionEmitter.EmissionModifier SYNCHRONIZED
tagNativeBindingback to summary
protected final boolean tagNativeBinding
unsupportedExceptionTypeback to summary
private final String unsupportedExceptionType
useNIODirectOnlyback to summary
protected final boolean useNIODirectOnly
useNIOOnlyback to summary
private final boolean useNIOOnly

Constructor Detail

JavaMethodBindingEmitterback to summary
public JavaMethodBindingEmitter(final MethodBinding binding, final PrintWriter output, final String runtimeExceptionType, final String unsupportedExceptionType, final boolean emitBody, final boolean tagNativeBinding, final boolean eraseBufferAndArrayTypes, final boolean useNIOOnly, final boolean useNIODirectOnly, final boolean forDirectBufferImplementation, final boolean forIndirectBufferAndArrayImplementation, final boolean isUnimplemented, final boolean isInterface, final boolean isNativeMethod, final boolean isPrivateNativeMethod, final JavaConfiguration configuration)
JavaMethodBindingEmitterback to summary
public JavaMethodBindingEmitter(final JavaMethodBindingEmitter arg)

Method Detail

argumentNameArrayback to summary
protected String[] argumentNameArray()
byteOffsetArgNameback to summary
protected String byteOffsetArgName(final int i)
byteOffsetArgNameback to summary
protected static String byteOffsetArgName(final String s)
byteOffsetArrayArgNameback to summary
protected String byteOffsetArrayArgName(final int i)
emitArgumentsback to summary
protected int emitArguments(final PrintWriter writer)

Implements abstract com.jogamp.gluegen.FunctionEmitter.emitArguments.

Doc from com.jogamp.gluegen.FunctionEmitter.emitArguments.

Returns the number of arguments emitted.

Annotations
@Override
emitArrayLengthAndNIOBufferChecksback to summary
protected void emitArrayLengthAndNIOBufferChecks(final MethodBinding binding, final PrintWriter writer)
emitBodyback to summary
protected void emitBody(final PrintWriter writer)

Implements abstract com.jogamp.gluegen.FunctionEmitter.emitBody.

Annotations
@Override
emitCallback to summary
protected void emitCall(final MethodBinding binding, final PrintWriter writer)
emitCallArgumentsback to summary
protected int emitCallArguments(final MethodBinding binding, final PrintWriter writer)
emitCallResultReturnback to summary
protected void emitCallResultReturn(final MethodBinding binding, final PrintWriter writer)
emitCompoundArrayCopiesback to summary
protected void emitCompoundArrayCopies(final MethodBinding binding, final PrintWriter writer)
emitNameback to summary
protected void emitName(final PrintWriter writer)

Implements abstract com.jogamp.gluegen.FunctionEmitter.emitName.

Annotations
@Override
emitPostCallCleanupback to summary
protected void emitPostCallCleanup(final MethodBinding binding, final PrintWriter writer)
emitPreCallSetupback to summary
protected void emitPreCallSetup(final MethodBinding binding, final PrintWriter writer)
emitPrologueOrEpilogueback to summary
protected void emitPrologueOrEpilogue(final List<String> code, final PrintWriter writer)
emitReturnTypeback to summary
protected void emitReturnType(final PrintWriter writer)

Implements abstract com.jogamp.gluegen.FunctionEmitter.emitReturnType.

Annotations
@Override
emitReturnVariableSetupAndCallback to summary
protected void emitReturnVariableSetupAndCall(final MethodBinding binding, final PrintWriter writer)
erasedTypeStringback to summary
protected String erasedTypeString(final JavaType type, final boolean skipBuffers)
getArgumentNameback to summary
protected String getArgumentName(final int i)
getBaseIndentStringback to summary
protected String getBaseIndentString()

Overrides com.jogamp.gluegen.FunctionEmitter.getBaseIndentString.

Annotations
@Override
getBindingback to summary
public final MethodBinding getBinding()
getCommentEndStringback to summary
protected String getCommentEndString()

Overrides com.jogamp.gluegen.FunctionEmitter.getCommentEndString.

Annotations
@Override
getCommentStartStringback to summary
protected String getCommentStartString()

Overrides com.jogamp.gluegen.FunctionEmitter.getCommentStartString.

Annotations
@Override
getCSymbolback to summary
public FunctionSymbol getCSymbol()

Implements abstract com.jogamp.gluegen.FunctionEmitter.getCSymbol.

Annotations
@Override
getImplNameback to summary
public String getImplName()

Implements abstract com.jogamp.gluegen.FunctionEmitter.getImplName.

Annotations
@Override
getInterfaceNameback to summary
public String getInterfaceName()

Implements abstract com.jogamp.gluegen.FunctionEmitter.getInterfaceName.

Annotations
@Override
getNativeImplMethodNameback to summary
protected String getNativeImplMethodName()
getNativeNameback to summary
public String getNativeName()

Implements abstract com.jogamp.gluegen.FunctionEmitter.getNativeName.

Annotations
@Override
getReturnedArrayLengthCommentback to summary
protected String getReturnedArrayLengthComment()
getReturnedArrayLengthExpressionback to summary
protected String getReturnedArrayLengthExpression()
getReturnTypeStringback to summary
protected String getReturnTypeString(final boolean skipArray)
getRuntimeExceptionTypeback to summary
public String getRuntimeExceptionType()

The type of exception (must subclass java.lang.RuntimeException) raised if runtime checks fail in the generated code.

getUnsupportedExceptionTypeback to summary
public String getUnsupportedExceptionType()
isForDirectBufferImplementationback to summary
public boolean isForDirectBufferImplementation()
isForIndirectBufferAndArrayImplementationback to summary
public boolean isForIndirectBufferAndArrayImplementation()
isNativeMethodback to summary
public boolean isNativeMethod()
isNIOArgNameback to summary
protected String isNIOArgName(final int i)
isNIOArgNameback to summary
protected String isNIOArgName(final String s)
isPrivateNativeMethodback to summary
public boolean isPrivateNativeMethod()
javaThisArgumentNameback to summary
public static String javaThisArgumentName()
offsetArgNameback to summary
protected String offsetArgName(final int i)
setEmitBodyback to summary
public void setEmitBody(final boolean emitBody)

Accessor for subclasses.

setEpilogueback to summary
public void setEpilogue(final List<String> epilogue)

Sets the manually-generated epilogue code for this emitter.

setEraseBufferAndArrayTypesback to summary
public void setEraseBufferAndArrayTypes(final boolean erase)

Accessor for subclasses.

setForDirectBufferImplementationback to summary
public void setForDirectBufferImplementation(final boolean direct)

Accessor for subclasses.

setForIndirectBufferAndArrayImplementationback to summary
public void setForIndirectBufferAndArrayImplementation(final boolean indirect)

Accessor for subclasses.

setPrivateNativeMethodback to summary
public void setPrivateNativeMethod(final boolean v)

Accessor for subclasses.

setPrologueback to summary
public void setPrologue(final List<String> prologue)

Sets the manually-generated prologue code for this emitter.

setReturnedArrayLengthExpressionback to summary
public void setReturnedArrayLengthExpression(final 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.

setReturnedArrayLengthExpressionback to summary
protected void setReturnedArrayLengthExpression(final String expr, final boolean onlyForComments)
signatureOnlyback to summary
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.

com.jogamp.gluegen back to summary

protected Class JavaMethodBindingEmitter.DefaultCommentEmitter

extends Object
implements CommentEmitter
Class Inheritance
  • java.lang.Object
  • com.jogamp.gluegen.JavaMethodBindingEmitter.DefaultCommentEmitter
All Implemented Interfaces
com.jogamp.gluegen.CommentEmitter
Known Direct Subclasses
com.jogamp.gluegen.JavaMethodBindingEmitter.InterfaceCommentEmitter, com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter.WrappedMethodCommentEmitter

Class 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.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
emit(final FunctionEmitter emitter, final PrintWriter writer)

Implements com.jogamp.gluegen.CommentEmitter.emit.

Emit the body of a comment for the specified function; do NOT emit the open (e.g., comment "/*") or close (e.g., "*\/") characters.
protected void
protected StringBuilder
protected void
emitBeginning(final FunctionEmitter emitter, final PrintWriter writer)

protected void
emitBindingCSignature(final MethodBinding binding, final PrintWriter writer)

protected void
emitEnding(final FunctionEmitter emitter, final PrintWriter writer)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultCommentEmitterback to summary
protected DefaultCommentEmitter()

Method Detail

emitback to summary
public void emit(final FunctionEmitter emitter, final PrintWriter writer)

Implements com.jogamp.gluegen.CommentEmitter.emit.

Doc from com.jogamp.gluegen.CommentEmitter.emit.

Emit the body of a comment for the specified function; do NOT emit the open (e.g., comment "/*") or close (e.g., "*\/") characters.

Annotations
@Override
emitAliasedDocNamesCommentback to summary
protected void emitAliasedDocNamesComment(final AliasedSymbol sym, final PrintWriter writer)
emitAliasedDocNamesCommentback to summary
protected StringBuilder emitAliasedDocNamesComment(final AliasedSymbol sym, final StringBuilder sb)
emitBeginningback to summary
protected void emitBeginning(final FunctionEmitter emitter, final PrintWriter writer)
emitBindingCSignatureback to summary
protected void emitBindingCSignature(final MethodBinding binding, final PrintWriter writer)
emitEndingback to summary
protected void emitEnding(final FunctionEmitter emitter, final PrintWriter writer)
com.jogamp.gluegen back to summary

protected Class JavaMethodBindingEmitter.InterfaceCommentEmitter

extends DefaultCommentEmitter
Class Inheritance

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
Inherited from com.jogamp.gluegen.JavaMethodBindingEmitter.DefaultCommentEmitter:
emitemitAliasedDocNamesCommentemitAliasedDocNamesCommentemitBindingCSignatureemitEnding

Constructor Detail

InterfaceCommentEmitterback to summary
protected InterfaceCommentEmitter()

Method Detail

emitBeginningback to summary
protected void emitBeginning(final FunctionEmitter emitter, final PrintWriter writer)

Overrides com.jogamp.gluegen.JavaMethodBindingEmitter.DefaultCommentEmitter.emitBeginning.

Annotations
@Override