Manages the complex effects available in the component. More...
Public Member Functions | |
ComplexEffect * | createOrRetrieve (nkMemory::StringView name, COMPLEX_EFFECT_TYPE type) |
ComplexEffect * | record (nkMemory::StringView name, nkMemory::UniquePtr< ComplexEffect > resource) |
ComplexEffect * | get (nkMemory::StringView name) |
ComplexEffect * | getByIndex (unsigned int id) |
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName) |
void | erase (nkMemory::StringView name) |
nkMemory::UniquePtr< ComplexEffect > | relinquish (nkMemory::StringView name) |
Manages the complex effects available in the component.
At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.
ComplexEffect* nkAstraeus::ComplexEffectManager::createOrRetrieve | ( | nkMemory::StringView | name, |
COMPLEX_EFFECT_TYPE | type | ||
) |
Creates if unavailable, or retrieves if available, a complex effect.
Depending on the parameter given for the type, the ComplexEffect instance retrieved will be :
Value | Pointer type |
---|---|
EFFECT_TYPE::BLUR | BlurComplexEffect |
EFFECT_TYPE::DOF | DofComplexEffect |
To address it fully, casting is required. For instance :
name | The name of the complex effect to retrieve. |
type | The complex effect type to create. |
ComplexEffect* nkAstraeus::ComplexEffectManager::record | ( | nkMemory::StringView | name, |
nkMemory::UniquePtr< ComplexEffect > | resource | ||
) |
Records an already existing resource in the manager, passing its ownership around.
name | The name under which the resource should be recorded. |
resource | The resource to record. |
ComplexEffect* nkAstraeus::ComplexEffectManager::get | ( | nkMemory::StringView | name | ) |
Retrieves a complex effect.
name | The name of the complex effect to retrieve. |
ComplexEffect* nkAstraeus::ComplexEffectManager::getByIndex | ( | unsigned int | id | ) |
Get a complex effect, by index. Note that one index can map to a different effect after memory is changed. Useful to loop over all available effects in one go.
id | The index of the complex effect to retrieve. |
void nkAstraeus::ComplexEffectManager::rename | ( | nkMemory::StringView | currentName, |
nkMemory::StringView | newName | ||
) |
Renames a complex effect.
currentName | The name of the complex effect to rename. |
newName | The name to reassign to the complex effect. |
void nkAstraeus::ComplexEffectManager::erase | ( | nkMemory::StringView | name | ) |
Erases and frees a complex effect.
name | The name of the complex effect to erase. |
nkMemory::UniquePtr<ComplexEffect> nkAstraeus::ComplexEffectManager::relinquish | ( | nkMemory::StringView | name | ) |
Requests the manager to relinquish the ownership of a resource and pass it around.
name | The name of the recorded resource to relinquish. |