33 #ifndef DART_COMMON_ASPECT_HPP_
34 #define DART_COMMON_ASPECT_HPP_
68 template <
class Mixin>
87 template <
class Mixin>
127 template <
class CompositeType>
161 #define DART_COMMON_ASPECT_PROPERTY_CONSTRUCTOR( ClassName, UpdatePropertiesMacro )\
162 ClassName (const ClassName &) = delete;\
163 inline ClassName (const PropertiesData& properties = PropertiesData())\
164 : AspectWithVersionedProperties< Base, Derived, PropertiesData, CompositeType, UpdatePropertiesMacro>(properties) { }
167 #define DART_COMMON_ASPECT_STATE_PROPERTY_CONSTRUCTORS(ClassName)\
168 ClassName (const ClassName &) = delete;\
169 inline ClassName (const StateData& state = StateData(), const PropertiesData& properties = PropertiesData())\
170 : AspectImpl(state, properties) { }\
171 inline ClassName (const PropertiesData& properties, const StateData state = StateData())\
172 : AspectImpl(properties, state) { }
175 #define DART_COMMON_SET_ASPECT_PROPERTY_CUSTOM( Type, Name, Update )\
176 inline void set ## Name (const Type & value)\
177 { mProperties.m ## Name = value; Update(); }
180 #define DART_COMMON_SET_ASPECT_PROPERTY( Type, Name )\
181 DART_COMMON_SET_ASPECT_PROPERTY_CUSTOM( Type, Name, notifyPropertiesUpdated )
184 #define DART_COMMON_GET_ASPECT_PROPERTY( Type, Name )\
185 inline const Type& get ## Name () const\
186 { return mProperties.m ## Name; }
189 #define DART_COMMON_SET_GET_ASPECT_PROPERTY( Type, Name )\
190 DART_COMMON_SET_ASPECT_PROPERTY( Type, Name )\
191 DART_COMMON_GET_ASPECT_PROPERTY( Type, Name )
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
virtual std::unique_ptr< Aspect > cloneAspect() const =0
Clone this Aspect into a new composite.
virtual void setAspectProperties(const Properties &someProperties)
Set the Properties of this Aspect. By default, this does nothing.
Definition: Aspect.cpp:56
virtual const State * getAspectState() const
Get the State of this Aspect.
Definition: Aspect.cpp:50
virtual void setAspectState(const State &otherState)
Set the State of this Aspect. By default, this does nothing.
Definition: Aspect.cpp:44
virtual const Properties * getAspectProperties() const
Get the Properties of this Aspect.
Definition: Aspect.cpp:62
virtual ~Aspect()=default
Virtual destructor.
virtual void setComposite(Composite *newComposite)
This function will be triggered (1) after the Aspect has been created [transfer will be false] and (2...
Definition: Aspect.cpp:68
virtual void loseComposite(Composite *oldComposite)
This function will be triggered if your Aspect is about to be removed from its Composite.
Definition: Aspect.cpp:74
Cloneable is a CRTP base class that provides an interface for easily creating data structures that ar...
Definition: Cloneable.hpp:54
Definition: Aspect.hpp:129
CompositeTrackingAspect()
Default constructor.
Definition: Aspect.hpp:46
void setComposite(Composite *newComposite) override
Grab the new Composite.
Definition: Aspect.hpp:75
CompositeType * getComposite()
Get the Composite of this Aspect.
Definition: Aspect.hpp:54
CompositeType * mComposite
Pointer to the current Composite of this Aspect.
Definition: Aspect.hpp:153
bool hasComposite() const
Returns true if this Aspect has a Composite that matches CompositeType.
Definition: Aspect.hpp:68
void loseComposite(Composite *oldComposite) override
Clear the old Composite.
Definition: Aspect.hpp:87
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
Definition: BulletCollisionDetector.cpp:63