33 #ifndef DART_COMMON_DETAIL_ASPECTWITHVERSION_HPP_
34 #define DART_COMMON_DETAIL_ASPECTWITHVERSION_HPP_
47 template <
class BaseT,
class DerivedT,
typename StateDataT,
49 void (*updateState)(DerivedT*) = &NoOp<DerivedT*> >
59 constexpr
static void (*UpdateState)(
Derived*) = updateState;
70 template <
typename... BaseArgs>
73 :
Base(
std::forward<BaseArgs>(args)...),
80 void setAspectState(
const Aspect::State& otherState)
override final;
86 void setState(const StateData& state);
89 const State& getState() const;
92 std::unique_ptr<
Aspect> cloneAspect() const override;
103 template <class BaseT, class DerivedT, typename PropertiesDataT,
105 void (*updateProperties)(DerivedT*) = &
NoOp<DerivedT*> >
115 constexpr
static void (*UpdateProperties)(
Derived*) = updateProperties;
127 template <
typename... BaseArgs>
130 :
Base(
std::forward<BaseArgs>(args)...),
152 std::
size_t incrementVersion();
156 void notifyPropertiesUpdate();
159 void notifyPropertiesUpdated();
175 template <class BaseT, class DerivedT, typename StateDataT,
176 class CompositeT,
void (*updateState)(DerivedT*)>
178 BaseT, DerivedT, StateDataT, CompositeT, updateState>::UpdateState)(
182 template <class BaseT, class DerivedT, typename StateDataT,
183 class CompositeT,
void (*updateState)(DerivedT*)>
184 AspectWithState<BaseT, DerivedT, StateDataT, CompositeT, updateState>::
193 template <
class BaseT,
class DerivedT,
typename StateData,
194 class CompositeT, void (*updateState)(DerivedT*)>
198 setState(
static_cast<const State&
>(otherState));
202 template <
class BaseT,
class DerivedT,
typename StateData,
203 class CompositeT, void (*updateState)(DerivedT*)>
206 getAspectState()
const
212 template <
class BaseT,
class DerivedT,
typename StateData,
213 class CompositeT, void (*updateState)(DerivedT*)>
218 UpdateState(
static_cast<Derived*
>(
this));
222 template <
class BaseT,
class DerivedT,
typename StateDataT,
223 class CompositeT, void (*updateState)(DerivedT*)>
225 getState()
const ->
const State&
231 template <
class BaseT,
class DerivedT,
typename StateData,
232 class CompositeT, void (*updateState)(DerivedT*)>
233 std::unique_ptr<Aspect>
237 return common::make_unique<Derived>(mState);
247 template <
class BaseT,
class DerivedT,
typename PropertiesDataT,
248 class CompositeT, void (*updateProperties)(DerivedT*)>
250 CompositeT, updateProperties>::
251 UpdateProperties)(DerivedT*);
254 template <
class BaseT,
class DerivedT,
typename PropertiesDataT,
255 class CompositeT, void (*updateProperties)(DerivedT*)>
257 CompositeT, updateProperties>::
266 template <
class BaseT,
class DerivedT,
typename PropertiesData,
267 class CompositeT, void (*updateProperties)(DerivedT*)>
269 CompositeT, updateProperties>::
272 setProperties(
static_cast<const Properties&
>(someProperties));
276 template <
class BaseT,
class DerivedT,
typename PropertiesData,
277 class CompositeT, void (*updateProperties)(DerivedT*)>
280 CompositeT, updateProperties>::
281 getAspectProperties()
const
287 template <
class BaseT,
class DerivedT,
typename PropertiesData,
288 class CompositeT, void (*updateProperties)(DerivedT*)>
290 CompositeT, updateProperties>::
294 this->notifyPropertiesUpdated();
298 template <
class BaseT,
class DerivedT,
typename PropertiesData,
299 class CompositeT, void (*updateProperties)(DerivedT*)>
301 CompositeT, updateProperties>::
308 template <
class BaseT,
class DerivedT,
typename PropertiesData,
309 class CompositeT, void (*updateProperties)(DerivedT*)>
310 std::unique_ptr<Aspect>
312 CompositeT, updateProperties>::
315 return common::make_unique<Derived>(mProperties);
319 template <
class BaseT,
class DerivedT,
typename PropertiesData,
320 class CompositeT, void (*updateProperties)(DerivedT*)>
322 CompositeT, updateProperties>::incrementVersion()
331 template <
class BaseT,
class DerivedT,
typename PropertiesData,
332 class CompositeT, void (*updateProperties)(DerivedT*)>
334 BaseT, DerivedT, PropertiesData,
335 CompositeT, updateProperties>::notifyPropertiesUpdate()
337 notifyPropertiesUpdated();
341 template <
class BaseT,
class DerivedT,
typename PropertiesData,
342 class CompositeT, void (*updateProperties)(DerivedT*)>
344 BaseT, DerivedT, PropertiesData,
345 CompositeT, updateProperties>::notifyPropertiesUpdated()
347 UpdateProperties(
static_cast<Derived*
>(
this));
348 this->incrementVersion();
#define DART_DEPRECATED(version)
Definition: Deprecated.hpp:51
BodyPropPtr properties
Definition: SdfParser.cpp:80
If your Aspect has Properties, then that Properties class should inherit this Aspect::Properties clas...
Definition: Aspect.hpp:83
If your Aspect has a State, then that State class should inherit this Aspect::State class.
Definition: Aspect.hpp:64
Definition: Aspect.hpp:47
Composite is a base class that should be virtually inherited by any class that wants to be able to ma...
Definition: Composite.hpp:52
The MakeCloneable class is used to easily create an Cloneable (such as Node::State) which simply take...
Definition: Cloneable.hpp:85
AspectWithProtectedState generates implementations of the State managing functions for an Aspect clas...
Definition: AspectWithVersion.hpp:51
CompositeT CompositeType
Definition: AspectWithVersion.hpp:57
AspectWithState(const StateData &state, BaseArgs &&... args)
Construct this Aspect and pass args into the constructor of the Base class.
Definition: AspectWithVersion.hpp:71
AspectWithState(const AspectWithState &)=delete
DerivedT Derived
Definition: AspectWithVersion.hpp:55
BaseT Base
Definition: AspectWithVersion.hpp:54
StateDataT StateData
Definition: AspectWithVersion.hpp:56
AspectWithState(const StateData &state=StateData())
Construct using a StateData instance.
AspectWithProtectedProperties generates implementations of the Property managing functions for an Asp...
Definition: AspectWithVersion.hpp:107
std::size_t incrementVersion()
Increment the version of this Aspect and its Composite.
Definition: AspectWithVersion.hpp:322
PropertiesDataT PropertiesData
Definition: AspectWithVersion.hpp:112
AspectWithVersionedProperties(const PropertiesData &properties, BaseArgs &&... args)
Construct this Aspect and pass args into the constructor of the Base class.
Definition: AspectWithVersion.hpp:128
const Aspect::Properties * getAspectProperties() const override final
Definition: AspectWithVersion.hpp:281
CompositeT CompositeType
Definition: AspectWithVersion.hpp:113
void setAspectProperties(const Aspect::Properties &someProperties) override final
Definition: AspectWithVersion.hpp:270
AspectWithVersionedProperties(const AspectWithVersionedProperties &)=delete
AspectWithVersionedProperties(const PropertiesData &properties=PropertiesData())
Construct using a PropertiesData instance.
Definition: AspectWithVersion.hpp:258
DerivedT Derived
Definition: AspectWithVersion.hpp:111
BaseT Base
Definition: AspectWithVersion.hpp:110
void NoOp(Args...)
NoOp is short for "no operation".
Definition: NoOp.hpp:44
constexpr void(* AspectWithVersionedProperties)(DerivedT *)
Definition: AspectWithVersion.hpp:251
Definition: BulletCollisionDetector.cpp:63
Definition: SharedLibraryManager.hpp:43