DART
6.10.1
|
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. More... | |
virtual | ~SpecializedForAspect ()=default |
template<class T > | |
bool | has () const |
Check if this Composite currently has a certain type of Aspect. More... | |
template<class T > | |
T * | get () |
Get a certain type of Aspect from this Composite. More... | |
template<class T > | |
const T * | get () const |
Get a certain type of Aspect from this Composite. More... | |
template<class T > | |
void | set (const T *aspect) |
Make a clone of the aspect and place the clone into this Composite. More... | |
template<class T > | |
void | set (std::unique_ptr< T > &&aspect) |
Use move semantics to place an aspect into this Composite. More... | |
template<class T , typename... Args> | |
T * | createAspect (Args &&... args) |
Construct an Aspect inside of this Composite. More... | |
template<class T > | |
void | removeAspect () |
Remove an Aspect from this Composite. More... | |
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. More... | |
template<class T > | |
bool | requiresAspect () const |
Check if this Composite requires this specific type of Aspect. More... | |
void | setCompositeState (const State &newStates) |
Set the states of the aspects in this Composite based on the given Composite::State. More... | |
State | getCompositeState () const |
Get the states of the aspects inside of this Composite. More... | |
void | copyCompositeStateTo (State &outgoingStates) const |
Fill outgoingStates with the states of the aspects inside this Composite. More... | |
void | setCompositeProperties (const Properties &newProperties) |
Set the properties of the aspects in this Composite based on the given Composite::Properties. More... | |
Properties | getCompositeProperties () const |
Get the properties of the aspects inside of this Composite. More... | |
void | copyCompositePropertiesTo (Properties &outgoingProperties) const |
Fill outgoingProperties with the properties of the aspects inside this Composite. More... | |
void | duplicateAspects (const Composite *fromComposite) |
Give this Composite a copy of each Aspect from otherComposite. More... | |
void | matchAspects (const Composite *otherComposite) |
Make the Aspects of this Composite match the Aspects of otherComposite. More... | |
Static Public Member Functions | |
template<class T > | |
static constexpr bool | isSpecializedFor () |
Check if this Composite is specialized for a specific type of Aspect. More... | |
Protected Member Functions | |
template<class T > | |
bool | _has (type< T >) const |
Redirect to Composite::has() More... | |
bool | _has (type< SpecAspect >) const |
Specialized implementation of has() More... | |
template<class T > | |
T * | _get (type< T >) |
Redirect to Composite::get() More... | |
SpecAspect * | _get (type< SpecAspect >) |
Specialized implementation of get() More... | |
template<class T > | |
const T * | _get (type< T >) const |
Redirect to Composite::get() More... | |
const SpecAspect * | _get (type< SpecAspect >) const |
Specialized implementation of get() More... | |
template<class T > | |
void | _set (type< T >, const T *aspect) |
Redirect to Composite::set() More... | |
void | _set (type< SpecAspect >, const SpecAspect *aspect) |
Specialized implementation of set() More... | |
template<class T > | |
void | _set (type< T >, std::unique_ptr< T > &&aspect) |
Redirect to Composite::set() More... | |
void | _set (type< SpecAspect >, std::unique_ptr< SpecAspect > &&aspect) |
Specialized implementation of set() More... | |
template<class T , typename... Args> | |
T * | _createAspect (type< T >, Args &&... args) |
Redirect to Composite::create() More... | |
template<typename... Args> | |
SpecAspect * | _createAspect (type< SpecAspect >, Args &&... args) |
Specialized implementation of create() More... | |
template<class T > | |
void | _removeAspect (type< T >) |
Redirect to Composite::erase() More... | |
void | _removeAspect (type< SpecAspect >) |
Specialized implementation of erase() More... | |
template<class T > | |
std::unique_ptr< T > | _releaseAspect (type< T >) |
Redirect to Composite::release() More... | |
std::unique_ptr< SpecAspect > | _releaseAspect (type< SpecAspect >) |
Specialized implementation of release() More... | |
void | addToComposite (Aspect *aspect) |
Add this Aspect to the Composite. More... | |
void | removeFromComposite (Aspect *aspect) |
Remove this Aspect from the Composite. More... | |
void | _set (std::type_index type_idx, const Aspect *aspect) |
Non-templated version of set(const T*) More... | |
void | _set (std::type_index type_idx, std::unique_ptr< Aspect > aspect) |
Non-templated version of set(std::unqiue_ptr<T>&&) More... | |
Static Protected Member Functions | |
template<class T > | |
static constexpr bool | _isSpecializedFor (type< T >) |
Return false. More... | |
static constexpr bool | _isSpecializedFor (type< SpecAspect >) |
Return true. More... | |
Protected Attributes | |
Composite::AspectMap::iterator | mSpecAspectIterator |
Iterator that points to the Aspect of this SpecializedForAspect. More... | |
AspectMap | mAspectMap |
A map that relates the type of Aspect to its pointer. More... | |
RequiredAspectSet | mRequiredAspects |
A set containing type information for Aspects which are not allowed to leave this composite. More... | |
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 |
|
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 |
|
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.