Castor3D 0.16.0
Multiplatform 3D engine
|
#include <CacheView.hpp>
Public Types | |
using | ElementCacheT = CacheT |
using | ElementT = typename ElementCacheT::ElementT |
using | ElementKeyT = typename ElementCacheT::ElementKeyT |
using | ElementCacheTraitsT = typename ElementCacheT::ElementCacheTraitsT |
using | ElementPtrT = typename ElementCacheT::ElementPtrT |
using | ElementObsT = typename ElementCacheT::ElementObsT |
using | ElementContT = typename ElementCacheT::ElementContT |
using | ElementInitialiserT = typename ElementCacheT::ElementInitialiserT |
using | ElementCleanerT = typename ElementCacheT::ElementCleanerT |
using | ElementMergerT = typename ElementCacheT::ElementMergerT |
Public Member Functions | |
CacheViewT (castor::String const &name, ElementCacheT &cache, ElementInitialiserT initialise=[](ElementObsT const &){}, ElementCleanerT clean=[](ElementObsT const &){}) | |
Constructor. | |
void | clear () |
Removes from the cache the elements created through this view. | |
template<typename ... ParametersT> | |
ElementObsT | add (ElementKeyT const &name, ParametersT &&... params) |
Creates an element with the given informations. | |
template<typename ... ParametersT> | |
ElementObsT | tryAdd (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... params) |
Creates or retrieves an element with the given informations. | |
bool | tryAdd (ElementKeyT const &name, ElementPtrT &element, bool initialise=false) |
adds an already created an element. | |
ElementObsT | add (ElementKeyT const &name, ElementPtrT &element, bool initialise=false) |
adds an already created an element. | |
bool | isEmpty () const |
bool | has (ElementKeyT const &name) const |
ElementObsT | tryFind (ElementKeyT const &name) const |
Looks for an element with given name. | |
ElementObsT | find (ElementKeyT const &name) const |
Looks for an element with given name. | |
ElementPtrT | tryRemove (ElementKeyT const &name) |
Removes an element, given a name. | |
ElementPtrT | remove (ElementKeyT const &name) |
Removes an object, given a name. | |
auto & | getCache () const |
Iteration. | |
auto | begin () |
auto | begin () const |
auto | end () |
auto | end () const |
Public Member Functions inherited from castor::NamedBaseT< T > | |
NamedBaseT (T name) noexcept | |
Constructor. | |
T const & | getName () const noexcept |
Retrieves the name. | |
void | rename (T name) noexcept |
Additional Inherited Members | |
Protected Attributes inherited from castor::NamedBaseT< T > | |
T | m_name |
View on a resource cache.
using castor3d::CacheViewT< CacheT, EventT >::ElementCacheT = CacheT |
using castor3d::CacheViewT< CacheT, EventT >::ElementCacheTraitsT = typename ElementCacheT::ElementCacheTraitsT |
using castor3d::CacheViewT< CacheT, EventT >::ElementCleanerT = typename ElementCacheT::ElementCleanerT |
using castor3d::CacheViewT< CacheT, EventT >::ElementContT = typename ElementCacheT::ElementContT |
using castor3d::CacheViewT< CacheT, EventT >::ElementInitialiserT = typename ElementCacheT::ElementInitialiserT |
using castor3d::CacheViewT< CacheT, EventT >::ElementKeyT = typename ElementCacheT::ElementKeyT |
using castor3d::CacheViewT< CacheT, EventT >::ElementMergerT = typename ElementCacheT::ElementMergerT |
using castor3d::CacheViewT< CacheT, EventT >::ElementObsT = typename ElementCacheT::ElementObsT |
using castor3d::CacheViewT< CacheT, EventT >::ElementPtrT = typename ElementCacheT::ElementPtrT |
using castor3d::CacheViewT< CacheT, EventT >::ElementT = typename ElementCacheT::ElementT |
castor3d::CacheViewT< CacheT, EventT >::CacheViewT | ( | castor::String const & | name, |
ElementCacheT & | cache, | ||
ElementInitialiserT | initialise = [](ElementObsT const &){}, | ||
ElementCleanerT | clean = [](ElementObsT const &){} ) |
Constructor.
[in] | name | The view name. |
[in] | initialise | The element initialiser. |
[in] | clean | The element cleaner. |
[in] | cache | The viewed cache. |
ElementObsT castor3d::CacheViewT< CacheT, EventT >::add | ( | ElementKeyT const & | name, |
ElementPtrT & | element, | ||
bool | initialise = false ) |
adds an already created an element.
[in] | name | The element name. |
[in] | element | The element. |
[in] | initialise | Tells if the element is to be initialised after creation. |
ElementObsT castor3d::CacheViewT< CacheT, EventT >::add | ( | ElementKeyT const & | name, |
ParametersT &&... | params ) |
Creates an element with the given informations.
[in] | name | The element name. |
[in] | params | The parameters forwarded to the viewed cache. |
|
inline |
|
inline |
void castor3d::CacheViewT< CacheT, EventT >::clear | ( | ) |
Removes from the cache the elements created through this view.
|
inline |
|
inline |
ElementObsT castor3d::CacheViewT< CacheT, EventT >::find | ( | ElementKeyT const & | name | ) | const |
Looks for an element with given name.
[in] | name | The object name. |
|
inline |
bool castor3d::CacheViewT< CacheT, EventT >::has | ( | ElementKeyT const & | name | ) | const |
[in] | name | The object name. |
true
if an element with given name exists. bool castor3d::CacheViewT< CacheT, EventT >::isEmpty | ( | ) | const |
true
if the view is empty. ElementPtrT castor3d::CacheViewT< CacheT, EventT >::remove | ( | ElementKeyT const & | name | ) |
Removes an object, given a name.
[in] | name | The object name. |
ElementObsT castor3d::CacheViewT< CacheT, EventT >::tryAdd | ( | ElementKeyT const & | name, |
bool | initialise, | ||
ElementObsT & | created, | ||
ParametersT &&... | params ) |
Creates or retrieves an element with the given informations.
[in] | name | The element name. |
[in] | initialise | Tells if the element is to be initialised after creation. |
[out] | created | Receives the created element if ti was created. |
[in] | params | The parameters forwarded to the viewed cache. |
bool castor3d::CacheViewT< CacheT, EventT >::tryAdd | ( | ElementKeyT const & | name, |
ElementPtrT & | element, | ||
bool | initialise = false ) |
adds an already created an element.
[in] | name | The element name. |
[in] | element | The element. |
[in] | initialise | Tells if the element is to be initialised after creation. |
ElementObsT castor3d::CacheViewT< CacheT, EventT >::tryFind | ( | ElementKeyT const & | name | ) | const |
Looks for an element with given name.
[in] | name | The object name. |
ElementPtrT castor3d::CacheViewT< CacheT, EventT >::tryRemove | ( | ElementKeyT const & | name | ) |
Removes an element, given a name.
[in] | name | The element name. |