Skip to content

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

Merged
caguero merged 3 commits intogazebosim:gz-math7from
ms-jagadeeshan:gz-math7
Mar 22, 2024
Merged

Expose non-const reference to edges in Graph.hh#580
caguero merged 3 commits intogazebosim:gz-math7from
ms-jagadeeshan:gz-math7

Conversation

@ms-jagadeeshan
Copy link
Copy Markdown
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.

Signed-off-by: Jagadeeshan S <jagadeeshanmsj@gmail.com>
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Feb 22, 2024
Copy link
Copy Markdown
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.

@codecov
Copy link
Copy Markdown

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 <jagadeeshanmsj@gmail.com>
@ms-jagadeeshan
Copy link
Copy Markdown
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
Copy Markdown
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
@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