|
DART 6.12.2
|
SpecializedForAspect allows classes that inherit Composite to have constant-time access to a specific type of Aspect. More...
#include <SpecializedForAspect.hpp>
Classes | |
| struct | type |
Public Types | |
| using | State = detail::CompositeState |
| using | Properties = detail::CompositeProperties |
| using | AspectMap = std::map< std::type_index, std::unique_ptr< Aspect > > |
| using | RequiredAspectSet = std::unordered_set< std::type_index > |
| template<typename... Aspects> | |
| using | MakeState = detail::MakeCompositeState< Aspects... > |
| template<typename... Aspects> | |
| using | MakeProperties = detail::MakeCompositeProperties< Aspects... > |
Public Member Functions | |
| SpecializedForAspect () | |
| Default Constructor. | |
| virtual | ~SpecializedForAspect ()=default |
| template<class T > | |
| bool | has () const |
| Check if this Composite currently has a certain type of Aspect. | |
| template<class T > | |
| T * | get () |
| Get a certain type of Aspect from this Composite. | |
| template<class T > | |
| const T * | get () const |
| Get a certain type of Aspect from this Composite. | |
| template<class T > | |
| void | set (const T *aspect) |
| Make a clone of the aspect and place the clone into this Composite. | |
| template<class T > | |
| void | set (std::unique_ptr< T > &&aspect) |
| Use move semantics to place an aspect into this Composite. | |
| template<class T , typename... Args> | |
| T * | createAspect (Args &&... args) |
| Construct an Aspect inside of this Composite. | |
| template<class T > | |
| void | removeAspect () |
| Remove an Aspect from this Composite. | |
| template<class T > | |
| std::unique_ptr< T > | releaseAspect () |
| Remove an Aspect from this Composite, but return its unique_ptr instead of letting it be deleted. | |
| template<class T > | |
| bool | requiresAspect () const |
| Check if this Composite requires this specific type of Aspect. | |
| void | setCompositeState (const State &newStates) |
| Set the states of the aspects in this Composite based on the given Composite::State. | |
| State | getCompositeState () const |
| Get the states of the aspects inside of this Composite. | |
| void | copyCompositeStateTo (State &outgoingStates) const |
| Fill outgoingStates with the states of the aspects inside this Composite. | |
| void | setCompositeProperties (const Properties &newProperties) |
| Set the properties of the aspects in this Composite based on the given Composite::Properties. | |
| Properties | getCompositeProperties () const |
| Get the properties of the aspects inside of this Composite. | |
| void | copyCompositePropertiesTo (Properties &outgoingProperties) const |
| Fill outgoingProperties with the properties of the aspects inside this Composite. | |
| void | duplicateAspects (const Composite *fromComposite) |
| Give this Composite a copy of each Aspect from otherComposite. | |
| void | matchAspects (const Composite *otherComposite) |
| Make the Aspects of this Composite match the Aspects of otherComposite. | |
Static Public Member Functions | |
| template<class T > | |
| static constexpr bool | isSpecializedFor () |
| Check if this Composite is specialized for a specific type of Aspect. | |
Protected Member Functions | |
| template<class T > | |
| bool | _has (type< T >) const |
| Redirect to Composite::has() | |
| bool | _has (type< SpecAspect >) const |
| Specialized implementation of has() | |
| template<class T > | |
| T * | _get (type< T >) |
| Redirect to Composite::get() | |
| SpecAspect * | _get (type< SpecAspect >) |
| Specialized implementation of get() | |
| template<class T > | |
| const T * | _get (type< T >) const |
| Redirect to Composite::get() | |
| const SpecAspect * | _get (type< SpecAspect >) const |
| Specialized implementation of get() | |
| template<class T > | |
| void | _set (type< T >, const T *aspect) |
| Redirect to Composite::set() | |
| void | _set (type< SpecAspect >, const SpecAspect *aspect) |
| Specialized implementation of set() | |
| template<class T > | |
| void | _set (type< T >, std::unique_ptr< T > &&aspect) |
| Redirect to Composite::set() | |
| void | _set (type< SpecAspect >, std::unique_ptr< SpecAspect > &&aspect) |
| Specialized implementation of set() | |
| template<class T , typename... Args> | |
| T * | _createAspect (type< T >, Args &&... args) |
| Redirect to Composite::create() | |
| template<typename... Args> | |
| SpecAspect * | _createAspect (type< SpecAspect >, Args &&... args) |
| Specialized implementation of create() | |
| template<class T > | |
| void | _removeAspect (type< T >) |
| Redirect to Composite::erase() | |
| void | _removeAspect (type< SpecAspect >) |
| Specialized implementation of erase() | |
| template<class T > | |
| std::unique_ptr< T > | _releaseAspect (type< T >) |
| Redirect to Composite::release() | |
| std::unique_ptr< SpecAspect > | _releaseAspect (type< SpecAspect >) |
| Specialized implementation of release() | |
| void | addToComposite (Aspect *aspect) |
| Add this Aspect to the Composite. | |
| void | removeFromComposite (Aspect *aspect) |
| Remove this Aspect from the Composite. | |
| void | _set (std::type_index type_idx, const Aspect *aspect) |
| Non-templated version of set(const T*) | |
| void | _set (std::type_index type_idx, std::unique_ptr< Aspect > aspect) |
| Non-templated version of set(std::unqiue_ptr<T>&&) | |
Static Protected Member Functions | |
| template<class T > | |
| static constexpr bool | _isSpecializedFor (type< T >) |
| Return false. | |
| static constexpr bool | _isSpecializedFor (type< SpecAspect >) |
| Return true. | |
Protected Attributes | |
| Composite::AspectMap::iterator | mSpecAspectIterator |
| Iterator that points to the Aspect of this SpecializedForAspect. | |
| AspectMap | mAspectMap |
| A map that relates the type of Aspect to its pointer. | |
| RequiredAspectSet | mRequiredAspects |
| A set containing type information for Aspects which are not allowed to leave this composite. | |
SpecializedForAspect allows classes that inherit Composite to have constant-time access to a specific type of Aspect.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
| dart::common::SpecializedForAspect< SpecAspect >::SpecializedForAspect | ( | ) |
Default Constructor.
|
virtualdefault |
|
protected |
Specialized implementation of create()
|
protected |
Redirect to Composite::create()
|
protected |
Specialized implementation of get()
|
protected |
Specialized implementation of get()
|
protected |
Redirect to Composite::get()
|
protected |
Redirect to Composite::get()
|
protected |
Specialized implementation of has()
|
protected |
Redirect to Composite::has()
|
staticconstexprprotected |
Return true.
|
staticconstexprprotected |
Return false.
|
protected |
Specialized implementation of release()
|
protected |
Redirect to Composite::release()
|
protected |
Specialized implementation of erase()
|
protected |
Redirect to Composite::erase()
|
protectedinherited |
Non-templated version of set(const T*)
|
protectedinherited |
Non-templated version of set(std::unqiue_ptr<T>&&)
|
protected |
Specialized implementation of set()
|
protected |
Specialized implementation of set()
|
protected |
Redirect to Composite::set()
Using the type<T> tag for this is not be necessary, but it helps to avoid confusion between the set() versus _set() function.
|
protected |
Redirect to Composite::set()
Using the type<T> tag for this is not be necessary, but it helps to avoid confusion between the set() versus _set() function.
|
protectedinherited |
Add this Aspect to the Composite.
This allows derived Composite types to call the protected Aspect::setComposite function.
|
inherited |
Fill outgoingProperties with the properties of the aspects inside this Composite.
|
inherited |
Fill outgoingStates with the states of the aspects inside this Composite.
| T * dart::common::SpecializedForAspect< SpecAspect >::createAspect | ( | Args &&... | args | ) |
|
inherited |
| T * dart::common::SpecializedForAspect< SpecAspect >::get | ( | ) |
| const T * dart::common::SpecializedForAspect< SpecAspect >::get | ( | ) | const |
|
inherited |
Get the properties of the aspects inside of this Composite.
|
inherited |
Get the states of the aspects inside of this Composite.
| bool dart::common::SpecializedForAspect< SpecAspect >::has | ( | ) | const |
|
staticconstexpr |
|
inherited |
| std::unique_ptr< T > dart::common::SpecializedForAspect< SpecAspect >::releaseAspect | ( | ) |
| void dart::common::SpecializedForAspect< SpecAspect >::removeAspect | ( | ) |
|
protectedinherited |
Remove this Aspect from the Composite.
This allows derived Composite types to call the protected Aspect::loseComposite function.
|
inherited |
| void dart::common::SpecializedForAspect< SpecAspect >::set | ( | const T * | aspect | ) |
| void dart::common::SpecializedForAspect< SpecAspect >::set | ( | std::unique_ptr< T > && | aspect | ) |
|
inherited |
Set the properties of the aspects in this Composite based on the given Composite::Properties.
The properties of any Aspect types that do not exist within this composite will be ignored.
|
inherited |
Set the states of the aspects in this Composite based on the given Composite::State.
The states of any Aspect types that do not exist within this composite will be ignored.
|
protectedinherited |
A map that relates the type of Aspect to its pointer.
|
protectedinherited |
A set containing type information for Aspects which are not allowed to leave this composite.
|
protected |
Iterator that points to the Aspect of this SpecializedForAspect.