-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
WIP: Split common/include/pcl/impl/point_types.hpp
#6367
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
base: master
Are you sure you want to change the base?
WIP: Split common/include/pcl/impl/point_types.hpp
#6367
Conversation
* Move pcl::Array* into common/include/pcl/array_types.h * Move pcl::Vector* into common/include/pcl/vector_types.h Signed-off-by: Ramir Sultanov <[email protected]>
|
Thank you for your pull request. Before you work further on this, let's discuss first for which parts of the code it makes the most sense to put it into different files. A few months ago, I have also looked into how point_types.hpp could be sensibly split, and I found that some things that seemed obvious were not so beneficial after all. I believe the main question is: looking at all the places within PCL where point_types.hpp is included (or point_types.h, which in turn includes point_types.hpp), what exactly is needed from point_types.hpp? And can we put some code from point_types.hpp into a separate header file and include that one instead, hopefully leading to faster compilation? (with the secondary benefit of making point_types.hpp smaller) In my opinion, it would currently make the most sense to split off the code at the end of point_types.hpp, that deals with testing for specific point fields ( Another idea might be to put all point types with xyz fields into a separate file. This would exclude feature/descriptor types, and cpp files that only need all point types with xyz fields (very often the case) could instead include the new file. Another thing we could look into, to make compilation faster, is precompiled headers, but that is a different topic. |
|
Thank you for your reply! I believe your propositions are well-grounded. I will look into it, maybe I could come up with something even better. |
|
So far, I have several alternatives. Though, I have not looked into all files (and usages) yet. I don't think we can choose one (without guessing) in terms of faster compilation time without actually implementing all of them and making comparison (which I could end up doing...). Alternative 1. One file - one (struct|macro|etc.) definition where possible or some kind of it.Example: (imagine) /* Licence is skipped for brevity */
#pragma once
#include <pcl/descriptors/pfh_signature_125.h>
#include <pcl/descriptor_size.h> /// for descriptorSize_v
/* other necessary includes */
namespace pcl
{
namespace detail
{
namespace traits
{
template<> struct descriptorSize<PFHSignature125> { static constexpr const int value = 125; };
} // namespace traits
} // namespace detail
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
/** \brief A point structure representing the Point Feature Histogram (PFH).
* \ingroup common
*/
struct PFHSignature125
{
float histogram[125] = {0.f};
static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHSignature125>; }
inline constexpr PFHSignature125 () = default;
friend std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
};
} // namespace pcl
POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
(float[125], histogram, pfh)
)We can have a lot of small header files (probably, put them in subdirectories). Pros:
Cons:
I don't know (yet) what is slower (probably, some experiments are needed):
Alternative 2. More larger files.Pros:
Cons:
Alternative 3. Mixing alternatives 1 and 2.For some definitions use alternative 1 and for other defintions use alternative 2. ProposalBased on @mvieth's ideas and my investigation so far, I propose:
Suggestions are welcome. Questions I left unanswered for now:
|
pcl::Array*intocommon/include/pcl/array_types.hpcl::Vector*intocommon/include/pcl/vector_types.hWork in progress. Feedback is appreciated. Will see what else can be split. I propose not to merge these small changes just yet, assuming I understood the issue correctly, because multiple merge requests will require multiple recompilations of all other modules that use
common/include/pcl/impl/point_types.hppwhich I think is used in many places.