33 #ifndef DART_COMMON_DETAIL_SPECIALIZEDFORASPECT_HPP_
34 #define DART_COMMON_DETAIL_SPECIALIZEDFORASPECT_HPP_
41 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
42 bool usedSpecializedAspectAccess;
49 template <
class SpecAspect>
54 .insert(std::make_pair<std::type_index, std::unique_ptr<Aspect>>(
55 typeid(SpecAspect),
nullptr))
60 template <
class SpecAspect>
64 return _has(type<T>());
68 template <
class SpecAspect>
72 return _get(type<T>());
76 template <
class SpecAspect>
80 return _get(type<T>());
84 template <
class SpecAspect>
88 _set(type<T>(), aspect);
92 template <
class SpecAspect>
96 _set(type<T>(), std::move(aspect));
100 template <
class SpecAspect>
101 template <
class T,
typename... Args>
104 return _createAspect(type<T>(), std::forward<Args>(args)...);
108 template <
class SpecAspect>
112 _removeAspect(type<T>());
116 template <
class SpecAspect>
120 return _releaseAspect(type<T>());
124 template <
class SpecAspect>
128 return _isSpecializedFor(type<T>());
132 template <
class SpecAspect>
136 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
137 usedSpecializedAspectAccess =
true;
140 return Composite::has<T>();
144 template <
class SpecAspect>
147 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
148 usedSpecializedAspectAccess =
true;
151 return (mSpecAspectIterator->second.get() !=
nullptr);
155 template <
class SpecAspect>
159 return Composite::get<T>();
163 template <
class SpecAspect>
166 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
167 usedSpecializedAspectAccess =
true;
170 return static_cast<SpecAspect*
>(mSpecAspectIterator->second.get());
174 template <
class SpecAspect>
178 return Composite::get<T>();
182 template <
class SpecAspect>
185 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
186 usedSpecializedAspectAccess =
true;
189 return static_cast<SpecAspect*
>(mSpecAspectIterator->second.get());
193 template <
class SpecAspect>
197 Composite::set<T>(aspect);
201 template <
class SpecAspect>
203 type<SpecAspect>,
const SpecAspect* aspect)
205 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
206 usedSpecializedAspectAccess =
true;
211 mSpecAspectIterator->second = aspect->cloneAspect();
212 addToComposite(mSpecAspectIterator->second.get());
216 mSpecAspectIterator->second =
nullptr;
221 template <
class SpecAspect>
224 type<T>, std::unique_ptr<T>&& aspect)
226 Composite::set<T>(std::move(aspect));
230 template <
class SpecAspect>
232 type<SpecAspect>, std::unique_ptr<SpecAspect>&& aspect)
234 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
235 usedSpecializedAspectAccess =
true;
238 mSpecAspectIterator->second = std::move(aspect);
239 addToComposite(mSpecAspectIterator->second.get());
243 template <
class SpecAspect>
244 template <
class T,
typename... Args>
247 return Composite::createAspect<T>(std::forward<Args>(args)...);
251 template <
class SpecAspect>
252 template <
typename... Args>
254 type<SpecAspect>, Args&&... args)
256 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
257 usedSpecializedAspectAccess =
true;
260 SpecAspect* aspect =
new SpecAspect(std::forward<Args>(args)...);
261 mSpecAspectIterator->second = std::unique_ptr<SpecAspect>(aspect);
262 addToComposite(aspect);
268 template <
class SpecAspect>
272 Composite::removeAspect<T>();
276 template <
class SpecAspect>
279 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
280 usedSpecializedAspectAccess =
true;
285 removeFromComposite(mSpecAspectIterator->second.get());
286 mSpecAspectIterator->second =
nullptr;
290 template <
class SpecAspect>
294 return Composite::releaseAspect<T>();
298 template <
class SpecAspect>
302 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
303 usedSpecializedAspectAccess =
true;
308 removeFromComposite(mSpecAspectIterator->second.get());
309 std::unique_ptr<SpecAspect> extraction(
310 static_cast<SpecAspect*
>(mSpecAspectIterator->second.release()));
316 template <
class SpecAspect>
324 template <
class SpecAspect>
#define DART_BLANK
Definition: NoOp.hpp:55
Declaration of the variadic template.
Definition: SpecializedForAspect.hpp:46
#define DART_COMMON_CHECK_ILLEGAL_ASPECT_ERASE(Func, T, ReturnType)
Definition: Composite.hpp:38
Definition: BulletCollisionDetector.cpp:65