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

Expose non-const reference to edges in Graph.hh #580

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

ms-jagadeeshan
Copy link
Contributor

🦟 Bug fix

Fixes #99

Summary

Issue: The Graph::VertexFromId function has two versions that return a const and non-const reference to a Vertex. However there is only a const version of the Graph::EdgeFromId function, which makes it hard to modify Edge Data()

Solution : Have added non-const(mutable) reference function for Graph::EdgeFromId .

Issue: Likewise, the Graph::AdjacentsTo and Graph::AdjacentsFrom functions return non-const references to the graph vertices, while the Graph::IncidentsTo and Graph::IncidentsFrom functions only return const references to the graph edges.

Solution: Removed the const from return type of Graph::IncidentsTo and Graph::IncidentsFrom functions.

Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

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

I think these changes break ABI (and API). We should retarget the patch to main.

Alternatively, we could add the functions that are missing without changing the existing ones.

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.11%. Comparing base (9f55592) to head (11caaf7).

Additional details and impacted files
@@            Coverage Diff            @@
##           gz-math7     #580   +/-   ##
=========================================
  Coverage     94.11%   94.11%           
=========================================
  Files           146      146           
  Lines          9804     9809    +5     
=========================================
+ Hits           9227     9232    +5     
  Misses          577      577           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Jagadeeshan S <[email protected]>
@ms-jagadeeshan
Copy link
Contributor Author

@caguero Thank you for the guiding.
I have reverted back the breaking change, now the change only contain the new function.
Also the second point mentioned in the original issue is not clear, see this #99 (comment)

@azeey azeey requested a review from caguero March 18, 2024 18:34
Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

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

The new function looks good to me.

@caguero caguero merged commit 91c73b9 into gazebosim:gz-math7 Mar 22, 2024
13 checks passed
@bperseghetti bperseghetti mentioned this pull request Jun 18, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Graph.hh doesn't expose non-const reference to Edges
2 participants