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

Clean up Filter and FilterIndices, move indices_/input_ from public to protected section #3726

Merged
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
12 changes: 2 additions & 10 deletions common/include/pcl/pcl_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ namespace pcl
PCLBase (const PCLBase& base);

/** \brief Destructor. */
virtual ~PCLBase ()
{
input_.reset ();
indices_.reset ();
}
virtual ~PCLBase () = default;

/** \brief Provide a pointer to the input dataset
* \param[in] cloud the const boost shared pointer to a PointCloud message
Expand Down Expand Up @@ -197,11 +193,7 @@ namespace pcl
PCLBase ();

/** \brief destructor. */
virtual ~PCLBase()
{
input_.reset ();
indices_.reset ();
}
virtual ~PCLBase () = default;

/** \brief Provide a pointer to the input dataset
* \param cloud the const boost shared pointer to a PointCloud message
Expand Down
12 changes: 3 additions & 9 deletions filters/include/pcl/filters/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ namespace pcl
class Filter : public PCLBase<PointT>
{
public:
using PCLBase<PointT>::indices_;
using PCLBase<PointT>::input_;

using Ptr = shared_ptr<Filter<PointT> >;
using ConstPtr = shared_ptr<const Filter<PointT> >;

Expand All @@ -104,9 +101,6 @@ namespace pcl
{
}

/** \brief Empty destructor */
~Filter () {}

/** \brief Get the point indices being removed */
inline IndicesConstPtr const
getRemovedIndices () const
Expand Down Expand Up @@ -154,6 +148,9 @@ namespace pcl

protected:

using PCLBase<PointT>::indices_;
using PCLBase<PointT>::input_;

using PCLBase<PointT>::initCompute;
using PCLBase<PointT>::deinitCompute;

Expand Down Expand Up @@ -209,9 +206,6 @@ namespace pcl
{
}

/** \brief Empty destructor */
~Filter () {}

/** \brief Get the point indices being removed */
inline IndicesConstPtr const
getRemovedIndices () const
Expand Down
34 changes: 7 additions & 27 deletions filters/include/pcl/filters/filter_indices.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,19 @@ namespace pcl
* \param[in] extract_removed_indices Set to true if you want to be able to extract the indices of points being removed (default = false).
*/
FilterIndices (bool extract_removed_indices = false) :
negative_ (false),
keep_organized_ (false),
Filter<PointT> (extract_removed_indices),
negative_ (false),
keep_organized_ (false),
user_filter_value_ (std::numeric_limits<float>::quiet_NaN ())
{
extract_removed_indices_ = extract_removed_indices;
}

/** \brief Empty virtual destructor. */

~FilterIndices ()
{
}

inline void
filter (PointCloud &output)
{
pcl::Filter<PointT>::filter (output);
}
using Filter<PointT>::filter;

/** \brief Calls the filtering method and returns the filtered point cloud indices.
* \param[out] indices the resultant filtered point cloud indices
*/
inline void
void
filter (std::vector<int> &indices)
{
if (!initCompute ())
Expand Down Expand Up @@ -212,24 +202,14 @@ namespace pcl
* \param[in] extract_removed_indices Set to true if you want to extract the indices of points being removed (default = false).
*/
FilterIndices (bool extract_removed_indices = false) :
Filter<PCLPointCloud2> (extract_removed_indices),
negative_ (false),
keep_organized_ (false),
user_filter_value_ (std::numeric_limits<float>::quiet_NaN ())
{
extract_removed_indices_ = extract_removed_indices;
}

/** \brief Empty virtual destructor. */

~FilterIndices ()
{
}

virtual void
filter (PCLPointCloud2 &output)
{
pcl::Filter<PCLPointCloud2>::filter (output);
}
using Filter<PCLPointCloud2>::filter;

/** \brief Calls the filtering method and returns the filtered point cloud indices.
* \param[out] indices the resultant filtered point cloud indices
Expand Down