Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
types.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2020-, OpenPerception
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of the copyright holder(s) nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*/
36
37
#pragma once
38
39
/**
40
* \file pcl/types.h
41
*
42
* \brief Defines basic non-point types used by PCL
43
* \ingroup common
44
*/
45
46
#include <pcl/pcl_config.h>
47
#include <
pcl/pcl_macros.h
>
48
#include <vector>
49
50
#include <cstdint>
51
52
#include <Eigen/Core>
53
54
namespace
pcl
55
{
56
namespace
detail
{
57
/**
58
* \brief int_type::type refers to an integral type that satisfies template parameters
59
* \tparam Bits number of bits in the integral type
60
* \tparam Signed signed or unsigned nature of the type
61
*/
62
template
<std::
size_t
Bits,
bool
Signed = true>
63
struct
int_type
{
using
type
= void; };
64
65
/**
66
* \brief helper type to use for `int_type::type`
67
* \see int_type
68
*/
69
template
<std::
size_t
Bits,
bool
Signed = true>
70
using
int_type_t
=
typename
int_type<Bits, Signed>::type
;
71
72
template
<>
73
struct
int_type
<8, true> {
using
type
= std::int8_t; };
74
template
<>
75
struct
int_type
<8, false> {
using
type
= std::uint8_t; };
76
template
<>
77
struct
int_type
<16, true> {
using
type
= std::int16_t; };
78
template
<>
79
struct
int_type
<16, false> {
using
type
= std::uint16_t; };
80
template
<>
81
struct
int_type
<32, true> {
using
type
= std::int32_t; };
82
template
<>
83
struct
int_type
<32, false> {
using
type
= std::uint32_t; };
84
template
<>
85
struct
int_type
<64, true> {
using
type
= std::int64_t; };
86
template
<>
87
struct
int_type
<64, false> {
using
type
= std::uint64_t; };
88
89
/**
90
* \brief number of bits in PCL's index type
91
*
92
* Please use PCL_INDEX_SIZE when building PCL to choose a size best suited for your needs.
93
* PCL 1.12 will come with default 32
94
*
95
* PCL 1.11 has a default size = sizeof(int)
96
*/
97
constexpr
std::uint8_t
index_type_size
= PCL_INDEX_SIZE;
98
99
/**
100
* \brief signed/unsigned nature of PCL's index type
101
* Please use PCL_INDEX_SIGNED when building PCL to choose a type best suited for your needs.
102
* Default: signed
103
*/
104
constexpr
bool
index_type_signed
= PCL_INDEX_SIGNED;
105
}
// namespace detail
106
107
/**
108
* \brief Type used for an index in PCL
109
*
110
* Default index_t = int for PCL 1.11, std::int32_t for PCL >= 1.12
111
*/
112
using
index_t
=
detail::int_type_t<detail::index_type_size, detail::index_type_signed>
;
113
static_assert
(!std::is_void<index_t>::value,
"`index_t` can't have type `void`"
);
114
115
/**
116
* \brief Type used for an unsigned index in PCL
117
*
118
* Unsigned index that mirrors the type of the index_t
119
*/
120
using
uindex_t
=
detail::int_type_t<detail::index_type_size, false>
;
121
static_assert
(!std::is_signed<uindex_t>::value,
"`uindex_t` must be unsigned"
);
122
123
/**
124
* \brief Type used for indices in PCL
125
* \todo Remove with C++20
126
*/
127
template
<
typename
Allocator = std::allocator<index_t>>
128
using
IndicesAllocator
= std::vector<index_t, Allocator>;
129
130
/**
131
* \brief Type used for indices in PCL
132
*/
133
using
Indices
=
IndicesAllocator<>
;
134
135
/**
136
* \brief Type used for aligned vector of Eigen objects in PCL
137
*/
138
template
<
typename
T>
139
using
AlignedVector
= std::vector<T, Eigen::aligned_allocator<T>>;
140
}
// namespace pcl
141
pcl::detail
Definition
accumulators.hpp:57
pcl::detail::index_type_signed
constexpr bool index_type_signed
signed/unsigned nature of PCL's index type Please use PCL_INDEX_SIGNED when building PCL to choose a ...
Definition
types.h:104
pcl::detail::int_type_t
typename int_type< Bits, Signed >::type int_type_t
helper type to use for int_type::type
Definition
types.h:70
pcl::detail::index_type_size
constexpr std::uint8_t index_type_size
number of bits in PCL's index type
Definition
types.h:97
pcl
Definition
convolution.h:46
pcl::IndicesAllocator
std::vector< index_t, Allocator > IndicesAllocator
Type used for indices in PCL.
Definition
types.h:128
pcl::index_t
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
Definition
types.h:112
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133
pcl::AlignedVector
std::vector< T, Eigen::aligned_allocator< T > > AlignedVector
Type used for aligned vector of Eigen objects in PCL.
Definition
types.h:139
pcl::uindex_t
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.
Definition
types.h:120
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl::detail::int_type< 16, false >::type
std::uint16_t type
Definition
types.h:79
pcl::detail::int_type< 16, true >::type
std::int16_t type
Definition
types.h:77
pcl::detail::int_type< 32, false >::type
std::uint32_t type
Definition
types.h:83
pcl::detail::int_type< 32, true >::type
std::int32_t type
Definition
types.h:81
pcl::detail::int_type< 64, false >::type
std::uint64_t type
Definition
types.h:87
pcl::detail::int_type< 64, true >::type
std::int64_t type
Definition
types.h:85
pcl::detail::int_type< 8, false >::type
std::uint8_t type
Definition
types.h:75
pcl::detail::int_type< 8, true >::type
std::int8_t type
Definition
types.h:73
pcl::detail::int_type
int_type::type refers to an integral type that satisfies template parameters
Definition
types.h:63
pcl::detail::int_type::type
void type
Definition
types.h:63