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

Add a family of "has field" meta-functions #462

Merged
merged 2 commits into from
Jan 23, 2014

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Jan 22, 2014

As suggested in #440, this pull request adds a family of "has field" functions to check presence of a particular field in a point type both at compile- and run-time.

The functions are put inside pcl::traits namespace. Logically, they should belong to 'pcl_traits.h' file, however due to inclusion loop I had to move them to 'point_types.h'.

The functions added are:

  • has_field
  • has_all_fields
  • has_any_field

for querying any kind/combination of fields, and:

  • has_xyz
  • has_normal
  • has_curvature
  • has_color
  • has_label

to check presence of most commonly used fields.

This pull request also adds a unit test for the new functions.

@taketwo
Copy link
Member Author

taketwo commented Jan 23, 2014

Are there any questions/reasons not to merge this? Sorry for my impatience, but I have a number of other pull requests that rely on this one.

@andersgb1
Copy link
Contributor

If it helps anything, a big +1 from my side on this one :)

@taketwo
Copy link
Member Author

taketwo commented Jan 23, 2014

@andersgb1 Thanks for the support :)

rbrusu added a commit that referenced this pull request Jan 23, 2014
Add a family of "has field" meta-functions
@rbrusu rbrusu merged commit 669a963 into PointCloudLibrary:master Jan 23, 2014
@taketwo taketwo deleted the add-has-field branch January 23, 2014 17:02
@shawnshuailin
Copy link

Hi taketwo,

I encountered a problem when I want to compile kinfu_app.cpp. As it includes point_types.h, then the compiler reported errors in namespace traits, it said 'type' is not a member of 'boost::mpl::contains'. As I'm a newer to PCL and boost, could you please give me some advice to solve this problem? I'm using MSVC2010 and boost 1.55. Thanks very much!

@taketwo
Copy link
Member Author

taketwo commented Feb 27, 2014

I don't have MSVC at my disposal, so can not test. Though quick googling does not reveal any complaints about Boost MPL support in MSVC. You mentioned 'kinfu_app', but do you get the same error compiling the rest of PCL?

@shawnshuailin
Copy link

Hi taketwo,

Thanks for your reply! I build several other projects. Not only 'kinfu_app' get stuck by this error, some other projects such as "pcl_crf_segmentation", "pcl_icp" and "pcl_icp2d" also encounter this error, cause they all include 'point_types.h'. The error are the same ones as I described above. I also attach an image of the error. Hope you could help to solve this problem. Thanks!

image

@Logrus
Copy link
Contributor

Logrus commented Feb 27, 2014

Hi @shawnshuailin,

I use MSVS2010 on Win8 x64 machine with boost 1.50. kinfu_app compiles successfully. So it seems like the problem can be due to newer version of boost. I'll try it later.

@taketwo
Copy link
Member Author

taketwo commented Feb 27, 2014

@shawnshuailin Still, what about other (basic) parts of PCL like pcl_common? The thing is, everything in PCL includes 'point_types.h'. So it will be interesting to know whether for you it fails everywhere, or only in several specific places.

@shawnshuailin
Copy link

@Logrus Thanks very much for your help! I'll have try for that.
@taketwo It seems that the error occurs in the projects including 'point_types.h', others could be built successfully. pcl_common could also be built and generate dll file successfully.

@taketwo
Copy link
Member Author

taketwo commented Feb 28, 2014

If pcl_common builds successfully, then there must be something special about kinfu_app an others.

Among the errors that you posted the 3rd one ("type is not a member of pcl::traits::fieldList") seems to be the "parent error" for the others. By the way, is the screenshot complete? Are there more errors that did not fit into?

@shawnshuailin
Copy link

@taketwo I will try to build the solution again using boost 1.50 and then post the error list if they occur
again.
In the mailing list of PCL, I put forward this problem as well, and another one said he encountered the same problem when compiling kinfu_app in Win32 platform, however, he successfully built whole solution in x64 platform. You can have a look at this webpage. http://www.pcl-users.org/compile-error-in-point-types-h-tp4032582p4032610.html. I guess this issue has something to do with the platform, cause @Logrus has built it successfully in x64 platform.

@taketwo
Copy link
Member Author

taketwo commented Mar 1, 2014

Yeah, I would also blame it on x32 MSVC.

Speaking about boost::mpl::contains, it derives from boost::mpl::contains_impl, and the latter has type declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants