33 #ifndef DART_COMMON_MEMORY_HPP_
34 #define DART_COMMON_MEMORY_HPP_
40 #include "dart/config.hpp"
47 template <
typename _Tp,
typename... _Args>
50 template<
typename T,
typename... Args>
53 #if EIGEN_VERSION_AT_LEAST(3,2,1) && EIGEN_VERSION_AT_MOST(3,2,8)
55 template <
typename _Tp>
57 dart::common::detail::aligned_allocator_cpp11<_Tp>>;
59 template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>>
61 dart::common::detail::aligned_allocator_cpp11<std::pair<const _Key, _Tp>>>;
65 template <
typename _Tp>
68 template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>>
70 Eigen::aligned_allocator<std::pair<const _Key, _Tp>>>;
77 #define DART_RAW_PTR_CREATOR_NAME create
78 #define DART_SHARED_PTR_CREATOR_NAME createShared
79 #define DART_UNIQUE_PTR_CREATOR_NAME createUnique
82 #define _DART_DEFINE_OBJECT_CREATOR( \
83 class_name, func_name, ptr_type, creator) \
84 template <typename... Args> \
85 static ptr_type<class_name> func_name(Args&&... args) \
87 return creator<class_name>(std::forward<Args>(args)...); \
92 #define _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
93 class_name, func_name, ptr_type, creator) \
95 struct private_structure \
97 explicit private_structure() \
103 template <typename... Args> \
104 class_name(const private_structure&, Args&&... args) \
105 : class_name(std::forward<Args>(args)...) \
108 template <typename... Args> \
109 static ptr_type<class_name> func_name(Args&&... args) \
111 return creator<class_name>( \
112 private_structure{}, std::forward<Args>(args)...); \
117 #define DART_DEFINE_RAW_OBJECT_CREATOR(class_name) \
118 template <typename... Args> \
119 static class_name* DART_RAW_PTR_CREATOR_NAME(Args&&... args) \
121 return new class_name(std::forward<Args>(args)...); \
126 #define DART_DEFINE_SHARED_OBJECT_CREATOR(class_name) \
128 _DART_DEFINE_OBJECT_CREATOR( \
130 DART_SHARED_PTR_CREATOR_NAME, \
137 #define DART_DEFINE_SHARED_OBJECT_CREATOR_FOR_PROTECTED_CTOR(class_name) \
139 _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
141 DART_SHARED_PTR_CREATOR_NAME, \
148 #define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name) \
150 _DART_DEFINE_OBJECT_CREATOR( \
152 DART_SHARED_PTR_CREATOR_NAME, \
154 ::dart::common::make_aligned_shared)
159 #define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
162 _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
164 DART_SHARED_PTR_CREATOR_NAME, \
166 ::dart::common::make_aligned_shared)
169 #define DART_DEFINE_UNIQUE_OBJECT_CREATOR(class_name) duke \
171 _DART_DEFINE_OBJECT_CREATOR( \
173 DART_UNIQUE_PTR_CREATOR_NAME, \
175 ::dart::common::make_unique)
179 #define DART_DEFINE_UNIQUE_OBJECT_CREATOR_FOR_PROTECTED_CTOR(class_name) \
181 _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
183 DART_UNIQUE_PTR_CREATOR_NAME, \
185 ::dart::common::make_unique)
189 #define DART_DEFINE_OBJECT_CREATORS(class_name) \
190 DART_DEFINE_SHARED_OBJECT_CREATOR(class_name) \
191 DART_DEFINE_UNIQUE_OBJECT_CREATOR(class_name)
196 #define DART_DEFINE_OBJECT_CREATORS_FOR_PROTECTED_CTOR(X) \
197 DART_DEFINE_SHARED_OBJECT_CREATOR_FOR_PROTECTED_CTOR(X) \
198 DART_DEFINE_UNIQUE_OBJECT_CREATOR_FOR_PROTECTED_CTOR(X)
203 #define DART_DEFINE_ALIGNED_OBJECT_CREATORS(class_name) \
204 DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name) \
205 DART_DEFINE_UNIQUE_OBJECT_CREATOR(class_name)
207 #define DART_DEFINE_ALIGNED_OBJECT_CREATORS(class_name) \
208 DART_DEFINE_OBJECT_CREATORS(class_name)
215 #define DART_DEFINE_ALIGNED_OBJECT_CREATORS_FOR_PROTECTED_CTOR(class_name) \
216 DART_DEFINE_CREATE_ALIGNED_PTR_SHARED_FOR_PROTECTED_CTOR(class_name) \
217 DART_DEFINE_UNIQUE_OBJECT_CREATOR_FOR_PROTECTED_CTOR(class_name)
219 #define DART_DEFINE_ALIGNED_OBJECT_CREATORS_FOR_PROTECTED_CTOR(class_name) \
220 DART_DEFINE_OBJECT_CREATORS_FOR_PROTECTED_CTOR(class_name)
std::shared_ptr< _Tp > make_aligned_shared(_Args &&... __args)
Definition: Memory-impl.hpp:51
std::unique_ptr< T > make_unique(Args &&... args)
Definition: Memory-impl.hpp:66
std::map< _Key, _Tp, _Compare, Eigen::aligned_allocator< std::pair< const _Key, _Tp > >> aligned_map
Definition: Memory.hpp:70
std::vector< _Tp, Eigen::aligned_allocator< _Tp > > aligned_vector
Definition: Memory.hpp:66
Definition: BulletCollisionDetector.cpp:63