Package org.bytedeco.javacpp.tools
Class Generator
- java.lang.Object
-
- org.bytedeco.javacpp.tools.Generator
-
public class Generator extends java.lang.ObjectThe Generator is where all the C++ source code that we need gets generated. It has not been designed in any meaningful way since the requirements were not well understood. It is basically a prototype and is really quite a mess. Now that we understand better what we need, it could use some refactoring.When attempting to understand what the Generator does, try to run experiments and inspect the generated code: It is quite readable.
Moreover, although Generator is the one ultimately doing something with the various annotations it relies on, it was easier to describe the behavior its meant to have with them as part of the documentation of the annotations, so we can refer to them to understand more about how Generator should work:
- See Also:
Adapter,Allocator,ArrayAllocator,ByPtr,ByPtrPtr,ByPtrRef,ByRef,ByVal,Cast,Const,Convention,CriticalRegion,Function,Index,MemberGetter,MemberSetter,Name,Namespace,NoDeallocator,NoException,NoOffset,Opaque,Platform,Raw,ValueGetter,ValueSetter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classGenerator.BooleanEnum(package private) static classGenerator.ByteEnum(package private) static classGenerator.IntEnum(package private) static classGenerator.LongEnum(package private) static classGenerator.ShortEnum
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanaccessesEnums(package private) java.util.Map<java.lang.reflect.Method,MethodInformation>annotationCache(package private) IndexedSet<java.lang.Class>arrayDeallocators(package private) static java.util.List<java.lang.Class>baseClasses(package private) java.util.Map<java.lang.String,java.lang.String>callbacks(package private) IndexedSet<java.lang.Class>deallocators(package private) java.lang.Stringencoding(package private) IndexedSet<java.lang.Class>functions(package private) IndexedSet<java.lang.Class>jclasses(package private) static java.lang.StringJNI_VERSION(package private) java.io.PrintWriterjniConfigOut(package private) Loggerlogger(package private) booleanmayThrowExceptions(package private) java.util.Map<java.lang.Class,java.util.Set<java.lang.String>>members(package private) java.io.PrintWriterout(package private) java.io.PrintWriterout2(package private) booleanpassesStrings(package private) java.util.Propertiesproperties(package private) java.io.PrintWriterreflectConfigOut(package private) booleanusesAdapters(package private) java.util.Map<java.lang.Class,java.util.Set<java.lang.String>>virtualFunctions(package private) java.util.Map<java.lang.Class,java.util.Set<java.lang.String>>virtualMembers
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) AdapterInformationadapterInformation(boolean out, java.lang.String valueTypeName, java.lang.annotation.Annotation... annotations)(package private) AdapterInformationadapterInformation(boolean out, MethodInformation methodInfo, int j)(package private) static Allocatorallocator(java.lang.Class<?> cls, java.lang.reflect.Method method)(package private) static intallocatorMax(java.lang.Class<?> cls, java.lang.reflect.Method method)(package private) static booleanasUtf16(java.lang.annotation.Annotation[] annotations)(package private) static booleanasUtf16(MethodInformation methodInfo, int j)(package private) java.lang.annotation.Annotationbehavior(java.lang.annotation.Annotation... annotations)(package private) java.lang.annotation.Annotationby(java.lang.annotation.Annotation... annotations)(package private) java.lang.annotation.Annotationby(MethodInformation methodInfo, int j)(package private) voidcall(MethodInformation methodInfo, java.lang.String returnPrefix, boolean secondCall)(package private) voidcallback(java.lang.Class<?> cls, java.lang.reflect.Method callbackMethod, java.lang.String callbackName, int allocatorMax, boolean needDefinition, MethodInformation methodInfo)(package private) voidcallbackAllocator(java.lang.Class<?> cls, java.lang.String callbackName, int allocatorMax)(package private) java.lang.Stringcast(java.lang.Class<?> type, java.lang.annotation.Annotation... annotations)(package private) java.lang.Stringcast(MethodInformation methodInfo, int j)(package private) booleanclasses(boolean handleExceptions, boolean defineAdapters, boolean convertStrings, boolean declareEnums, java.lang.String loadSuffix, java.lang.String baseLoadSuffix, java.lang.String classPath, java.lang.Class<?>... classes)(package private) static booleanconstFunction(java.lang.Class<?> classType, java.lang.reflect.Method functionMethod)(package private) static java.lang.StringconstValueTypeName(java.lang.String... typeName)(package private) java.lang.String[]cppAnnotationTypeName(java.lang.Class<?> type, java.lang.annotation.Annotation... annotations)(package private) java.lang.String[]cppCastTypeName(java.lang.Class<?> type, java.lang.annotation.Annotation... annotations)(package private) java.lang.String[]cppFunctionTypeName(java.lang.reflect.Method... functionMethods)(package private) static java.lang.StringcppScopeName(java.lang.Class<?> type)(package private) static java.lang.StringcppScopeName(MethodInformation methodInfo)(package private) java.lang.String[]cppTypeName(java.lang.Class<?> type)(package private) java.lang.String[]cppTypeName(java.lang.Class<?> type, java.lang.annotation.Annotation[] annotations)(package private) java.lang.String[]cppTypeName(MethodInformation methodInfo, int j)(package private) static java.lang.StringcreateString(java.lang.String ptr, java.lang.String adapter, boolean asUtf16)(package private) static booleancriticalRegion(java.lang.Class<?> cls, java.lang.reflect.Method method)(package private) java.lang.StringenumValueType(java.lang.Class<?> type)(package private) static java.lang.StringfunctionClassName(java.lang.Class<?> cls)(package private) static java.lang.reflect.Method[]functionMethods(java.lang.Class<?> cls, boolean[] callbackAllocators)booleangenerate(java.lang.String sourceFilename, java.lang.String jniConfigFilename, java.lang.String reflectConfigFilename, java.lang.String headerFilename, java.lang.String loadSuffix, java.lang.String baseLoadSuffix, java.lang.String classPath, java.lang.Class<?>... classes)(package private) static java.lang.StringgetStringData(java.lang.String str, boolean asUtf16)(package private) static java.lang.StringjniTypeName(java.lang.Class type)(package private) static java.lang.Stringmangle(java.lang.String name)(package private) MethodInformationmethodInformation(java.lang.reflect.Method method)(package private) booleanmethods(java.lang.Class<?> cls)(package private) static booleannoexceptFunction(java.lang.Class<?> classType, java.lang.reflect.Method functionMethod)(package private) static booleannoException(java.lang.Class<?> cls, java.lang.reflect.Method method)(package private) voidparametersAfter(MethodInformation methodInfo)(package private) voidparametersBefore(MethodInformation methodInfo)(package private) static java.lang.StringreleaseStringData(java.lang.String str, java.lang.String ptr, boolean asUtf16)(package private) voidreturnAfter(MethodInformation methodInfo)(package private) java.lang.StringreturnBefore(MethodInformation methodInfo)(package private) static java.lang.Stringsignature(java.lang.Class... types)(package private) static java.lang.StringvalueTypeName(java.lang.String... typeName)
-
-
-
Field Detail
-
JNI_VERSION
static final java.lang.String JNI_VERSION
- See Also:
- Constant Field Values
-
baseClasses
static final java.util.List<java.lang.Class> baseClasses
-
logger
final Logger logger
-
properties
final java.util.Properties properties
-
encoding
final java.lang.String encoding
-
out
java.io.PrintWriter out
-
out2
java.io.PrintWriter out2
-
jniConfigOut
java.io.PrintWriter jniConfigOut
-
reflectConfigOut
java.io.PrintWriter reflectConfigOut
-
callbacks
java.util.Map<java.lang.String,java.lang.String> callbacks
-
functions
IndexedSet<java.lang.Class> functions
-
deallocators
IndexedSet<java.lang.Class> deallocators
-
arrayDeallocators
IndexedSet<java.lang.Class> arrayDeallocators
-
jclasses
IndexedSet<java.lang.Class> jclasses
-
members
java.util.Map<java.lang.Class,java.util.Set<java.lang.String>> members
-
virtualFunctions
java.util.Map<java.lang.Class,java.util.Set<java.lang.String>> virtualFunctions
-
virtualMembers
java.util.Map<java.lang.Class,java.util.Set<java.lang.String>> virtualMembers
-
annotationCache
java.util.Map<java.lang.reflect.Method,MethodInformation> annotationCache
-
mayThrowExceptions
boolean mayThrowExceptions
-
usesAdapters
boolean usesAdapters
-
passesStrings
boolean passesStrings
-
accessesEnums
boolean accessesEnums
-
-
Method Detail
-
generate
public boolean generate(java.lang.String sourceFilename, java.lang.String jniConfigFilename, java.lang.String reflectConfigFilename, java.lang.String headerFilename, java.lang.String loadSuffix, java.lang.String baseLoadSuffix, java.lang.String classPath, java.lang.Class<?>... classes) throws java.io.IOException- Throws:
java.io.IOException
-
classes
boolean classes(boolean handleExceptions, boolean defineAdapters, boolean convertStrings, boolean declareEnums, java.lang.String loadSuffix, java.lang.String baseLoadSuffix, java.lang.String classPath, java.lang.Class<?>... classes)
-
methods
boolean methods(java.lang.Class<?> cls)
-
parametersBefore
void parametersBefore(MethodInformation methodInfo)
-
returnBefore
java.lang.String returnBefore(MethodInformation methodInfo)
-
call
void call(MethodInformation methodInfo, java.lang.String returnPrefix, boolean secondCall)
-
returnAfter
void returnAfter(MethodInformation methodInfo)
-
parametersAfter
void parametersAfter(MethodInformation methodInfo)
-
callback
void callback(java.lang.Class<?> cls, java.lang.reflect.Method callbackMethod, java.lang.String callbackName, int allocatorMax, boolean needDefinition, MethodInformation methodInfo)
-
callbackAllocator
void callbackAllocator(java.lang.Class<?> cls, java.lang.String callbackName, int allocatorMax)
-
functionClassName
static java.lang.String functionClassName(java.lang.Class<?> cls)
-
functionMethods
static java.lang.reflect.Method[] functionMethods(java.lang.Class<?> cls, boolean[] callbackAllocators)
-
methodInformation
MethodInformation methodInformation(java.lang.reflect.Method method)
-
allocatorMax
static int allocatorMax(java.lang.Class<?> cls, java.lang.reflect.Method method)
-
allocator
static Allocator allocator(java.lang.Class<?> cls, java.lang.reflect.Method method)
-
criticalRegion
static boolean criticalRegion(java.lang.Class<?> cls, java.lang.reflect.Method method)
-
noException
static boolean noException(java.lang.Class<?> cls, java.lang.reflect.Method method)
-
adapterInformation
AdapterInformation adapterInformation(boolean out, MethodInformation methodInfo, int j)
-
adapterInformation
AdapterInformation adapterInformation(boolean out, java.lang.String valueTypeName, java.lang.annotation.Annotation... annotations)
-
cast
java.lang.String cast(MethodInformation methodInfo, int j)
-
cast
java.lang.String cast(java.lang.Class<?> type, java.lang.annotation.Annotation... annotations)
-
by
java.lang.annotation.Annotation by(MethodInformation methodInfo, int j)
-
by
java.lang.annotation.Annotation by(java.lang.annotation.Annotation... annotations)
-
behavior
java.lang.annotation.Annotation behavior(java.lang.annotation.Annotation... annotations)
-
enumValueType
java.lang.String enumValueType(java.lang.Class<?> type)
-
asUtf16
static boolean asUtf16(MethodInformation methodInfo, int j)
-
asUtf16
static boolean asUtf16(java.lang.annotation.Annotation[] annotations)
-
createString
static java.lang.String createString(java.lang.String ptr, java.lang.String adapter, boolean asUtf16)
-
getStringData
static java.lang.String getStringData(java.lang.String str, boolean asUtf16)
-
releaseStringData
static java.lang.String releaseStringData(java.lang.String str, java.lang.String ptr, boolean asUtf16)
-
constValueTypeName
static java.lang.String constValueTypeName(java.lang.String... typeName)
-
valueTypeName
static java.lang.String valueTypeName(java.lang.String... typeName)
-
constFunction
static boolean constFunction(java.lang.Class<?> classType, java.lang.reflect.Method functionMethod)
-
noexceptFunction
static boolean noexceptFunction(java.lang.Class<?> classType, java.lang.reflect.Method functionMethod)
-
cppAnnotationTypeName
java.lang.String[] cppAnnotationTypeName(java.lang.Class<?> type, java.lang.annotation.Annotation... annotations)
-
cppCastTypeName
java.lang.String[] cppCastTypeName(java.lang.Class<?> type, java.lang.annotation.Annotation... annotations)
-
cppTypeName
java.lang.String[] cppTypeName(MethodInformation methodInfo, int j)
-
cppTypeName
java.lang.String[] cppTypeName(java.lang.Class<?> type)
-
cppTypeName
java.lang.String[] cppTypeName(java.lang.Class<?> type, java.lang.annotation.Annotation[] annotations)
-
cppFunctionTypeName
java.lang.String[] cppFunctionTypeName(java.lang.reflect.Method... functionMethods)
-
cppScopeName
static java.lang.String cppScopeName(MethodInformation methodInfo)
-
cppScopeName
static java.lang.String cppScopeName(java.lang.Class<?> type)
-
jniTypeName
static java.lang.String jniTypeName(java.lang.Class type)
-
signature
static java.lang.String signature(java.lang.Class... types)
-
mangle
static java.lang.String mangle(java.lang.String name)
-
-