API Documentation
Public Member Functions | List of all members
nkAstraeus::ComplexEffectManager Class Referencefinal

Manages the complex effects available in the component. More...

Inheritance diagram for nkAstraeus::ComplexEffectManager:

Public Member Functions

ComplexEffectcreateOrRetrieve (nkMemory::StringView name, COMPLEX_EFFECT_TYPE type)
 
ComplexEffectrecord (nkMemory::StringView name, nkMemory::UniquePtr< ComplexEffect > resource)
 
ComplexEffectget (nkMemory::StringView name)
 
ComplexEffectgetByIndex (unsigned int id)
 
void rename (nkMemory::StringView currentName, nkMemory::StringView newName)
 
void erase (nkMemory::StringView name)
 
nkMemory::UniquePtr< ComplexEffectrelinquish (nkMemory::StringView name)
 

Detailed Description

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.

Member Function Documentation

◆ createOrRetrieve()

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 :

ValuePointer type
EFFECT_TYPE::BLURBlurComplexEffect
EFFECT_TYPE::DOFDofComplexEffect

To address it fully, casting is required. For instance :

BlurComplexEffect* effect = (BlurComplexEffect*)ComplexEffectManager::getInstance()->createOrRetrieve("effect", COMPLEX_EFFECT_TYPE::BLUR) ;
Parameters
nameThe name of the complex effect to retrieve.
typeThe complex effect type to create.
Returns
The complex effect requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

◆ record()

ComplexEffect* nkAstraeus::ComplexEffectManager::record ( nkMemory::StringView  name,
nkMemory::UniquePtr< ComplexEffect resource 
)

Records an already existing resource in the manager, passing its ownership around.

Parameters
nameThe name under which the resource should be recorded.
resourceThe resource to record.
Returns
A raw pointer over the resource, now recorded in the manager.

◆ get()

ComplexEffect* nkAstraeus::ComplexEffectManager::get ( nkMemory::StringView  name)

Retrieves a complex effect.

Parameters
nameThe name of the complex effect to retrieve.
Returns
The complex effect if available, nullptr else.

◆ getByIndex()

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.

Parameters
idThe index of the complex effect to retrieve.
Returns
The complex effect linked if available, nullptr else.

◆ rename()

void nkAstraeus::ComplexEffectManager::rename ( nkMemory::StringView  currentName,
nkMemory::StringView  newName 
)

Renames a complex effect.

Parameters
currentNameThe name of the complex effect to rename.
newNameThe name to reassign to the complex effect.

◆ erase()

void nkAstraeus::ComplexEffectManager::erase ( nkMemory::StringView  name)

Erases and frees a complex effect.

Parameters
nameThe name of the complex effect to erase.

◆ relinquish()

nkMemory::UniquePtr<ComplexEffect> nkAstraeus::ComplexEffectManager::relinquish ( nkMemory::StringView  name)

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters
nameThe name of the recorded resource to relinquish.
Returns
The ownership over the resource requested if available, nullptr otherwise.

The documentation for this class was generated from the following file: