-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add property checker/metadata system #166
base: main
Are you sure you want to change the base?
Conversation
* include/ofx-props.yml is the property reference/metadata * scripts/gen-props.py is the checker and source generator All props are included in the YML definition, and the script generates C++ files with all the property metadata and suite assignments. Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
Also include them into prop tester plugin, to test whether they compile properly. TODO: prop tester should use the metadata to do better tests. Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That super! I see a lot of good thing here! Will be helpfull with time.
include/ofxPropsMetadata.h
Outdated
std::vector<const char *> values; // for enums | ||
}; | ||
|
||
const std::vector<struct PropsMetadata> props_metadata { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this it auto generated, you could consider std::array<struct PropsMetadata, N=FeedByScrip>
.
If this header is intended to be use more C++, you should consider having this std::array
as constexpr.
maybe:
#if defined(__cplusplus)
#define CONST_SPECIFIER constexpr
#else
#define CONST_SPECIFIER const
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @abizeauMaxon -- totally agreed. As per discussion at the TSC today, I've moved these into Support/include
and they are 100% C++. I used fixed-size std::array
s where possible, as well as some other updates and cleanups. More feedback will be helpful; let me know if you try it out.
include/ofxPropsMetadata.h
Outdated
int dimension; | ||
Writable writable; | ||
bool host_optional; | ||
std::vector<const char *> values; // for enums |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be consistant, if you use std::string
for name, you should also use std::vector<std::string>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried now to move to char *
, to avoid allocations where possible during startup. I should move to std::string_view
in some places. I'll do that.
include/ofxPropsBySet.h
Outdated
|
||
namespace OpenFX { | ||
// Properties for property sets | ||
const std::map<const char *, std::vector<const char *>> prop_sets { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, here you should consider consistency, pick std::string
or const char*
@@ -0,0 +1,1508 @@ | |||
######################################################################## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this auto generated? If so maybe add it into the header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ofx-props.yml
is hand-created -- it's now the source of truth for all info about properties and property sets. That's the lion's share of the work in this PR (and probably the source of remaining bugs, where I may have gotten some stuff wrong). None of this info was machine-readable before, so I extracted it from the docs and header file comments.
Signed-off-by: Gary Oberbrunner <[email protected]>
The strings are the true spec, not the #define names. This also adds a set of static_assert tests to ensure the #define names match their strings. But doing this brought up that there are some mismatches between the strings and their #defines. Those will be accounted for in a following commit. Signed-off-by: Gary Oberbrunner <[email protected]>
See `get_cname` and `find_stringname` in gen-props.py, and the new `cname` member of the props metadata. Signed-off-by: Gary Oberbrunner <[email protected]>
Replaced a vector with a std::array for reduced memory & startup time. Also add static_assert checks for all action names vs. their #defines. Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
Also separate out Actions from prop sets in ofx-props.yml, for cleanliness. Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
Signed-off-by: Gary Oberbrunner <[email protected]>
include/ofx-props.yml
is the property reference/metadatascripts/gen-props.py
is the checker and source generatorAll props are included in the YML definition, and the script generates C++ files with all the property metadata and suite assignments. The C++ files aren't yet checked in, but you can build them easily:
python scripts/gen-props.py -v
and then look ininclude/gen_*.hxx
.