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

Define PointIndices based on the global Indices type alias #3822

Merged
merged 5 commits into from
Mar 30, 2020
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
10 changes: 5 additions & 5 deletions common/include/pcl/PointIndices.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

// Include the correct Header path here
#include <pcl/PCLHeader.h>
#include <pcl/types.h>

namespace pcl
{
struct PointIndices
{
using Ptr = shared_ptr< ::pcl::PointIndices>;
using ConstPtr = shared_ptr<const ::pcl::PointIndices>;

PointIndices ()
{}

::pcl::PCLHeader header;

std::vector<int> indices;

public:
using Ptr = shared_ptr< ::pcl::PointIndices>;
using ConstPtr = shared_ptr<const ::pcl::PointIndices>;
Indices indices;
}; // struct PointIndices

using PointIndicesPtr = PointIndices::Ptr;
Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/pcl_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
#include <pcl/point_cloud.h>
#include <pcl/PointIndices.h>
#include <pcl/PCLPointCloud2.h>
#include <pcl/types.h>

namespace pcl
{
// definitions used everywhere
using Indices = std::vector<int>;
using IndicesPtr = shared_ptr<Indices>;
using IndicesConstPtr = shared_ptr<const Indices>;

Expand Down
13 changes: 11 additions & 2 deletions common/include/pcl/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

#include <pcl/pcl_macros.h>

#include <vector>

#include <cstdint>

namespace pcl
Expand All @@ -63,7 +65,8 @@ namespace pcl
// Aim is to remove macros and instead allow multiple index types to coexist together
#ifndef PCL_INDEX_SIZE
#if PCL_MINOR_VERSION <= 11
#define PCL_INDEX_SIZE sizeof(int)
// sizeof returns bytes, while we measure size by bits in the template
#define PCL_INDEX_SIZE (sizeof(int) * 8)
#else
#define PCL_INDEX_SIZE 32
#endif // PCL_MINOR_VERSION
Expand Down Expand Up @@ -126,10 +129,16 @@ namespace pcl
} // namespace detail

/**
* \brief Type used for indices in PCL
* \brief Type used for an index in PCL
*
* Default index_t = int for PCL 1.11, std::int32_t for PCL >= 1.12
*/
using index_t = detail::int_type_t<detail::index_type_size, detail::index_type_signed>;
static_assert(!std::is_void<index_t>::value, "`index_t` can't have type `void`");

/**
* \brief Type used for indices in PCL
*/
using Indices = std::vector<index_t>;
} // namespace pcl