sofa icon indicating copy to clipboard operation
sofa copied to clipboard

[Sofa.Core] minor refactoring for Data::read() to move into BaseData the reading code

Open damienmarchal opened this issue 2 years ago • 4 comments


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

damienmarchal avatar Sep 06 '22 22:09 damienmarchal

[ci-build][with-all-tests]

fredroy avatar Sep 06 '22 23:09 fredroy

Haha no surprise tests didn't worked :)

damienmarchal avatar Sep 07 '22 06:09 damienmarchal

Hi @alxbilger

Thanks for reviewing the PR. BaseData::read is an existing function in sofa, that do the reading from a stream into a data field.

The PR does not change only how it was implemented. Before the PR, Data::read is duplicated for every type of data stored in the data field while in most of the case the reading pattern is the same. With the PR the "shared" behavior is moved into the base class which allows to enforce a consistent behavior regarding error checking & resetting the value when the field to parse is empty.

damienmarchal avatar Oct 03 '22 10:10 damienmarchal

[ci-build][with-all-tests]

damienmarchal avatar Oct 03 '22 11:10 damienmarchal

Merged by mistake...reverted in emergency mode.

damienmarchal avatar Jul 24 '23 14:07 damienmarchal