Skip to content

Commit

Permalink
Merge pull request #3130 from SunBlack/modernize-use-using_segmentation
Browse files Browse the repository at this point in the history
Use using instead of typedef [segmentation]
  • Loading branch information
taketwo authored Jun 12, 2019
2 parents 560810b + a2e9515 commit cb92b7d
Show file tree
Hide file tree
Showing 29 changed files with 244 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace pcl
{
public:

typedef pcl::PointCloud <PointT> PointCloud;
using PointCloud = pcl::PointCloud<PointT>;

using PCLBase <PointT>::input_;
using PCLBase <PointT>::indices_;
Expand Down
10 changes: 5 additions & 5 deletions segmentation/include/pcl/segmentation/comparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ namespace pcl
class Comparator
{
public:
typedef pcl::PointCloud<PointT> PointCloud;
typedef typename PointCloud::Ptr PointCloudPtr;
typedef typename PointCloud::ConstPtr PointCloudConstPtr;
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

typedef boost::shared_ptr<Comparator<PointT> > Ptr;
typedef boost::shared_ptr<const Comparator<PointT> > ConstPtr;
using Ptr = boost::shared_ptr<Comparator<PointT> >;
using ConstPtr = boost::shared_ptr<const Comparator<PointT> >;

/** \brief Empty constructor for comparator. */
Comparator () : input_ ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@

namespace pcl
{
typedef std::vector<pcl::PointIndices> IndicesClusters;
typedef boost::shared_ptr<std::vector<pcl::PointIndices> > IndicesClustersPtr;
using IndicesClusters = std::vector<pcl::PointIndices>;
using IndicesClustersPtr = boost::shared_ptr<std::vector<pcl::PointIndices> >;

/** \brief @b ConditionalEuclideanClustering performs segmentation based on Euclidean distance and a user-defined clustering condition.
* \details The condition that need to hold is currently passed using a function pointer.
Expand Down Expand Up @@ -82,7 +82,7 @@ namespace pcl
class ConditionalEuclideanClustering : public PCLBase<PointT>
{
protected:
typedef typename pcl::search::Search<PointT>::Ptr SearcherPtr;
using SearcherPtr = typename pcl::search::Search<PointT>::Ptr;

using PCLBase<PointT>::input_;
using PCLBase<PointT>::indices_;
Expand Down
14 changes: 7 additions & 7 deletions segmentation/include/pcl/segmentation/cpc_segmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ namespace pcl
template <typename PointT>
class CPCSegmentation : public LCCPSegmentation<PointT>
{
typedef PointXYZINormal WeightSACPointType;
typedef LCCPSegmentation<PointT> LCCP;
using WeightSACPointType = PointXYZINormal;
using LCCP = LCCPSegmentation<PointT>;
// LCCP typedefs
typedef typename LCCP::EdgeID EdgeID;
typedef typename LCCP::EdgeIterator EdgeIterator;
using EdgeID = typename LCCP::EdgeID;
using EdgeIterator = typename LCCP::EdgeIterator;
// LCCP methods
using LCCP::calculateConvexConnections;
using LCCP::applyKconvexity;
Expand Down Expand Up @@ -174,11 +174,11 @@ namespace pcl

class WeightedRandomSampleConsensus : public SampleConsensus<WeightSACPointType>
{
typedef SampleConsensusModel<WeightSACPointType>::Ptr SampleConsensusModelPtr;
using SampleConsensusModelPtr = SampleConsensusModel<WeightSACPointType>::Ptr;

public:
typedef boost::shared_ptr<WeightedRandomSampleConsensus> Ptr;
typedef boost::shared_ptr<const WeightedRandomSampleConsensus> ConstPtr;
using Ptr = boost::shared_ptr<WeightedRandomSampleConsensus>;
using ConstPtr = boost::shared_ptr<const WeightedRandomSampleConsensus>;

/** \brief WeightedRandomSampleConsensus (Weighted RAndom SAmple Consensus) main constructor
* \param[in] model a Sample Consensus model
Expand Down
2 changes: 1 addition & 1 deletion segmentation/include/pcl/segmentation/crf_segmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace pcl
{
public:

//typedef boost::shared_ptr<std::vector<int> > pcl::IndicesPtr;
//using pcl::IndicesPtr = boost::shared_ptr<std::vector<int> >;


/** \brief Constructor that sets default values for member variables. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ namespace pcl
class EdgeAwarePlaneComparator: public PlaneCoefficientComparator<PointT, PointNT>
{
public:
typedef typename Comparator<PointT>::PointCloud PointCloud;
typedef typename Comparator<PointT>::PointCloudConstPtr PointCloudConstPtr;
using PointCloud = typename Comparator<PointT>::PointCloud;
using PointCloudConstPtr = typename Comparator<PointT>::PointCloudConstPtr;

typedef pcl::PointCloud<PointNT> PointCloudN;
typedef typename PointCloudN::Ptr PointCloudNPtr;
typedef typename PointCloudN::ConstPtr PointCloudNConstPtr;
using PointCloudN = pcl::PointCloud<PointNT>;
using PointCloudNPtr = typename PointCloudN::Ptr;
using PointCloudNConstPtr = typename PointCloudN::ConstPtr;

typedef boost::shared_ptr<EdgeAwarePlaneComparator<PointT, PointNT> > Ptr;
typedef boost::shared_ptr<const EdgeAwarePlaneComparator<PointT, PointNT> > ConstPtr;
using Ptr = boost::shared_ptr<EdgeAwarePlaneComparator<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const EdgeAwarePlaneComparator<PointT, PointNT> >;

using pcl::PlaneCoefficientComparator<PointT, PointNT>::input_;
using pcl::PlaneCoefficientComparator<PointT, PointNT>::normals_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ namespace pcl
using typename Comparator<PointT>::PointCloud;
using typename Comparator<PointT>::PointCloudConstPtr;

typedef pcl::PointCloud<PointLT> PointCloudL;
typedef typename PointCloudL::Ptr PointCloudLPtr;
typedef typename PointCloudL::ConstPtr PointCloudLConstPtr;
using PointCloudL = pcl::PointCloud<PointLT>;
using PointCloudLPtr = typename PointCloudL::Ptr;
using PointCloudLConstPtr = typename PointCloudL::ConstPtr;

typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointLT> > Ptr;
typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointLT> > ConstPtr;
using Ptr = boost::shared_ptr<EuclideanClusterComparator<PointT, PointLT> >;
using ConstPtr = boost::shared_ptr<const EuclideanClusterComparator<PointT, PointLT> >;

typedef std::set<uint32_t> ExcludeLabelSet;
typedef boost::shared_ptr<ExcludeLabelSet> ExcludeLabelSetPtr;
typedef boost::shared_ptr<const ExcludeLabelSet> ExcludeLabelSetConstPtr;
using ExcludeLabelSet = std::set<uint32_t>;
using ExcludeLabelSetPtr = boost::shared_ptr<ExcludeLabelSet>;
using ExcludeLabelSetConstPtr = boost::shared_ptr<const ExcludeLabelSet>;

/** \brief Default constructor for EuclideanClusterComparator. */
EuclideanClusterComparator ()
Expand Down Expand Up @@ -200,12 +200,12 @@ namespace pcl

public:

typedef pcl::PointCloud<PointNT> PointCloudN;
typedef typename PointCloudN::Ptr PointCloudNPtr;
typedef typename PointCloudN::ConstPtr PointCloudNConstPtr;
using PointCloudN = pcl::PointCloud<PointNT>;
using PointCloudNPtr = typename PointCloudN::Ptr;
using PointCloudNConstPtr = typename PointCloudN::ConstPtr;

typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointNT, PointLT> > Ptr;
typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointNT, PointLT> > ConstPtr;
using Ptr = boost::shared_ptr<EuclideanClusterComparator<PointT, PointNT, PointLT> >;
using ConstPtr = boost::shared_ptr<const EuclideanClusterComparator<PointT, PointNT, PointLT> >;

using experimental::EuclideanClusterComparator<PointT, PointLT>::setExcludeLabels;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ namespace pcl
class EuclideanPlaneCoefficientComparator: public PlaneCoefficientComparator<PointT, PointNT>
{
public:
typedef typename Comparator<PointT>::PointCloud PointCloud;
typedef typename Comparator<PointT>::PointCloudConstPtr PointCloudConstPtr;
typedef pcl::PointCloud<PointNT> PointCloudN;
typedef typename PointCloudN::Ptr PointCloudNPtr;
typedef typename PointCloudN::ConstPtr PointCloudNConstPtr;
using PointCloud = typename Comparator<PointT>::PointCloud;
using PointCloudConstPtr = typename Comparator<PointT>::PointCloudConstPtr;
using PointCloudN = pcl::PointCloud<PointNT>;
using PointCloudNPtr = typename PointCloudN::Ptr;
using PointCloudNConstPtr = typename PointCloudN::ConstPtr;

typedef boost::shared_ptr<EuclideanPlaneCoefficientComparator<PointT, PointNT> > Ptr;
typedef boost::shared_ptr<const EuclideanPlaneCoefficientComparator<PointT, PointNT> > ConstPtr;
using Ptr = boost::shared_ptr<EuclideanPlaneCoefficientComparator<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const EuclideanPlaneCoefficientComparator<PointT, PointNT> >;

using pcl::Comparator<PointT>::input_;
using pcl::PlaneCoefficientComparator<PointT, PointNT>::normals_;
Expand Down
16 changes: 8 additions & 8 deletions segmentation/include/pcl/segmentation/extract_clusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,18 @@ namespace pcl
template <typename PointT>
class EuclideanClusterExtraction: public PCLBase<PointT>
{
typedef PCLBase<PointT> BasePCLBase;
using BasePCLBase = PCLBase<PointT>;

public:
typedef pcl::PointCloud<PointT> PointCloud;
typedef typename PointCloud::Ptr PointCloudPtr;
typedef typename PointCloud::ConstPtr PointCloudConstPtr;
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

typedef pcl::search::Search<PointT> KdTree;
typedef typename KdTree::Ptr KdTreePtr;
using KdTree = pcl::search::Search<PointT>;
using KdTreePtr = typename KdTree::Ptr;

typedef PointIndices::Ptr PointIndicesPtr;
typedef PointIndices::ConstPtr PointIndicesConstPtr;
using PointIndicesPtr = PointIndices::Ptr;
using PointIndicesConstPtr = PointIndices::ConstPtr;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Empty constructor. */
Expand Down
16 changes: 8 additions & 8 deletions segmentation/include/pcl/segmentation/extract_labeled_clusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ namespace pcl
template <typename PointT>
class LabeledEuclideanClusterExtraction: public PCLBase<PointT>
{
typedef PCLBase<PointT> BasePCLBase;
using BasePCLBase = PCLBase<PointT>;

public:
typedef pcl::PointCloud<PointT> PointCloud;
typedef typename PointCloud::Ptr PointCloudPtr;
typedef typename PointCloud::ConstPtr PointCloudConstPtr;
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

typedef pcl::search::Search<PointT> KdTree;
typedef typename KdTree::Ptr KdTreePtr;
using KdTree = pcl::search::Search<PointT>;
using KdTreePtr = typename KdTree::Ptr;

typedef PointIndices::Ptr PointIndicesPtr;
typedef PointIndices::ConstPtr PointIndicesConstPtr;
using PointIndicesPtr = PointIndices::Ptr;
using PointIndicesConstPtr = PointIndices::ConstPtr;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Empty constructor. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ namespace pcl
using PCLBase<PointT>::deinitCompute;

public:
typedef pcl::PointCloud<PointT> PointCloud;
typedef typename PointCloud::Ptr PointCloudPtr;
typedef typename PointCloud::ConstPtr PointCloudConstPtr;
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

typedef PointIndices::Ptr PointIndicesPtr;
typedef PointIndices::ConstPtr PointIndicesConstPtr;
using PointIndicesPtr = PointIndices::Ptr;
using PointIndicesConstPtr = PointIndices::ConstPtr;

/** \brief Empty constructor. */
ExtractPolygonalPrismData () : planar_hull_ (), min_pts_hull_ (3),
Expand Down
22 changes: 11 additions & 11 deletions segmentation/include/pcl/segmentation/grabcut_segmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ namespace pcl
class PCL_EXPORTS BoykovKolmogorov
{
public:
typedef int vertex_descriptor;
typedef double edge_capacity_type;
using vertex_descriptor = int;
using edge_capacity_type = double;

/// construct a maxflow/mincut problem with estimated max_nodes
BoykovKolmogorov (std::size_t max_nodes = 0);
Expand Down Expand Up @@ -113,11 +113,11 @@ namespace pcl

protected:
/// tree states
typedef enum { FREE = 0x00, SOURCE = 0x01, TARGET = 0x02 } nodestate;
enum nodestate { FREE = 0x00, SOURCE = 0x01, TARGET = 0x02 };
/// capacitated edge
typedef std::map<int, double> capacitated_edge;
using capacitated_edge = std::map<int, double>;
/// edge pair
typedef std::pair<capacitated_edge::iterator, capacitated_edge::iterator> edge_pair;
using edge_pair = std::pair<capacitated_edge::iterator, capacitated_edge::iterator>;
/// pre-augment s-u-t and s-u-v-t paths
void
preAugmentPaths ();
Expand Down Expand Up @@ -184,7 +184,7 @@ namespace pcl
float r, g, b;
};
/// An Image is a point cloud of Color
typedef pcl::PointCloud<Color> Image;
using Image = pcl::PointCloud<Color>;
/** \brief Compute squared distance between two colors
* \param[in] c1 first color
* \param[in] c2 second color
Expand Down Expand Up @@ -317,10 +317,10 @@ namespace pcl
class GrabCut : public pcl::PCLBase<PointT>
{
public:
typedef pcl::search::Search<PointT> KdTree;
typedef typename KdTree::Ptr KdTreePtr;
typedef typename PCLBase<PointT>::PointCloudConstPtr PointCloudConstPtr;
typedef typename PCLBase<PointT>::PointCloudPtr PointCloudPtr;
using KdTree = pcl::search::Search<PointT>;
using KdTreePtr = typename KdTree::Ptr;
using PointCloudConstPtr = typename PCLBase<PointT>::PointCloudConstPtr;
using PointCloudPtr = typename PCLBase<PointT>::PointCloudPtr;
using PCLBase<PointT>::input_;
using PCLBase<PointT>::indices_;
using PCLBase<PointT>::fake_indices_;
Expand Down Expand Up @@ -405,7 +405,7 @@ namespace pcl
};
bool
initCompute ();
typedef pcl::segmentation::grabcut::BoykovKolmogorov::vertex_descriptor vertex_descriptor;
using vertex_descriptor = pcl::segmentation::grabcut::BoykovKolmogorov::vertex_descriptor;
/// Compute beta from image
void
computeBetaOrganized ();
Expand Down
14 changes: 7 additions & 7 deletions segmentation/include/pcl/segmentation/ground_plane_comparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ namespace pcl
class GroundPlaneComparator: public Comparator<PointT>
{
public:
typedef typename Comparator<PointT>::PointCloud PointCloud;
typedef typename Comparator<PointT>::PointCloudConstPtr PointCloudConstPtr;
using PointCloud = typename Comparator<PointT>::PointCloud;
using PointCloudConstPtr = typename Comparator<PointT>::PointCloudConstPtr;

typedef pcl::PointCloud<PointNT> PointCloudN;
typedef typename PointCloudN::Ptr PointCloudNPtr;
typedef typename PointCloudN::ConstPtr PointCloudNConstPtr;
using PointCloudN = pcl::PointCloud<PointNT>;
using PointCloudNPtr = typename PointCloudN::Ptr;
using PointCloudNConstPtr = typename PointCloudN::ConstPtr;

typedef boost::shared_ptr<GroundPlaneComparator<PointT, PointNT> > Ptr;
typedef boost::shared_ptr<const GroundPlaneComparator<PointT, PointNT> > ConstPtr;
using Ptr = boost::shared_ptr<GroundPlaneComparator<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const GroundPlaneComparator<PointT, PointNT> >;

using pcl::Comparator<PointT>::input_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pcl::CPCSegmentation<PointT>::segment ()
template <typename PointT> void
pcl::CPCSegmentation<PointT>::applyCuttingPlane (uint32_t depth_levels_left)
{
typedef std::map<uint32_t, pcl::PointCloud<WeightSACPointType>::Ptr> SegLabel2ClusterMap;
using SegLabel2ClusterMap = std::map<uint32_t, pcl::PointCloud<WeightSACPointType>::Ptr>;

pcl::console::print_info ("Cutting at level %d (maximum %d)\n", max_cuts_ - depth_levels_left + 1, max_cuts_);
// stop if we reached the 0 level
Expand Down
Loading

0 comments on commit cb92b7d

Please sign in to comment.