33#ifndef DART_COMMON_MEMORY_HPP_
34#define DART_COMMON_MEMORY_HPP_
42#include "dart/config.hpp"
47template <
typename _Tp,
typename... _Args>
51template <
typename T,
typename... Args>
55#if EIGEN_VERSION_AT_LEAST(3, 2, 1) && EIGEN_VERSION_AT_MOST(3, 2, 8)
57template <
typename _Tp>
59 = std::vector<_Tp, dart::common::detail::aligned_allocator_cpp11<_Tp>>;
61template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>>
66 dart::common::detail::aligned_allocator_cpp11<std::pair<const _Key, _Tp>>>;
70template <
typename _Tp>
73template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>>
78 Eigen::aligned_allocator<std::pair<const _Key, _Tp>>>;
85#define DART_RAW_PTR_CREATOR_NAME create
86#define DART_SHARED_PTR_CREATOR_NAME createShared
87#define DART_UNIQUE_PTR_CREATOR_NAME createUnique
90#define _DART_DEFINE_OBJECT_CREATOR(class_name, func_name, ptr_type, creator) \
91 template <typename... Args> \
92 static ptr_type<class_name> func_name(Args&&... args) \
94 return creator<class_name>(std::forward<Args>(args)...); \
99#define _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
100 class_name, func_name, ptr_type, creator) \
102 struct private_structure \
104 explicit private_structure() \
110 template <typename... Args> \
111 class_name(const private_structure&, Args&&... args) \
112 : class_name(std::forward<Args>(args)...) \
115 template <typename... Args> \
116 static ptr_type<class_name> func_name(Args&&... args) \
118 return creator<class_name>( \
119 private_structure{}, std::forward<Args>(args)...); \
124#define DART_DEFINE_RAW_OBJECT_CREATOR(class_name) \
125 template <typename... Args> \
126 static class_name* DART_RAW_PTR_CREATOR_NAME(Args&&... args) \
128 return new class_name(std::forward<Args>(args)...); \
133#define DART_DEFINE_SHARED_OBJECT_CREATOR(class_name) \
135 _DART_DEFINE_OBJECT_CREATOR( \
137 DART_SHARED_PTR_CREATOR_NAME, \
144#define DART_DEFINE_SHARED_OBJECT_CREATOR_FOR_PROTECTED_CTOR(class_name) \
146 _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
148 DART_SHARED_PTR_CREATOR_NAME, \
155#define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name) \
157 _DART_DEFINE_OBJECT_CREATOR( \
159 DART_SHARED_PTR_CREATOR_NAME, \
161 ::dart::common::make_aligned_shared)
166#define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
169 _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
171 DART_SHARED_PTR_CREATOR_NAME, \
173 ::dart::common::make_aligned_shared)
176#define DART_DEFINE_UNIQUE_OBJECT_CREATOR(class_name) \
178 _DART_DEFINE_OBJECT_CREATOR( \
180 DART_UNIQUE_PTR_CREATOR_NAME, \
186#define DART_DEFINE_UNIQUE_OBJECT_CREATOR_FOR_PROTECTED_CTOR(class_name) \
188 _DART_DEFINE_OBJECT_CREATOR_FOR_PROTECTED_CTOR( \
190 DART_UNIQUE_PTR_CREATOR_NAME, \
196#define DART_DEFINE_OBJECT_CREATORS(class_name) \
197 DART_DEFINE_SHARED_OBJECT_CREATOR(class_name) \
198 DART_DEFINE_UNIQUE_OBJECT_CREATOR(class_name)
203#define DART_DEFINE_OBJECT_CREATORS_FOR_PROTECTED_CTOR(X) \
204 DART_DEFINE_SHARED_OBJECT_CREATOR_FOR_PROTECTED_CTOR(X) \
205 DART_DEFINE_UNIQUE_OBJECT_CREATOR_FOR_PROTECTED_CTOR(X)
210# define DART_DEFINE_ALIGNED_OBJECT_CREATORS(class_name) \
211 DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name) \
212 DART_DEFINE_UNIQUE_OBJECT_CREATOR(class_name)
214# define DART_DEFINE_ALIGNED_OBJECT_CREATORS(class_name) \
215 DART_DEFINE_OBJECT_CREATORS(class_name)
222# define DART_DEFINE_ALIGNED_OBJECT_CREATORS_FOR_PROTECTED_CTOR(class_name) \
223 DART_DEFINE_CREATE_ALIGNED_PTR_SHARED_FOR_PROTECTED_CTOR(class_name) \
224 DART_DEFINE_UNIQUE_OBJECT_CREATOR_FOR_PROTECTED_CTOR(class_name)
226# define DART_DEFINE_ALIGNED_OBJECT_CREATORS_FOR_PROTECTED_CTOR(class_name) \
227 DART_DEFINE_OBJECT_CREATORS_FOR_PROTECTED_CTOR(class_name)
#define DART_DEPRECATED(version)
Definition Deprecated.hpp:51
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:67
std::vector< _Tp, Eigen::aligned_allocator< _Tp > > aligned_vector
Definition Memory.hpp:71
std::map< _Key, _Tp, _Compare, Eigen::aligned_allocator< std::pair< const _Key, _Tp > > > aligned_map
Definition Memory.hpp:78
Definition BulletCollisionDetector.cpp:65
Definition SharedLibraryManager.hpp:46