33#ifndef DART_COMMON_DETAIL_SPECIALIZEDFORASPECT_HPP_
34#define DART_COMMON_DETAIL_SPECIALIZEDFORASPECT_HPP_
41#ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
42bool usedSpecializedAspectAccess;
49template <
class SpecAspect>
54 .insert(std::make_pair<std::type_index, std::unique_ptr<Aspect>>(
55 typeid(SpecAspect),
nullptr))
60template <
class SpecAspect>
64 return _has(type<T>());
68template <
class SpecAspect>
72 return _get(type<T>());
76template <
class SpecAspect>
80 return _get(type<T>());
84template <
class SpecAspect>
88 _set(type<T>(), aspect);
92template <
class SpecAspect>
96 _set(type<T>(), std::move(aspect));
100template <
class SpecAspect>
101template <
class T,
typename... Args>
104 return _createAspect(type<T>(), std::forward<Args>(args)...);
108template <
class SpecAspect>
112 _removeAspect(type<T>());
116template <
class SpecAspect>
120 return _releaseAspect(type<T>());
124template <
class SpecAspect>
128 return _isSpecializedFor(type<T>());
132template <
class SpecAspect>
136#ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
137 usedSpecializedAspectAccess =
true;
140 return Composite::has<T>();
144template <
class SpecAspect>
147#ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
148 usedSpecializedAspectAccess =
true;
151 return (mSpecAspectIterator->second.get() !=
nullptr);
155template <
class SpecAspect>
159 return Composite::get<T>();
163template <
class SpecAspect>
166#ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
167 usedSpecializedAspectAccess =
true;
170 return static_cast<SpecAspect*
>(mSpecAspectIterator->second.get());
174template <
class SpecAspect>
178 return Composite::get<T>();
182template <
class SpecAspect>
185#ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
186 usedSpecializedAspectAccess =
true;
189 return static_cast<SpecAspect*
>(mSpecAspectIterator->second.get());
193template <
class SpecAspect>
197 Composite::set<T>(aspect);
201template <
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;
221template <
class SpecAspect>
224 type<T>, std::unique_ptr<T>&& aspect)
226 Composite::set<T>(std::move(aspect));
230template <
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());
243template <
class SpecAspect>
244template <
class T,
typename... Args>
247 return Composite::createAspect<T>(std::forward<Args>(args)...);
251template <
class SpecAspect>
252template <
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);
268template <
class SpecAspect>
272 Composite::removeAspect<T>();
276template <
class SpecAspect>
279#ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
280 usedSpecializedAspectAccess =
true;
285 removeFromComposite(mSpecAspectIterator->second.get());
286 mSpecAspectIterator->second =
nullptr;
290template <
class SpecAspect>
294 return Composite::releaseAspect<T>();
298template <
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()));
316template <
class SpecAspect>
324template <
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