nasa / fpp

F Prime Prime: A modeling language for F Prime
https://fprime.jpl.nasa.gov
Apache License 2.0
41 stars 31 forks source link

Improve C++ code generation for strings #423

Closed bocchino closed 1 month ago

bocchino commented 2 months ago

After discussion, we have reverted to the strategy described in #406.

  1. Switch as much as possible to using const Fw::StringBase& in the interface.
  2. Where a string implementation is needed, use Fw::ExternalString. Eliminate per-use auto-generated string classes.
  3. Avoid snprintf into a temporary buffer followed by assignment into a string. Instead, format into the string.
  4. Minimize reliance on implicit constructor calls.

Supersedes #406.

bocchino commented 2 months ago

The work described above is done on a branch. On an experimental branch I'm attempting to do what we said in #406 and eliminate the auto-generated string types. If that's feasible, then I'll update this issue.

bocchino commented 2 months ago

Auto-generated string types are now eliminated for ports and for arrays! On to structs.

bocchino commented 2 months ago

This is now done for structs!

bocchino commented 2 months ago

The branch of F Prime corresponding to this work is https://github.com/bocchino/fprime/tree/fpp-issue-423-string-code-gen.