Skip to content
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

[wpiutil] DataLog: Use codegen for entry types #7479

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spacey-sooty
Copy link
Contributor

TODO:

  • cpp

@spacey-sooty spacey-sooty requested review from PeterJohnson and a team as code owners December 3, 2024 02:43
@spacey-sooty spacey-sooty marked this pull request as draft December 3, 2024 02:43
@spacey-sooty spacey-sooty force-pushed the codegen-datalog-entries branch 4 times, most recently from 019ed88 to 44c1538 Compare December 3, 2024 06:18
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generation stuff should be in src/generate/main and src/generated/main to match what's already in wpimath and wpiutil.

Also eventually we should clean up the empty lines in the output, but I'm assuming that's just because this is still a draft.



def render_template(
template: Template, output_dir: Path, filename: str, ty: Dict[str, Any]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use type_ (or _type) instead of ty to be clearer about the meaning while still avoiding hiding the builtin type function?

render_template(java_template, java_root_path, entry_name, ty)


def main(argv):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per #7311, the argv argument should be removed and the no-args overload of parser.parse_args() should be used.

Comment on lines -123 to +128
* @return Last value, or null if none.
* @return Last value, or false if none.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to add a field to the json so that this doesn't get changed.

Comment on lines -11 to +15
/** The data type for integer array values. */
/** The data type for int64[] values. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want another field so that there's less of these changes. (For most of the other ones, it wasn't that bad, but this one is especially unhelpful)

},
{
"name": "String",
"DataType": "String",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"DataType": "String",
"DataType": "string",

Comment on lines -12 to -23
/**
* Constructs a String log entry.
*
* @param log datalog
* @param name name of the entry
* @param metadata metadata
* @param type Data type
* @param timestamp entry creation timestamp (0=now)
*/
public StringLogEntry(DataLog log, String name, String metadata, String type, long timestamp) {
super(log, name, type, metadata, timestamp);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should figure out how to make the constructors match what was there previously.

Comment on lines -128 to +136
boolean m_hasLastValue;
double m_lastValue;
private boolean m_hasLastValue;


private double m_lastValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PeterJohnson Any reason these were package private before? (They were added in #6674)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it compiles cleanly, no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants