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

Fix function signature mismatching. #1625

Merged
merged 1 commit into from
Sep 1, 2016
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
3 changes: 1 addition & 2 deletions io/include/pcl/io/auto_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ namespace pcl
/** \brief Save point cloud to a binary file when available else to ASCII.
* \param[in] file_name the output file name
* \param[in] cloud the point cloud
* \param[in] precision float precision when saving to ASCII files
* \ingroup io
*/
template<typename PointT> int
save (const std::string& file_name, const pcl::PointCloud<PointT>& cloud, unsigned precision = 5);
save (const std::string& file_name, const pcl::PointCloud<PointT>& cloud);

/** \brief Saves a TextureMesh to a binary file when available else to ASCII.
* \param[in] file_name the name of the file to write to disk
Expand Down
2 changes: 1 addition & 1 deletion io/include/pcl/io/ifs_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace pcl
const std::string &cloud_name = "cloud")
{
pcl::PCLPointCloud2 blob;
pcl::fromPCLPointCloud2<PointT> (blob, cloud);
pcl::toPCLPointCloud2<PointT> (cloud, blob);
return (write (file_name, blob, cloud_name));
}
};
Expand Down
38 changes: 38 additions & 0 deletions test/io/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <pcl/point_types.h>
#include <pcl/common/io.h>
#include <pcl/console/print.h>
#include <pcl/io/auto_io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/io/ascii_io.h>
Expand Down Expand Up @@ -1368,6 +1369,43 @@ TEST (PCL, Locale)
#endif
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T> class AutoIOTest : public testing::Test { };
typedef ::testing::Types<BOOST_PP_SEQ_ENUM (PCL_XYZ_POINT_TYPES PCL_NORMAL_POINT_TYPES)> PCLXyzNormalPointTypes;
TYPED_TEST_CASE (AutoIOTest, PCLXyzNormalPointTypes);
TYPED_TEST (AutoIOTest, AutoLoadCloudFiles)
{
PointCloud<TypeParam> cloud;
PointCloud<TypeParam> cloud_pcd;
PointCloud<TypeParam> cloud_ply;
PointCloud<TypeParam> cloud_ifs;

cloud.width = 10;
cloud.height = 5;
cloud.resize (cloud.width * cloud.height);
cloud.is_dense = true;

save ("test_autoio.pcd", cloud);
save ("test_autoio.ply", cloud);
save ("test_autoio.ifs", cloud);

Copy link
Member

Choose a reason for hiding this comment

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

I'm not really fond of dumping stuff into the disk and not cleaning up after. Can you erase these files upon exiting the test?

load ("test_autoio.pcd", cloud_pcd);
EXPECT_EQ (cloud_pcd.width * cloud_pcd.height, cloud.width * cloud.height);
EXPECT_EQ (cloud_pcd.is_dense, cloud.is_dense);

load ("test_autoio.ply", cloud_ply);
EXPECT_EQ (cloud_ply.width * cloud_ply.height, cloud.width * cloud.height);
EXPECT_EQ (cloud_ply.is_dense, cloud.is_dense);

load ("test_autoio.ifs", cloud_ifs);
EXPECT_EQ (cloud_ifs.width * cloud_ifs.height, cloud.width * cloud.height);
EXPECT_EQ (cloud_ifs.is_dense, cloud.is_dense);

remove ("test_autoio.pcd");
remove ("test_autoio.ply");
remove ("test_autoio.ifs");
}

/* ---[ */
int
main (int argc, char** argv)
Expand Down