33 #ifndef DART_COMMON_ASPECT_HPP_ 34 #define DART_COMMON_ASPECT_HPP_ 38 #include "dart/common/ClassWithVirtualBase.hpp" 39 #include "dart/common/Cloneable.hpp" 40 #include "dart/common/detail/NoOp.hpp" 70 template <
class Mixin>
91 template <
class Mixin>
98 virtual std::unique_ptr<Aspect>
cloneAspect()
const = 0;
130 template <
class CompositeType>
138 CompositeType* getComposite();
141 const CompositeType* getComposite()
const;
144 bool hasComposite()
const;
161 #define DART_COMMON_ASPECT_PROPERTY_CONSTRUCTOR( \ 162 ClassName, UpdatePropertiesMacro) \ 163 ClassName(const ClassName&) = delete; \ 164 inline ClassName(const PropertiesData& properties = PropertiesData()) \ 165 : AspectWithVersionedProperties< \ 170 UpdatePropertiesMacro>(properties) \ 175 #define DART_COMMON_ASPECT_STATE_PROPERTY_CONSTRUCTORS(ClassName) \ 176 ClassName(const ClassName&) = delete; \ 178 const StateData& state = StateData(), \ 179 const PropertiesData& properties = PropertiesData()) \ 180 : AspectImpl(state, properties) \ 184 const PropertiesData& properties, const StateData state = StateData()) \ 185 : AspectImpl(properties, state) \ 190 #define DART_COMMON_SET_ASPECT_PROPERTY_CUSTOM(Type, Name, Update) \ 191 inline void set##Name(const Type& value) \ 193 mProperties.m##Name = value; \ 198 #define DART_COMMON_SET_ASPECT_PROPERTY(Type, Name) \ 199 DART_COMMON_SET_ASPECT_PROPERTY_CUSTOM(Type, Name, notifyPropertiesUpdated) 202 #define DART_COMMON_GET_ASPECT_PROPERTY(Type, Name) \ 203 inline const Type& get##Name() const \ 205 return mProperties.m##Name; \ 209 #define DART_COMMON_SET_GET_ASPECT_PROPERTY(Type, Name) \ 210 DART_COMMON_SET_ASPECT_PROPERTY(Type, Name) \ 211 DART_COMMON_GET_ASPECT_PROPERTY(Type, Name) 213 #include "dart/common/detail/Aspect.hpp" 215 #endif // DART_COMMON_ASPECT_HPP_ virtual ~Aspect()=default
Virtual destructor.
virtual void setAspectState(const State &otherState)
Set the State of this Aspect. By default, this does nothing.
Definition: Aspect.cpp:44
Cloneable is a CRTP base class that provides an interface for easily creating data structures that ar...
Definition: Cloneable.hpp:53
The MakeCloneable class is used to easily create an Cloneable (such as Node::State) which simply take...
Definition: Cloneable.hpp:83
Definition: Aspect.hpp:131
If your Aspect has Properties, then that Properties class should inherit this Aspect::Properties clas...
Definition: Aspect.hpp:85
virtual void setAspectProperties(const Properties &someProperties)
Set the Properties of this Aspect. By default, this does nothing.
Definition: Aspect.cpp:56
Definition: Aspect.cpp:40
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 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 const Properties * getAspectProperties() const
Get the Properties of this Aspect.
Definition: Aspect.cpp:62
Composite is a base class that should be virtually inherited by any class that wants to be able to ma...
Definition: Composite.hpp:52
CompositeType * mComposite
Pointer to the current Composite of this Aspect.
Definition: Aspect.hpp:154
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
virtual const State * getAspectState() const
Get the State of this Aspect.
Definition: Aspect.cpp:50
virtual std::unique_ptr< Aspect > cloneAspect() const =0
Clone this Aspect into a new composite.