return statements from pcdwriter/pcdreader read functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

return statements from pcdwriter/pcdreader read functions

garratt
I've noticed some of the read functions in pcd_io return true (boolean)
if they are successful, and others return 0 is successful, and < 0 if
they fail.

 one function,
pcl::PCDReader::read (const std::string &file_name,
sensor_msgs::PointCloud2 &cloud,Eigen3::Vector4f &origin,
Eigen3::Quaternionf &orientation, int &pcd_version)
returns:
  return (binary_data);

Are there any objections to making them all return 0 upon success, and
nonzero on error?  This may break some code out there, but the recent
changes to PCDReader already broke mine, so you may already have broken
code. (this might even fix it :)

If there are no objections, I'll go ahead and fix it.

Garratt



_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: return statements from pcdwriter/pcdreader read functions

Radu B. Rusu
Administrator

On 12/07/2010 12:30 PM, garratt wrote:

> I've noticed some of the read functions in pcd_io return true (boolean)
> if they are successful, and others return 0 is successful, and<  0 if
> they fail.
>
>   one function,
> pcl::PCDReader::read (const std::string&file_name,
> sensor_msgs::PointCloud2&cloud,Eigen3::Vector4f&origin,
> Eigen3::Quaternionf&orientation, int&pcd_version)
> returns:
>    return (binary_data);
>
> Are there any objections to making them all return 0 upon success, and
> nonzero on error?  This may break some code out there, but the recent
> changes to PCDReader already broke mine, so you may already have broken
> code. (this might even fix it :)
>
> If there are no objections, I'll go ahead and fix it.

Sounds fine with me. As long as we have unit tests, and the behavior is consistent. :)

Cheers,
Radu.
--
http://pointclouds.org
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: return statements from pcdwriter/pcdreader read functions

Radu B. Rusu
Administrator
In reply to this post by garratt

On 12/07/2010 12:30 PM, garratt wrote:

> I've noticed some of the read functions in pcd_io return true (boolean)
> if they are successful, and others return 0 is successful, and<  0 if
> they fail.
>
>   one function,
> pcl::PCDReader::read (const std::string&file_name,
> sensor_msgs::PointCloud2&cloud,Eigen3::Vector4f&origin,
> Eigen3::Quaternionf&orientation, int&pcd_version)
> returns:
>    return (binary_data);
>
> Are there any objections to making them all return 0 upon success, and
> nonzero on error?  This may break some code out there, but the recent
> changes to PCDReader already broke mine, so you may already have broken
> code. (this might even fix it :)
>
> If there are no objections, I'll go ahead and fix it.

Garratt,

Did you push in the changes? I wonder if it makes any sense at all to still return the meta-information whether the
returned file is ascii or binary.

Cheers,
Radu.
--
http://pointclouds.org
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users