sdformat icon indicating copy to clipboard operation
sdformat copied to clipboard

Extract only one plugin with extraction operator

Open chapulina opened this issue 2 years ago • 4 comments

🦟 Bug fix

  • Follow up to https://github.com/gazebosim/sdformat/pull/858
  • Needed by https://github.com/gazebosim/gz-sim/pull/1404

Summary

Plugin's extraction operator was consuming the entire input stream, although it should only be taking the first <plugin> element.

This PR fixes the most basic use case, which requires the element to be exactly closed with </plugin>. I also didn't do a lot of sanity checking, like does it start with <plugin>, or is there a <plugin> nested inside another, etc. I feel like there must be a more reliable way of doing this, I'm all ears for ideas.

This operator is used on gz-sim to deserialize an sdf::Plugins object (i.e. std::vector<sdf::Plugin>), and the serialization is just concatenating them right now, using the VectorSerializer.

Checklist

  • [x] Signed all commits for DCO
  • [x] Added tests
  • [ ] Updated documentation (as needed)
  • [ ] Updated migration guide (as needed)
  • [ ] Consider updating Python bindings (if the library has them)
  • [x] codecheck passed (See contributing)
  • [x] All tests passed (See test coverage)
  • [x] While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

chapulina avatar May 18 '22 01:05 chapulina

Codecov Report

Merging #1021 (4f9b92a) into sdf12 (b59f6e1) will increase coverage by 0.02%. The diff coverage is 98.27%.

:exclamation: Current head 4f9b92a differs from pull request most recent head 6c2f54c. Consider uploading reports for the commit 6c2f54c to get more accurate results

@@            Coverage Diff             @@
##            sdf12    #1021      +/-   ##
==========================================
+ Coverage   91.28%   91.31%   +0.02%     
==========================================
  Files          80       80              
  Lines       13086    13127      +41     
==========================================
+ Hits        11946    11987      +41     
  Misses       1140     1140              
Impacted Files Coverage Δ
include/sdf/Plugin.hh 100.00% <ø> (+6.25%) :arrow_up:
src/Utils.hh 94.73% <ø> (ø)
src/Plugin.cc 99.19% <95.65%> (-0.81%) :arrow_down:
src/Utils.cc 88.50% <100.00%> (+2.43%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar May 18 '22 01:05 codecov[bot]

I improved the stream extraction operator, and added more tests. See 135e251

nkoenig avatar Jun 08 '22 21:06 nkoenig

Thanks for the updates, @nkoenig , LGTM. I just need an approval now.

chapulina avatar Jul 25 '22 16:07 chapulina

the API checker complaint is befuddling since SDFImpl.hh was not touched

  • https://build.osrfoundation.org/job/sdformat-abichecker-any_to_any-ubuntu_auto-amd64/2282/API_5fABI_20report/
Screen Shot 2022-07-27 at 4 56 21 PM

scpeters avatar Jul 27 '22 23:07 scpeters

Can we close this since https://github.com/gazebosim/gz-sim/pull/1404 was merged without needing this PR?

azeey avatar Oct 11 '22 23:10 azeey