Skip to content

Commit

Permalink
Merge pull request #3726 from SergioRAgostinho/filters-interface
Browse files Browse the repository at this point in the history
Clean up `Filter` and `FilterIndices`, move `indices_`/`input_` from public to protected section
  • Loading branch information
SergioRAgostinho authored Mar 30, 2020
2 parents 232c46b + 5b5b002 commit e20e9a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 46 deletions.
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

0 comments on commit e20e9a5

Please sign in to comment.