types.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2016, Open Source Robotics Foundation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
38 #ifndef FCL_DATA_TYPES_H
39 #define FCL_DATA_TYPES_H
40 
41 #include <cassert>
42 #include <cstddef>
43 #include <cstdint>
44 #include <vector>
45 #include <map>
46 #include <memory>
47 #include <Eigen/Dense>
48 #include <Eigen/StdVector>
49 #include "fcl/export.h"
50 
51 namespace fcl
52 {
53 
54 typedef FCL_DEPRECATED double FCL_REAL;
55 typedef FCL_DEPRECATED std::int64_t FCL_INT64;
56 typedef FCL_DEPRECATED std::uint64_t FCL_UINT64;
57 typedef FCL_DEPRECATED std::int32_t FCL_INT32;
58 typedef FCL_DEPRECATED std::uint32_t FCL_UINT32;
59 
60 using int64 = std::int64_t;
61 using uint64 = std::uint64_t;
62 using int32 = std::int32_t;
63 using uint32 = std::uint32_t;
66 
67 template <typename S>
68 using Vector2 = Eigen::Matrix<S, 2, 1>;
69 
70 template <typename S>
71 using Vector3 = Eigen::Matrix<S, 3, 1>;
72 
73 template <typename S>
74 using Vector6 = Eigen::Matrix<S, 6, 1>;
75 
76 template <typename S>
77 using Vector7 = Eigen::Matrix<S, 7, 1>;
78 
79 template <typename S, int N>
80 using VectorN = Eigen::Matrix<S, N, 1>;
81 
82 template <typename S>
83 using VectorX = Eigen::Matrix<S, Eigen::Dynamic, 1>;
84 
85 template <typename S>
86 using Matrix3 = Eigen::Matrix<S, 3, 3>;
87 
88 template <typename S>
89 using Quaternion = Eigen::Quaternion<S>;
90 
91 template <typename S>
92 using Transform3 = Eigen::Transform<S, 3, Eigen::Isometry>;
93 
94 template <typename S>
95 using Translation3 = Eigen::Translation<S, 3>;
96 
97 template <typename S>
98 using AngleAxis = Eigen::AngleAxis<S>;
99 
100 // float types
102 template <int N>
110 
111 // double types
113 template <int N>
121 
122 template <typename _Tp>
123 using aligned_vector = std::vector<_Tp, Eigen::aligned_allocator<_Tp>>;
124 
125 template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>>
126 using aligned_map = std::map<_Key, _Tp, _Compare,
127  Eigen::aligned_allocator<std::pair<const _Key, _Tp>>>;
128 
129 #if EIGEN_VERSION_AT_LEAST(3,2,9)
130 
131 template <typename _Tp, typename... _Args>
132 inline std::shared_ptr<_Tp> make_aligned_shared(_Args&&... __args)
133 {
134  typedef typename std::remove_const<_Tp>::type _Tp_nc;
135  return std::allocate_shared<_Tp>(Eigen::aligned_allocator<_Tp_nc>(),
136  std::forward<_Args>(__args)...);
137 }
138 
139 #else
140 
142 // Ref: https://bitbucket.org/eigen/eigen/commits/f5b7700
143 // C++11 compatible version is available since Eigen 3.2.9 so we use this copy
144 // for Eigen (< 3.2.9).
145 template <class T>
146 class FCL_EXPORT aligned_allocator_cpp11 : public std::allocator<T>
147 {
148 public:
149  typedef std::size_t size_type;
150  typedef std::ptrdiff_t difference_type;
151  typedef T* pointer;
152  typedef const T* const_pointer;
153  typedef T& reference;
154  typedef const T& const_reference;
155  typedef T value_type;
156 
157  template <class U>
158  struct rebind
159  {
161  };
162 
164  : std::allocator<T>() {}
165 
167  : std::allocator<T>(other) {}
168 
169  template <class U>
171  : std::allocator<T>(other) {}
172 
174 
175  pointer allocate(size_type num, const void* /*hint*/ = 0)
176  {
177  Eigen::internal::check_size_for_overflow<T>(num);
178  return static_cast<pointer>( Eigen::internal::aligned_malloc(num * sizeof(T)) );
179  }
180 
181  void deallocate(pointer p, size_type /*num*/)
182  {
183  Eigen::internal::aligned_free(p);
184  }
185 };
186 
187 template <typename _Tp, typename... _Args>
188 inline std::shared_ptr<_Tp> make_aligned_shared(_Args&&... __args)
189 {
190  typedef typename std::remove_const<_Tp>::type _Tp_nc;
191  return std::allocate_shared<_Tp>(aligned_allocator_cpp11<_Tp_nc>(),
192  std::forward<_Args>(__args)...);
193 }
194 
195 #endif
196 
197 } // namespace fcl
198 
199 #endif
fcl::aligned_allocator_cpp11::difference_type
std::ptrdiff_t difference_type
Definition: types.h:150
fcl::Transform3
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
Definition: types.h:92
fcl::VectorN
Eigen::Matrix< S, N, 1 > VectorN
Definition: types.h:80
fcl::FCL_REAL
FCL_DEPRECATED double FCL_REAL
Definition: types.h:54
fcl::int64
std::int64_t int64
Definition: types.h:60
fcl::Quaternionf
Quaternion< float > Quaternionf
Definition: types.h:106
fcl::uint64
std::uint64_t uint64
Definition: types.h:61
fcl::aligned_allocator_cpp11::aligned_allocator_cpp11
aligned_allocator_cpp11()
Definition: types.h:163
fcl::Quaternion
Eigen::Quaternion< S > Quaternion
Definition: types.h:89
fcl::aligned_allocator_cpp11::~aligned_allocator_cpp11
~aligned_allocator_cpp11()
Definition: types.h:173
fcl::Matrix3f
Matrix3< float > Matrix3f
Definition: types.h:105
fcl::aligned_allocator_cpp11::const_reference
const typedef T & const_reference
Definition: types.h:154
fcl::uint32
std::uint32_t uint32
Definition: types.h:63
fcl::FCL_INT64
FCL_DEPRECATED std::int64_t FCL_INT64
Definition: types.h:55
fcl::VectorNf
VectorN< float, N > VectorNf
Definition: types.h:103
fcl::Transform3d
Transform3< double > Transform3d
Definition: types.h:118
fcl::aligned_allocator_cpp11
Aligned allocator that is compatible with c++11.
Definition: types.h:146
fcl::int32
std::int32_t int32
Definition: types.h:62
fcl::Vector6
Eigen::Matrix< S, 6, 1 > Vector6
Definition: types.h:74
fcl::aligned_allocator_cpp11::aligned_allocator_cpp11
aligned_allocator_cpp11(const aligned_allocator_cpp11< U > &other)
Definition: types.h:170
fcl::uintptr_t
std::uintptr_t uintptr_t
Definition: types.h:65
fcl::VectorX
Eigen::Matrix< S, Eigen::Dynamic, 1 > VectorX
Definition: types.h:83
fcl::aligned_allocator_cpp11::rebind::other
aligned_allocator_cpp11< U > other
Definition: types.h:160
fcl::Vector3d
Vector3< double > Vector3d
Definition: types.h:112
fcl::AngleAxis
Eigen::AngleAxis< S > AngleAxis
Definition: types.h:98
fcl::Vector2
Eigen::Matrix< S, 2, 1 > Vector2
Definition: types.h:68
fcl::FCL_UINT64
FCL_DEPRECATED std::uint64_t FCL_UINT64
Definition: types.h:56
fcl::AngleAxisd
AngleAxis< double > AngleAxisd
Definition: types.h:120
fcl::Vector3
Eigen::Matrix< S, 3, 1 > Vector3
Definition: types.h:71
fcl::Translation3f
Translation3< float > Translation3f
Definition: types.h:108
fcl::aligned_allocator_cpp11::rebind
Definition: types.h:158
fcl::Matrix3
Eigen::Matrix< S, 3, 3 > Matrix3
Definition: types.h:86
fcl::AngleAxisf
AngleAxis< float > AngleAxisf
Definition: types.h:109
fcl::Translation3d
Translation3< double > Translation3d
Definition: types.h:119
fcl::aligned_allocator_cpp11::aligned_allocator_cpp11
aligned_allocator_cpp11(const aligned_allocator_cpp11 &other)
Definition: types.h:166
fcl::Transform3f
Transform3< float > Transform3f
Definition: types.h:107
fcl::VectorXf
VectorX< float > VectorXf
Definition: types.h:104
fcl::VectorNd
VectorN< double, N > VectorNd
Definition: types.h:114
fcl::FCL_INT32
FCL_DEPRECATED std::int32_t FCL_INT32
Definition: types.h:57
fcl::aligned_allocator_cpp11::size_type
std::size_t size_type
Definition: types.h:149
fcl::VectorXd
VectorX< double > VectorXd
Definition: types.h:115
fcl::make_aligned_shared
std::shared_ptr< _Tp > make_aligned_shared(_Args &&... __args)
Definition: types.h:188
fcl::Quaterniond
Quaternion< double > Quaterniond
Definition: types.h:117
fcl::aligned_allocator_cpp11::value_type
T value_type
Definition: types.h:155
fcl::Vector7
Eigen::Matrix< S, 7, 1 > Vector7
Definition: types.h:77
fcl::Translation3
Eigen::Translation< S, 3 > Translation3
Definition: types.h:95
fcl::aligned_allocator_cpp11::allocate
pointer allocate(size_type num, const void *=0)
Definition: types.h:175
fcl::Vector3f
Vector3< float > Vector3f
Definition: types.h:101
fcl::intptr_t
std::intptr_t intptr_t
Definition: types.h:64
fcl::aligned_allocator_cpp11::pointer
T * pointer
Definition: types.h:151
fcl::aligned_allocator_cpp11::const_pointer
const typedef T * const_pointer
Definition: types.h:152
fcl::aligned_map
std::map< _Key, _Tp, _Compare, Eigen::aligned_allocator< std::pair< const _Key, _Tp > >> aligned_map
Definition: types.h:127
fcl::Matrix3d
Matrix3< double > Matrix3d
Definition: types.h:116
fcl::aligned_allocator_cpp11::deallocate
void deallocate(pointer p, size_type)
Definition: types.h:181
fcl::FCL_UINT32
FCL_DEPRECATED std::uint32_t FCL_UINT32
Definition: types.h:58
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
fcl::aligned_vector
std::vector< _Tp, Eigen::aligned_allocator< _Tp > > aligned_vector
Definition: types.h:123
fcl::aligned_allocator_cpp11::reference
T & reference
Definition: types.h:153


fcl
Author(s):
autogenerated on Fri Mar 14 2025 02:38:18