symforce
symforce copied to clipboard
Add format_matrix_subscript_accessor and update_template_data to CodegenConfig
This review adds two small methods to CodegenConfig, with the intention of making it easier to support additional languages:
format_matrix_subscript_accessor, which formats the accessor for 2D matrices. This is required in some languages where thefoo(i, j)syntax is unavailable. In keeping w/ Hayk's comment onformat_data_accessor, I put a TODO suggesting this could potentially be moved into the code-printer itself.update_template_data, which allowsCodegenConfigsubclasses to pass additional fields or functions to the templating engine.
I think we'll need to remove the format_matrix_subscript_accessor change from here since it's a duplicate with #190 which makes the other required changes with matrix_is_1d and have this PR just make the update_template_data change