Class Generator
java.lang.Object
org.bytedeco.javacpp.tools.Generator
The 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum(package private) static enum(package private) static enum(package private) static enum(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) Map<Method, MethodInformation> (package private) IndexedSet<Class> (package private) IndexedSet<Class> (package private) final String(package private) IndexedSet<Class> (package private) IndexedSet<Class> (package private) static final String(package private) PrintWriter(package private) final Logger(package private) boolean(package private) PrintWriter(package private) PrintWriter(package private) boolean(package private) final Properties(package private) PrintWriter(package private) boolean -
Constructor Summary
ConstructorsConstructorDescriptionGenerator(Logger logger, Properties properties) Generator(Logger logger, Properties properties, String encoding) -
Method Summary
Modifier and TypeMethodDescription(package private) AdapterInformationadapterInformation(boolean out, String valueTypeName, Annotation... annotations) (package private) AdapterInformationadapterInformation(boolean out, MethodInformation methodInfo, int j) (package private) static Allocator(package private) static intallocatorMax(Class<?> cls, Method method) (package private) static booleanasUtf16(Annotation[] annotations) (package private) static booleanasUtf16(MethodInformation methodInfo, int j) (package private) Annotationbehavior(Annotation... annotations) (package private) Annotationby(Annotation... annotations) (package private) Annotationby(MethodInformation methodInfo, int j) (package private) voidcall(MethodInformation methodInfo, String returnPrefix, boolean secondCall) (package private) voidcallback(Class<?> cls, Method callbackMethod, String callbackName, int allocatorMax, boolean needDefinition, MethodInformation methodInfo) (package private) voidcallbackAllocator(Class<?> cls, String callbackName, int allocatorMax) (package private) Stringcast(Class<?> type, Annotation... annotations) (package private) Stringcast(MethodInformation methodInfo, int j) (package private) booleanclasses(boolean handleExceptions, boolean defineAdapters, boolean convertStrings, boolean declareEnums, String loadSuffix, String baseLoadSuffix, String classPath, Class<?>... classes) (package private) static booleanconstFunction(Class<?> classType, Method functionMethod) (package private) static StringconstValueTypeName(String... typeName) (package private) String[]cppAnnotationTypeName(Class<?> type, Annotation... annotations) (package private) String[]cppCastTypeName(Class<?> type, Annotation... annotations) (package private) String[]cppFunctionTypeName(Method... functionMethods) (package private) static StringcppScopeName(Class<?> type) (package private) static StringcppScopeName(MethodInformation methodInfo) (package private) String[]cppTypeName(Class<?> type) (package private) String[]cppTypeName(Class<?> type, Annotation[] annotations) (package private) String[]cppTypeName(MethodInformation methodInfo, int j) (package private) static StringcreateString(String ptr, String adapter, boolean asUtf16) (package private) static booleancriticalRegion(Class<?> cls, Method method) (package private) StringenumValueType(Class<?> type) (package private) static StringfunctionClassName(Class<?> cls) (package private) static Method[]functionMethods(Class<?> cls, boolean[] callbackAllocators) booleangenerate(String sourceFilename, String jniConfigFilename, String reflectConfigFilename, String headerFilename, String loadSuffix, String baseLoadSuffix, String classPath, Class<?>... classes) (package private) static StringgetStringData(String str, boolean asUtf16) (package private) static StringjniTypeName(Class type) (package private) static String(package private) MethodInformationmethodInformation(Method method) (package private) boolean(package private) static booleannoexceptFunction(Class<?> classType, Method functionMethod) (package private) static booleannoException(Class<?> cls, Method method) (package private) voidparametersAfter(MethodInformation methodInfo) (package private) voidparametersBefore(MethodInformation methodInfo) (package private) static StringreleaseStringData(String str, String ptr, boolean asUtf16) (package private) voidreturnAfter(MethodInformation methodInfo) (package private) StringreturnBefore(MethodInformation methodInfo) (package private) static String(package private) static StringvalueTypeName(String... typeName)
-
Field Details
-
JNI_VERSION
- See Also:
-
baseClasses
-
logger
-
properties
-
encoding
-
out
PrintWriter out -
out2
PrintWriter out2 -
jniConfigOut
PrintWriter jniConfigOut -
reflectConfigOut
PrintWriter reflectConfigOut -
callbacks
-
functions
IndexedSet<Class> functions -
deallocators
IndexedSet<Class> deallocators -
arrayDeallocators
IndexedSet<Class> arrayDeallocators -
jclasses
IndexedSet<Class> jclasses -
members
-
virtualFunctions
-
virtualMembers
-
annotationCache
Map<Method, MethodInformation> annotationCache -
mayThrowExceptions
boolean mayThrowExceptions -
usesAdapters
boolean usesAdapters -
passesStrings
boolean passesStrings -
accessesEnums
boolean accessesEnums
-
-
Constructor Details
-
Generator
-
Generator
-
-
Method Details
-
generate
public boolean generate(String sourceFilename, String jniConfigFilename, String reflectConfigFilename, String headerFilename, String loadSuffix, String baseLoadSuffix, String classPath, Class<?>... classes) throws IOException - Throws:
IOException
-
classes
-
methods
-
parametersBefore
-
returnBefore
-
call
-
returnAfter
-
parametersAfter
-
callback
void callback(Class<?> cls, Method callbackMethod, String callbackName, int allocatorMax, boolean needDefinition, MethodInformation methodInfo) -
callbackAllocator
-
functionClassName
-
functionMethods
-
methodInformation
-
allocatorMax
-
allocator
-
criticalRegion
-
noException
-
adapterInformation
-
adapterInformation
-
cast
-
cast
-
by
-
by
-
behavior
-
enumValueType
-
asUtf16
-
asUtf16
-
createString
-
getStringData
-
releaseStringData
-
constValueTypeName
-
valueTypeName
-
constFunction
-
noexceptFunction
-
cppAnnotationTypeName
-
cppCastTypeName
-
cppTypeName
-
cppTypeName
-
cppTypeName
-
cppFunctionTypeName
-
cppScopeName
-
cppScopeName
-
jniTypeName
-
signature
-
mangle
-