-
Notifications
You must be signed in to change notification settings - Fork 95
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
Added non-const accessors for Link child objects #838
Conversation
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Codecov Report
@@ Coverage Diff @@
## sdf12 #838 +/- ##
==========================================
+ Coverage 90.76% 90.80% +0.03%
==========================================
Files 78 78
Lines 12535 12555 +20
==========================================
+ Hits 11378 11400 +22
+ Misses 1157 1155 -2
Continue to review full report at Codecov.
|
src/Link.cc
Outdated
///////////////////////////////////////////////// | ||
Visual *Link::VisualByIndex(uint64_t _index) | ||
{ | ||
return const_cast<Visual*>(this->dataPtr->VisualByIndex(_index)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but we could avoid creating all the helper functions by keeping the implementation in the original const function (i.e Link::VisualByIndex() const
) and calling that from here via const_cast
: https://stackoverflow.com/a/123995/283225
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, the double cast. Done in 9ef6f94. I'll make similar changes to the other PRs.
Signed-off-by: Nate Koenig <nate@openrobotics.org>
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-04-13-fortress-edifice/1367/1 |
Signed-off-by: Nate Koenig nate@openrobotics.org
🎉 New feature
Summary
I need the ability to access mutable versions of child objects. This is part of my effort to support building and editing the SDF DOM programmatically. I've added private helper functions in order to reduce code duplication.
Test it
Run the tests.
Checklist
codecheck
passed (See contributing)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.