dart
|
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 Member Functions | |
SpecializedForAspect () | |
Default Constructor. | |
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. 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. | |
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. More... | |
![]() | |
virtual | ~Composite ()=default |
Virtual destructor. | |
Composite ()=default | |
Default constructor. | |
Composite (const Composite &)=delete | |
It is currently unsafe to copy an Composite. | |
Composite (Composite &&)=delete | |
It is currently unsafe to move an Composite. | |
Composite & | operator= (const Composite &)=delete |
It is currently unsafe to copy an Composite. | |
Composite & | operator= (Composite &&)=delete |
It is currently unsafe to move an Composite. | |
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. More... | |
template<class T > | |
void | set (std::unique_ptr< T > &&aspect) |
Use move semantics to place aspect into this Composite. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Static Public Member Functions | |
template<class T > | |
static constexpr bool | isSpecializedFor () |
Check if this Composite is specialized for a specific type of Aspect. | |
![]() | |
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() | |
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() More... | |
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() More... | |
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. 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*) | |
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. More... | |
Additional Inherited Members | |
![]() | |
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... > |
SpecializedForAspect allows classes that inherit Composite to have constant-time access to a specific type of Aspect.
|
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.
std::unique_ptr< T > dart::common::SpecializedForAspect< SpecAspect >::releaseAspect | ( | ) |
void dart::common::SpecializedForAspect< SpecAspect >::set | ( | const T * | aspect | ) |
void dart::common::SpecializedForAspect< SpecAspect >::set | ( | std::unique_ptr< T > && | aspect | ) |