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>
52 mSpecAspectIterator = mAspectMap.insert(
53 std::make_pair<std::type_index, std::unique_ptr<Aspect>>(
54 typeid(SpecAspect),
nullptr)).first;
58 template <
class SpecAspect>
62 return _has(type<T>());
66 template <
class SpecAspect>
70 return _get(type<T>());
74 template <
class SpecAspect>
78 return _get(type<T>());
82 template <
class SpecAspect>
86 _set(type<T>(), aspect);
90 template <
class SpecAspect>
94 _set(type<T>(), std::move(aspect));
98 template <
class SpecAspect>
99 template <
class T,
typename ...Args>
102 return _createAspect(type<T>(), std::forward<Args>(args)...);
106 template <
class SpecAspect>
110 _removeAspect(type<T>());
114 template <
class SpecAspect>
118 return _releaseAspect(type<T>());
122 template <
class SpecAspect>
126 return _isSpecializedFor(type<T>());
130 template <
class SpecAspect>
134 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
135 usedSpecializedAspectAccess =
true;
138 return Composite::has<T>();
142 template <
class SpecAspect>
145 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
146 usedSpecializedAspectAccess =
true;
149 return (mSpecAspectIterator->second.get() !=
nullptr);
153 template <
class SpecAspect>
157 return Composite::get<T>();
161 template <
class SpecAspect>
164 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
165 usedSpecializedAspectAccess =
true;
168 return static_cast<SpecAspect*
>(mSpecAspectIterator->second.get());
172 template <
class SpecAspect>
176 return Composite::get<T>();
180 template <
class SpecAspect>
183 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
184 usedSpecializedAspectAccess =
true;
187 return static_cast<SpecAspect*
>(mSpecAspectIterator->second.get());
191 template <
class SpecAspect>
195 Composite::set<T>(aspect);
199 template <
class SpecAspect>
201 type<SpecAspect>,
const SpecAspect* aspect)
203 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
204 usedSpecializedAspectAccess =
true;
209 mSpecAspectIterator->second = aspect->cloneAspect();
210 addToComposite(mSpecAspectIterator->second.get());
214 mSpecAspectIterator->second =
nullptr;
219 template <
class SpecAspect>
223 Composite::set<T>(std::move(aspect));
227 template <
class SpecAspect>
229 type<SpecAspect>, std::unique_ptr<SpecAspect>&& aspect)
231 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
232 usedSpecializedAspectAccess =
true;
235 mSpecAspectIterator->second = std::move(aspect);
236 addToComposite(mSpecAspectIterator->second.get());
240 template <
class SpecAspect>
241 template <
class T,
typename ...Args>
244 return Composite::createAspect<T>(std::forward<Args>(args)...);
248 template <
class SpecAspect>
249 template <
typename ...Args>
251 type<SpecAspect>, Args&&... args)
253 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
254 usedSpecializedAspectAccess =
true;
257 SpecAspect* aspect =
new SpecAspect(std::forward<Args>(args)...);
258 mSpecAspectIterator->second = std::unique_ptr<SpecAspect>(aspect);
259 addToComposite(aspect);
265 template <
class SpecAspect>
269 Composite::removeAspect<T>();
273 template <
class SpecAspect>
276 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
277 usedSpecializedAspectAccess =
true;
282 removeFromComposite(mSpecAspectIterator->second.get());
283 mSpecAspectIterator->second =
nullptr;
287 template <
class SpecAspect>
291 return Composite::releaseAspect<T>();
295 template <
class SpecAspect>
299 #ifdef DART_UNITTEST_SPECIALIZED_ASPECT_ACCESS
300 usedSpecializedAspectAccess =
true;
305 removeFromComposite(mSpecAspectIterator->second.get());
306 std::unique_ptr<SpecAspect> extraction(
307 static_cast<SpecAspect*
>(mSpecAspectIterator->second.release()));
313 template <
class SpecAspect>
321 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:63