-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
inlined setInputFeatureCloud() and nearestNeighborSearch() #891
Conversation
Tests fail, but not due to the changes I belive |
I am in doubt whether this is a proper fix for the problem. Following the same logic, every function should be inline because someone might want to use it in different compilation units. Alternative option: instantiate the template with whatever point types you need into a library and then link your two c.u. against it. |
Inlining it or not will depend in any case on the compiler, the keyword is just a suggestion, so I don't see any problem in this fix. If the inlined code block is long probably the compiler will leave the function call but will create a weak reference for the linker in order to allow to have multiple definitions of the same symbol. |
But I do not observe this pattern elsewhere in PCL. We user I would like to hear some other opinions before merging this. |
Using inline to solve multiple definition errors is pretty common. I don't know whether or not it's a good practice though. As @taketwo says, it's not done in most of the rest of library, but I think that's because much of the rest of the library is templated, making inline unnecessary. I might be wrong about that though. |
Yeah, I also think that's the reason. |
Mmm, I overlooked the fact that the class in question is not templated. After having another look at it I think the problem is that this module does not follow the common PCL recipe: header ( |
@taketwo for sure it is good to make that change, but the problem remains. |
Why? After you move definition of |
Yeah sorry, you are right @taketwo. I am doing the changes right away. |
You did not enable explicit template instantiation, so the following lines may be left commented: //#include <pcl/point_types.h>
//#include <pcl/impl/instantiate.hpp>
//#include <pcl/registration/impl/ppf_registration.hpp> |
We also need to add inclusion guards in |
Thanks for the comments, trying my best. |
In |
The guard in |
Well... we are steadily going in the right direction :) |
Ah right! sorry for that! |
Looks good now, but I thin in #include <pcl/registration/ppf_registration.h> should be included unconditionally, because it is needed for |
Great! Could you please squash the commits into one and supply it with a sensible message? |
mmm I think I am messing up everything since I have never done it and I am having some problems doing it. Should I use git rebase or git merge --squash? |
Have a look here: http://justinhileman.info/article/git-pretty/ |
Is it ok now? |
Almost ;). Do a git push -f, not a git push to get rid of the old commits (and the merge). Also, can you write a better commit message please? Thanks! |
Hope now I fixed it :) I am quite new to git |
Sorry to say, but it's not. Have a look at this site: https://github.com/PointCloudLibrary/pcl/pull/891/commits given the size of your changes, there should be one commit listed and not 11. You had one listed here: giacomodabisias@65b2cc1. Have a look at the link I provided: http://justinhileman.info/article/git-pretty/. |
I think I finally did it |
…apSearch::nearestNeighborSearch() implementation from ppf_registration.hpp to ppf_registration.cpp since they belong to a not templated class
+1 |
inlined setInputFeatureCloud() and nearestNeighborSearch()
There is something wrong about this pull request, see #906 |
This fixes PointCloudLibrary#906 by partially reverting PointCloudLibrary#891.
inlined setInputFeatureCloud() and nearestNeighborSearch() since if used in two different compilation units and then linked against another compilation unit, there will be multiple definitions of this symbols