Code Generation#597
Conversation
Current coverage is 55.09% (diff: 0.00%)@@ master #597 diff @@
==========================================
Files 198 209 +11
Lines 6282 6663 +381
Methods 0 0
Messages 0 0
Branches 569 646 +77
==========================================
- Hits 3673 3671 -2
- Misses 2442 2824 +382
- Partials 167 168 +1
|
|
I would put the Velocity templates into language-specific directories (e.g. What's with all the What's with the weird function names? (e.g.
Why did you remove two UI tests from version control? And please, please, add some documentation. I'll add more comments after I checkout this PR and play around with it. |
| @@ -0,0 +1,8 @@ | |||
| public static void Switch(boolean sw, Object onTrue,Object onFalse, Object output){ | |||
There was a problem hiding this comment.
This method won't actually do anything. You're just reassigning a local reference.
Why not something like
public static <T> T Switch(boolean sw, T onTrue, T onFalse) {
return sw ? onTrue : onFalse;
}
There was a problem hiding this comment.
I didn't write this one and we also know that Switch currently doesn't work.
|
@SamCarlberg The reason behind MutableOf is it follows OpenCV's own convention. Further otherwise we would need to create several objects that did not exist before and fight with the TPipeline trying to make it recognize a new object. |
Also made switch work.
…alve, and FindBlobs.
…ameraTest.java file.
Also made switch work.
| * | ||
| * <P>Make sure to set all sources using the setters before running processImage(). | ||
| * | ||
| * <P>Tutorials and examples can be found online |
|
Edit: this has all been addressed in 11f967c Breaks when using publishing operations. Publishing operations should be ignored from generation and the user should be alerted. Edit: just saw you addressed this in the meeting. Also, the generated method names could be a lot nicer.
Getters for the outputs should be styled like
If an operation has multiple outputs (eg |
|
Generated code that uses Switch will fail if the inputs are not both |
Variables and methods no longer have numbers if there's only one of that operation, or if an operation only has one output. Operations with multiple outputs have the outputs named the same as on the socket (instead of just 'output0', 'output1', ...) Rename `MutableOf` to `Ref` because it's really just holding a reference and it's used similarly to output parameters in C/C++
Don't try to generate code for network operations and improve generated variable and method names
Add alert when trying to generate code for a pipeline with non-exportable operations
Fix code gen directory name not matching package name
| } | ||
|
|
||
| @Override | ||
| public String getterName(String name) { |
There was a problem hiding this comment.
Should be "get" + WordUtils.capitalize(name(name)), otherwise you'll get stuff like "getblobsOutput" instead of "getBlobsOutput"
| } | ||
|
|
||
| @Override | ||
| public String setterName(String name) { |
There was a problem hiding this comment.
Should be "set" + WordUtils.capitalize(name(name)) (see comment for getterName)
| } | ||
|
|
||
| @Override | ||
| public String getterName(String name) { |
| } | ||
|
|
||
| @Override | ||
| public String setterName(String name) { |
| } | ||
|
|
||
| @Override | ||
| public String getterName(String name) { |
| } | ||
|
|
||
| @Override | ||
| public String setterName(String name) { |
There was a problem hiding this comment.
See comment on CppTMethods. Will this cause a naming conflict?
| @Override | ||
| public Object getOutput(String name, GenType type) { | ||
| String newName = name.toLowerCase().replaceAll("_", ""); | ||
| String newName = tMeth.getterName(name); |
There was a problem hiding this comment.
I feel like it would make more sense to pass in the actual name instead of having to use the intermediate format that would then get transformed.
Calling
getOutput("convexHullsOutput", ...)makes much more sense to me than
getOutput("Convex_Hulls_Output", ...)…en tests on Travis' OSX platform
Merge master branch
Enable code generation tests without needing to build OpenCV
@osulacam and myself are working on an extension to GRIP that generates code. Eventually it will generate code for the users choice of Java, C++ and Python. For now it only generates Java code.
The idea behind this is so that users do not have to run a jvm containing GRIP to get pipelines to run. Instead they would include this file in their code and call the processImage function to run the pipeline once.
As mentioned this is in progress and at this time is not finished enough to be merged into GRIP.
Things to do: