Skip to content

Use MOVEIT_CLASS_FORWARD for the last shared_ptrs to moveit types - #193

Merged
davetcoleman merged 3 commits into
moveit:kinetic-develfrom
fizyr-forks:shared_ptr_macro
Sep 8, 2016
Merged

davetcoleman merged 3 commits into
moveit:kinetic-develfrom
fizyr-forks:shared_ptr_macro

Conversation

@de-vri-es

Copy link
Copy Markdown
Contributor

This PR uses MOVEIT_CLASS_FORWARD (and friend) to remove the last explicit use of boost::shared_ptr to any moveit type in this repository, with the exception of moveit_experimental/* and the chomp and sbpl planners.

I looked for any remaining explicit shared_ptrs to moveit types with this pretty one-liner:

grep -rP 'boost::shared_ptr<(?!(?:const )?(?:tf::|srdf::|urdf::|rviz::|interactive_markers::|image_transport::|pluginlib::|ros::|KDL::|shapes::|actionlib::|QTimer|QSettings|QProgressDialog))'

{
public:
MOVEIT_DECLARE_PTR_MEMBER(VoxelGrid);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since VoxelGrid<T> is a class template, the only way to sensibly make shared_ptr typedefs available is as by declaring them as member types. I also had to add a MOVEIT_DECLARE_PTR_MEMBER macro for that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't really see a reason why we should not have just call the member type VoxelGridPtr instead of Ptr, but then I suppose it does not really matter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, VoxelGrid<T>::VoxelGridPtr is a bit long. VoxelGrid<T>::Ptr is also closer to the non-template case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@de-vri-es

Copy link
Copy Markdown
Contributor Author

Turns out moveit_ros/perception/mesh_filter/src/mesh_filter_base.cpp had a number of using declarations that obscured some results of the regex I used to look for shared_ptrs.

I removed all of them and switched to the appropriate shared_ptr typedefs. I'm not a big fan of using declarations as they were applied there.

return true;
}
typedef boost::shared_ptr<MoveItControllerManager> Ptr;
typedef MoveItControllerManagerPtr Ptr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a source file and no exposed interface. Wouldn't it make sense to get rid of the Ptr typedef here altogether?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. I was on autopilot here.

@v4hn

v4hn commented Sep 1, 2016

Copy link
Copy Markdown
Contributor

+1 looks good to me. This too should be picked to indigo/jade

@de-vri-es

Copy link
Copy Markdown
Contributor Author

Unneeded, unexposed typedef removed, as per line comments.

using shapes::Mesh;
using boost::shared_ptr;
using boost::unique_lock;
using boost::mutex;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@davetcoleman

Copy link
Copy Markdown
Member

+1 thanks for your continued effort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants