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

Fix const-correctness of the Model::JointByName and Model::LinkByName APIs #2059

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions include/gz/sim/Model.hh
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,16 @@ namespace gz
/// \param[in] _ecm Entity-component manager.
/// \param[in] _name Joint name.
/// \return Joint entity.
/// \todo(anyone) Make const
public: sim::Entity JointByName(const EntityComponentManager &_ecm,
const std::string &_name);
const std::string &_name) const;

/// \brief Get the ID of a link entity which is an immediate child of
/// this model.
/// \param[in] _ecm Entity-component manager.
/// \param[in] _name Link name.
/// \return Link entity.
/// \todo(anyone) Make const
public: sim::Entity LinkByName(const EntityComponentManager &_ecm,
const std::string &_name);
const std::string &_name) const;

/// \brief Get all joints which are immediate children of this model.
/// \param[in] _ecm Entity-component manager.
Expand Down
4 changes: 2 additions & 2 deletions src/Model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ std::string Model::SourceFilePath(const EntityComponentManager &_ecm) const

//////////////////////////////////////////////////
Entity Model::JointByName(const EntityComponentManager &_ecm,
const std::string &_name)
const std::string &_name) const
{
return _ecm.EntityByComponents(
components::ParentEntity(this->dataPtr->id),
Expand All @@ -140,7 +140,7 @@ Entity Model::JointByName(const EntityComponentManager &_ecm,

//////////////////////////////////////////////////
Entity Model::LinkByName(const EntityComponentManager &_ecm,
const std::string &_name)
const std::string &_name) const
{
return _ecm.EntityByComponents(
components::ParentEntity(this->dataPtr->id),
Expand Down
Loading