Skip to content

Commit

Permalink
Changes are done by run-clang-tidy -header-filter='.*' -checks='-*,re…
Browse files Browse the repository at this point in the history
…adability-container-size-empty' -fix
  • Loading branch information
Heiko Thiel committed Apr 24, 2019
1 parent 7bb02bd commit 67c1263
Show file tree
Hide file tree
Showing 107 changed files with 244 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace pcl
return false;
}

if (keypoint_extractor_.size() == 0)
if (keypoint_extractor_.empty ())
{
PCL_ERROR("FPFHLocalEstimation :: This feature needs a keypoint extractor... please provide one\n");
return false;
Expand All @@ -51,7 +51,7 @@ namespace pcl
this->computeKeypoints(processed, keypoints, normals);
std::cout << " " << normals->points.size() << " " << processed->points.size() << std::endl;

if (keypoints->points.size () == 0)
if (keypoints->points.empty ())
{
PCL_WARN("FPFHLocalEstimation :: No keypoints were found\n");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace pcl
return false;
}

if (keypoint_extractor_.size() == 0)
if (keypoint_extractor_.empty ())
{
PCL_ERROR("SHOTLocalEstimation :: This feature needs a keypoint extractor... please provide one\n");
return false;
Expand Down Expand Up @@ -99,7 +99,7 @@ namespace pcl
keypoint_extractor_->setSupportRadius(support_radius_);
keypoint_extractor_->compute (keypoints);*/

if (keypoints->points.size () == 0)
if (keypoints->points.empty ())
{
PCL_WARN("SHOTLocalEstimation :: No keypoints were found\n");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace pcl
return false;
}

if (keypoint_extractor_.size() == 0)
if (keypoint_extractor_.empty ())
{
PCL_ERROR("SHOTLocalEstimationOMP :: This feature needs a keypoint extractor... please provide one\n");
return false;
Expand Down Expand Up @@ -88,7 +88,7 @@ namespace pcl
this->computeKeypoints(processed, keypoints, normals);
std::cout << " " << normals->points.size() << " " << processed->points.size() << std::endl;

if (keypoints->points.size () == 0)
if (keypoints->points.empty ())
{
PCL_WARN("SHOTLocalEstimationOMP :: No keypoints were found\n");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace pcl
out = in;
}

if (out->points.size () == 0)
if (out->points.empty ())
{
PCL_WARN("NORMAL estimator: Cloud has no points after voxel grid, won't be able to compute normals!\n");
return;
Expand Down Expand Up @@ -167,7 +167,7 @@ namespace pcl

}

if (out->points.size () == 0)
if (out->points.empty ())
{
PCL_WARN("NORMAL estimator: Cloud has no points after removing outliers...!\n");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
typename pcl::PointCloud<FeatureT>::CloudVectorType signatures;
std::vector < Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > centroids;

if (indices_.size ())
if (!indices_.empty ())
{
pcl::copyPointCloud (*input_, indices_, *in);
}
Expand All @@ -93,7 +93,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
estimator_->estimate (in, processed, signatures, centroids);
std::vector<index_score> indices_scores;

if (signatures.size () > 0)
if (!signatures.empty ())
{
for (size_t idx = 0; idx < signatures.size (); idx++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
std::vector<pcl::PointCloud<FeatureT>, Eigen::aligned_allocator<pcl::PointCloud<FeatureT> > > signatures;
std::vector < Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > centroids;

if (indices_.size ())
if (!indices_.empty ())
pcl::copyPointCloud (*input_, indices_, *in);
else
in = input_;
Expand All @@ -184,7 +184,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
crh_estimator_->getCRHHistograms (crh_histograms);

std::vector<index_score> indices_scores;
if (signatures.size () > 0)
if (!signatures.empty ())
{

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
std::vector<pcl::PointCloud<FeatureT>, Eigen::aligned_allocator<pcl::PointCloud<FeatureT> > > signatures;
std::vector < Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > centroids;

if (indices_.size ())
if (!indices_.empty ())
pcl::copyPointCloud (*input_, indices_, *in);
else
in = input_;
Expand All @@ -245,13 +245,13 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
std::vector<index_score> indices_scores;
descriptor_distances_.clear ();

if (signatures.size () > 0)
if (!signatures.empty ())
{

{
pcl::ScopeTime t_matching ("Matching and roll...");

if (use_single_categories_ && (categories_to_be_searched_.size () > 0))
if (use_single_categories_ && (!categories_to_be_searched_.empty ()))
{

//perform search of the different signatures in the categories_to_be_searched_
Expand Down Expand Up @@ -643,7 +643,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
PointInTPtr processed (new pcl::PointCloud<PointInT>);
PointInTPtr view = models->at (i).views_->at (v);

if (view->points.size () == 0)
if (view->points.empty ())
PCL_WARN("View has no points!!!\n");

if (noisify_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT>
else
{
processed.reset( (new pcl::PointCloud<PointInT>));
if (indices_.size () > 0)
if (!indices_.empty ())
{
PointInTPtr sub_input (new pcl::PointCloud<PointInT>);
pcl::copyPointCloud (*input_, indices_, *sub_input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
}
}
typename PointCloud<PointT>::Ptr leftovers = boost::shared_ptr<PointCloud<PointT> > (new PointCloud<PointT>);
if (extracted_indices->size () == 0)
if (extracted_indices->empty ())
pcl::copyPointCloud (*input_cloud,*leftovers);
else
{
Expand Down
14 changes: 7 additions & 7 deletions apps/cloud_composer/src/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool
pcl::cloud_composer::CloudCommand::canUseTemplates (ConstItemList &input_data)
{
//Make sure the input list isn't empty
if (input_data.size () == 0)
if (input_data.empty ())
{
qCritical () << "Cannot call a templated tool on an empty input in CloudCommand::executeToolOnTemplateCloud!";
template_type_ = -2;
Expand Down Expand Up @@ -118,7 +118,7 @@ bool
pcl::cloud_composer::CloudCommand::replaceOriginalWithNew (QList <const CloudComposerItem*> originals, QList <CloudComposerItem*> new_items)
{
//Find the input item's parent
if (originals.size () < 1)
if (originals.empty ())
{
qCritical () << "No items to replace specified!";
return false;
Expand Down Expand Up @@ -225,7 +225,7 @@ pcl::cloud_composer::ModifyItemCommand::runCommand (AbstractTool* tool)
output = tool->performAction (input_list, static_cast<PointTypeFlags::PointType> (template_type_));
else
output = tool->performAction (input_list);
if (output.size () == 0)
if (output.empty ())
qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a ModifyItemCommand";
else
{
Expand Down Expand Up @@ -304,7 +304,7 @@ pcl::cloud_composer::NewItemCloudCommand::runCommand (AbstractTool* tool)
output = tool->performAction (input_list, static_cast<PointTypeFlags::PointType> (template_type_));
else
output = tool->performAction (input_list);
if (output.size () == 0)
if (output.empty ())
qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a NewItemCloudCommand";
else
{
Expand Down Expand Up @@ -412,7 +412,7 @@ pcl::cloud_composer::SplitCloudCommand::runCommand (AbstractTool* tool)
output = tool->performAction (input_list, static_cast<PointTypeFlags::PointType> (template_type_));
else
output = tool->performAction (input_list);
if (output.size () == 0)
if (output.empty ())
qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a SplitCloudCommand";
else
{
Expand Down Expand Up @@ -489,7 +489,7 @@ pcl::cloud_composer::DeleteItemCommand::runCommand (AbstractTool*)
output_data_.append (output_pair);
this->setText ("Delete "+item->text ());
}
if (original_data_.size () > 0)
if (!original_data_.empty ())
this->setText ("Delete multiple items");
return true;
}
Expand Down Expand Up @@ -553,7 +553,7 @@ pcl::cloud_composer::MergeCloudCommand::runCommand (AbstractTool* tool)
OutputPair output_pair = {original_data_, output_items};
output_data_.append (output_pair);

if (output_items.size () == 0)
if (output_items.empty ())
{
qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a MergeCloudCommand";
return false;
Expand Down
2 changes: 1 addition & 1 deletion apps/cloud_composer/src/merge_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po
QList <CloudComposerItem*> output;

// Check input data length
if ( input_data.size () == 0 && selected_item_index_map_.isEmpty() )
if ( input_data.empty () && selected_item_index_map_.isEmpty() )
{
qCritical () << "Empty input in MergeSelection!";
return output;
Expand Down
18 changes: 9 additions & 9 deletions apps/cloud_composer/src/project_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pcl::cloud_composer::ProjectModel::setPointSelection (boost::shared_ptr<Selectio
{
pcl::PointIndices::Ptr found_indices = boost::make_shared<pcl::PointIndices>();
selected_event->findIndicesInItem (cloud_item, found_indices);
if (found_indices->indices.size () > 0)
if (!found_indices->indices.empty ())
{
qDebug () << "Found "<<found_indices->indices.size ()<<" points in "<<cloud_item->text ();
selected_item_index_map_. insert (cloud_item, found_indices);
Expand Down Expand Up @@ -195,11 +195,11 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromFile ()
QString short_filename = file_info.baseName ();
//Check if this name already exists in the project - if so, append digit
QList <QStandardItem*> items = findItems (short_filename);
if (items.size () > 0)
if (!items.empty ())
{
int k = 2;
items = findItems (short_filename+ tr ("-%1").arg (k));
while (items.size () > 0)
while (!items.empty ())
{
++k;
items = findItems (short_filename+ tr ("-%1").arg (k));
Expand Down Expand Up @@ -232,7 +232,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth ()
depth_filter << base_name.split("_").at(0) + "_depth.*";
last_directory_.setNameFilters (depth_filter);
QFileInfoList depth_info_list = last_directory_.entryInfoList ();
if (depth_info_list.size () == 0)
if (depth_info_list.empty ())
{
qCritical () << "Could not find depth file in format (rgb file base name)_depth.*";
return;
Expand Down Expand Up @@ -328,11 +328,11 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth ()
QString short_filename = file_info.baseName ();
//Check if this name already exists in the project - if so, append digit
QList <QStandardItem*> items = findItems (short_filename);
if (items.size () > 0)
if (!items.empty ())
{
int k = 2;
items = findItems (short_filename+ tr ("-%1").arg (k));
while (items.size () > 0)
while (!items.empty ())
{
++k;
items = findItems (short_filename+ tr ("-%1").arg (k));
Expand All @@ -350,7 +350,7 @@ pcl::cloud_composer::ProjectModel::saveSelectedCloudToFile ()
{
qDebug () << "Saving cloud to file...";
QModelIndexList selected_indexes = selection_model_->selectedIndexes ();
if (selected_indexes.size () == 0)
if (selected_indexes.empty ())
{
QMessageBox::warning (qobject_cast<QWidget *>(this->parent ()), "No Cloud Selected", "Cannot save, no cloud is selected in the browser or cloud view");
return;
Expand Down Expand Up @@ -395,7 +395,7 @@ pcl::cloud_composer::ProjectModel::enqueueToolAction (AbstractTool* tool)
//Get the currently selected item(s), put them in a list, and create the command
ConstItemList input_data;
QModelIndexList selected_indexes = selection_model_->selectedIndexes ();
if (selected_indexes.size () == 0)
if (selected_indexes.empty ())
{
QMessageBox::warning (qobject_cast<QWidget *>(this->parent ()), "No Items Selected", "Cannot use tool, no item is selected in the browser or cloud view");
return;
Expand Down Expand Up @@ -458,7 +458,7 @@ pcl::cloud_composer::ProjectModel::deleteSelectedItems ()
{

QModelIndexList selected_indexes = selection_model_->selectedIndexes ();
if (selected_indexes.size () == 0)
if (selected_indexes.empty ())
{
QMessageBox::warning (qobject_cast<QWidget *>(this->parent ()), "No Items Selected", "Cannot execute delete command, no item is selected in the browser or cloud view");
return;
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_composer/src/properties_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pcl::cloud_composer::PropertiesModel::addProperty (const QString prop_name, QVar
if (category.size () > 0)
{
QList<QStandardItem*> items = findItems (category);
if (items.size () == 0)
if (items.empty ())
qWarning () << "No category named "<<prop_name<<" found in "<<parent_item_->text ()<<" adding to root";
else if (items.size () > 1)
qCritical () << "Multiple categories with same name found!! This is not good...";
Expand Down Expand Up @@ -82,7 +82,7 @@ pcl::cloud_composer::PropertiesModel::getProperty (const QString prop_name) cons
{
//qDebug () << "Searching for property " << prop_name;
QList<QStandardItem*> items = findItems (prop_name, Qt::MatchExactly | Qt::MatchRecursive, 0);
if (items.size () == 0)
if (items.empty ())
{
qWarning () << "No property named "<<prop_name<<" found in "<<parent_item_->text ();
return QVariant ();
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_composer/src/toolbox_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ QStandardItem*
pcl::cloud_composer::ToolBoxModel::addToolGroup (QString tool_group_name)
{
QList <QStandardItem*> matches_name = findItems (tool_group_name);
if (matches_name.size () == 0)
if (matches_name.empty ())
{
QStandardItem* new_group_item = new QStandardItem (tool_group_name);
appendRow (new_group_item);
Expand Down Expand Up @@ -190,7 +190,7 @@ pcl::cloud_composer::ToolBoxModel::updateEnabledTools (const QItemSelection& cur
disabled_tools.insert (tool_item, tr("Tool Requires item type %1 selected").arg (ITEM_TYPES_STRINGS.value (input_type - QStandardItem::UserType)));
}
//Check if any of selected items have required children
else if ( required_children_types.size () > 0)
else if ( !required_children_types.empty ())
{
QList <QStandardItem*> matching_selected_items = type_items_map.values (input_type);
bool found_valid_items = false;
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_composer/tools/euclidean_clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction (ConstItemList input
QList <CloudComposerItem*> output;
const CloudComposerItem* input_item;
// Check input data length
if ( input_data.size () == 0)
if ( input_data.empty ())
{
qCritical () << "Empty input in Euclidean Clustering Tool!";
return output;
Expand Down Expand Up @@ -95,7 +95,7 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction (ConstItemList input
}
//We copy input cloud over for special case that no clusters found, since ExtractIndices doesn't work for 0 length vectors
pcl::PCLPointCloud2::Ptr remainder_cloud (new pcl::PCLPointCloud2(*input_cloud));
if (cluster_indices.size () > 0)
if (!cluster_indices.empty ())
{
//make a cloud containing all the remaining points
filter.setIndices (extracted_indices);
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_composer/tools/fpfh_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pcl::cloud_composer::FPFHEstimationTool::performAction (ConstItemList input_data
QList <CloudComposerItem*> output;
const CloudComposerItem* input_item;
// Check input data length
if ( input_data.size () == 0)
if ( input_data.empty ())
{
qCritical () << "Empty input in FPFH Estimation Tool!";
return output;
Expand All @@ -43,7 +43,7 @@ pcl::cloud_composer::FPFHEstimationTool::performAction (ConstItemList input_data
{
//Check if this cloud has normals computed!
QList <CloudComposerItem*> normals_list = input_item->getChildren (CloudComposerItem::NORMALS_ITEM);
if ( normals_list.size () == 0 )
if ( normals_list.empty () )
{
qCritical () << "No normals item child found in this cloud item";
return output;
Expand Down
2 changes: 1 addition & 1 deletion apps/cloud_composer/tools/normal_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pcl::cloud_composer::NormalEstimationTool::performAction (ConstItemList input_da
QList <CloudComposerItem*> output;
const CloudComposerItem* input_item;
// Check input data length
if ( input_data.size () == 0)
if ( input_data.empty ())
{
qCritical () << "Empty input in Normal Estimation Tool!";
return output;
Expand Down
2 changes: 1 addition & 1 deletion apps/cloud_composer/tools/sanitize_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pcl::cloud_composer::SanitizeCloudTool::performAction (ConstItemList input_data,
QList <CloudComposerItem*> output;
const CloudComposerItem* input_item;
// Check input data length
if ( input_data.size () == 0)
if ( input_data.empty ())
{
qCritical () << "Empty input in SanitizeCloudTool!";
return output;
Expand Down
Loading

0 comments on commit 67c1263

Please sign in to comment.