Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
castor::ResourceCacheBaseT< ResT, KeyT, TraitsT > Class Template Reference

Base class for an element cache. More...

#include <ResourceCacheBase.hpp>

Inheritance diagram for castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >:
Inheritance graph
[legend]
Collaboration diagram for castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >:
Collaboration graph
[legend]

Public Types

using ElementT = ResT
 
using ElementKeyT = KeyT
 
using ElementCacheTraitsT = TraitsT
 
using ElementCacheBaseT = ResourceCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
 
using ElementCacheT = typename ElementCacheTraitsT::ElementCacheT
 
using ElementPtrT = typename ElementCacheTraitsT::ElementPtrT
 
using ElementObsT = typename ElementCacheTraitsT::ElementObsT
 
using ElementContT = typename ElementCacheTraitsT::ElementContT
 
using ElementInitialiserT = typename ElementCacheTraitsT::ElementInitialiserT
 
using ElementCleanerT = typename ElementCacheTraitsT::ElementCleanerT
 
using ElementMergerT = typename ElementCacheTraitsT::ElementMergerT
 

Public Member Functions

 ResourceCacheBaseT (ResourceCacheBaseT const &)=delete
 
ResourceCacheBaseToperator= (ResourceCacheBaseT const &)=delete
 
 ResourceCacheBaseT (ResourceCacheBaseT &&) noexcept=delete
 
ResourceCacheBaseToperator= (ResourceCacheBaseT &&) noexcept=delete
 
void cleanup () noexcept
 Sets all the elements to be cleaned up.
 
void clear () noexcept
 Flushes the collection.
 
template<typename ... ParametersT>
ElementPtrT create (ElementKeyT const &name, ParametersT &&... parameters) const
 Creates an element.
 
ElementObsT tryAdd (ElementKeyT const &name, ElementPtrT &element, bool initialise=false)
 Adds an element.
 
ElementObsT tryAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=false)
 Adds an element.
 
ElementObsT add (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
ElementObsT addNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
template<typename ... ParametersT>
ElementObsT tryAdd (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 Add an element, constructed in-place.
 
template<typename ... ParametersT>
ElementObsT tryAddNoLock (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 Add an element, constructed in-place.
 
template<typename ... ParametersT>
ElementObsT add (ElementKeyT const &name, ParametersT &&... parameters)
 Logging version of tryAdd.
 
template<typename ... ParametersT>
ElementObsT addNoLock (ElementKeyT const &name, ParametersT &&... parameters)
 Logging version of tryAdd.
 
ElementPtrT tryRemove (ElementKeyT const &name, bool cleanup=false) noexcept
 Removes an element, given a name.
 
ElementPtrT tryRemoveNoLock (ElementKeyT const &name, bool cleanup=false) noexcept
 Removes an element, given a name.
 
ElementPtrT remove (ElementKeyT const &name, bool cleanup=false) noexcept
 Logging version of tryRemove.
 
ElementPtrT removeNoLock (ElementKeyT const &name, bool cleanup=false) noexcept
 Logging version of tryRemove.
 
void rename (ElementKeyT const &oldName, ElementKeyT const &newName)
 Renames a resource.
 
ElementObsT tryFind (ElementKeyT const &name) const noexcept
 Looks for an element with given name.
 
ElementObsT tryFindNoLock (ElementKeyT const &name) const noexcept
 Looks for an element with given name.
 
ElementObsT find (ElementKeyT const &name) const
 Logging version of tryRemove.
 
ElementObsT findNoLock (ElementKeyT const &name) const
 Logging version of tryRemove.
 
void mergeInto (ElementCacheBaseT &destination)
 Merges this cache's elements to the one given.
 
Locked loop.
template<typename FuncType >
void forEach (FuncType func) const
 
template<typename FuncType >
void forEach (FuncType func)
 
Getters.
uint32_t getObjectCount () const noexcept
 
uint32_t getObjectCountNoLock () const noexcept
 
String const & getObjectTypeName () const noexcept
 
bool has (ElementKeyT const &name) const noexcept
 
bool hasNoLock (ElementKeyT const &name) const noexcept
 
bool isEmpty () const noexcept
 
bool isEmptyNoLock () const noexcept
 
Mutex locking.
void lock () const
 
void unlock () const noexcept
 
Iteration.
auto begin () noexcept
 
auto begin () const noexcept
 
auto end () noexcept
 
auto end () const noexcept
 
Logging.
void reportCreation (String const &name) const
 
void reportAdded (String const &name) const
 
void reportDuplicate (String const &name) const
 
void reportNull () const
 
void reportUnknown (String const &name) const
 

Protected Types

using MutexT = castor::RecursiveMutex
 

Protected Member Functions

void doCleanupNoLock () const noexcept
 
void doClearNoLock () noexcept
 
template<typename ... ParametersT>
ElementPtrT doCreateT (ElementKeyT const &name, ParametersT &&... parameters) const
 
ElementObsT doTryAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 
ElementObsT doAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 
template<typename ... ParametersT>
ElementObsT doTryAddNoLockT (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 
template<typename ... ParametersT>
ElementObsT doAddNoLockT (ElementKeyT const &name, ParametersT &&... parameters)
 
ElementPtrT doTryRemoveNoLock (ElementKeyT const &name, bool cleanup=false) noexcept
 
ElementObsT doTryFindNoLock (ElementKeyT const &name) const noexcept
 
 ResourceCacheBaseT (LoggerInstance &logger, ElementInitialiserT initialise=ElementInitialiserT{}, ElementCleanerT clean=ElementCleanerT{}, ElementMergerT merge=ElementMergerT{})
 
virtual ~ResourceCacheBaseT () noexcept=default
 

Protected Attributes

LoggerInstancem_logger
 
CheckedMutexT< MutexTm_mutex
 
ElementContT m_resources
 
ElementInitialiserT m_initialise
 
ElementCleanerT m_clean
 
ElementMergerT m_merge
 

Detailed Description

template<typename ResT, typename KeyT, typename TraitsT>
class castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >

Base class for an element cache.

Member Typedef Documentation

◆ ElementCacheBaseT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementCacheBaseT = ResourceCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >

◆ ElementCacheT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementCacheT = typename ElementCacheTraitsT::ElementCacheT

◆ ElementCacheTraitsT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementCacheTraitsT = TraitsT

◆ ElementCleanerT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementCleanerT = typename ElementCacheTraitsT::ElementCleanerT

◆ ElementContT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementContT = typename ElementCacheTraitsT::ElementContT

◆ ElementInitialiserT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementInitialiserT = typename ElementCacheTraitsT::ElementInitialiserT

◆ ElementKeyT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementKeyT = KeyT

◆ ElementMergerT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementMergerT = typename ElementCacheTraitsT::ElementMergerT

◆ ElementObsT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementObsT = typename ElementCacheTraitsT::ElementObsT

◆ ElementPtrT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementPtrT = typename ElementCacheTraitsT::ElementPtrT

◆ ElementT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ElementT = ResT

◆ MutexT

template<typename ResT , typename KeyT , typename TraitsT >
using castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::MutexT = castor::RecursiveMutex
protected

Constructor & Destructor Documentation

◆ ResourceCacheBaseT() [1/3]

template<typename ResT , typename KeyT , typename TraitsT >
castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ResourceCacheBaseT ( ResourceCacheBaseT< ResT, KeyT, TraitsT > const & )
delete

◆ ResourceCacheBaseT() [2/3]

template<typename ResT , typename KeyT , typename TraitsT >
castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ResourceCacheBaseT ( ResourceCacheBaseT< ResT, KeyT, TraitsT > && )
deletenoexcept

◆ ResourceCacheBaseT() [3/3]

template<typename ResT , typename KeyT , typename TraitsT >
castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::ResourceCacheBaseT ( LoggerInstance & logger,
ElementInitialiserT initialise = ElementInitialiserT{},
ElementCleanerT clean = ElementCleanerT{},
ElementMergerT merge = ElementMergerT{} )
inlineexplicitprotected

name Construction/Desctruction.

◆ ~ResourceCacheBaseT()

template<typename ResT , typename KeyT , typename TraitsT >
virtual castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::~ResourceCacheBaseT ( )
protectedvirtualdefaultnoexcept

Member Function Documentation

◆ add() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::add ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = true )
inline

Logging version of tryAdd.

Parameters
[in]nameThe resource name.
[in,out]elementThe resource, will be emptied on add (the cache now owns it).
[in]initialisetrue to initialise the added element (no effect on duplicates).
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doAddNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Referenced by castor3d::Engine::addFont(), castor3d::Engine::addImage(), castor3d::Engine::addNewFont(), and castor3d::Engine::addNewImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::add ( ElementKeyT const & name,
ParametersT &&... parameters )
inline

Logging version of tryAdd.

Parameters
[in]nameThe element name.
[in]parametersThe other constructor parameters.
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doAddNoLockT(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Here is the call graph for this function:

◆ addNoLock() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::addNoLock ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = true )
inline

Logging version of tryAdd.

Parameters
[in]nameThe resource name.
[in,out]elementThe resource, will be emptied on add (the cache now owns it).
[in]initialisetrue to initialise the added element (no effect on duplicates).
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doAddNoLock().

Here is the call graph for this function:

◆ addNoLock() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::addNoLock ( ElementKeyT const & name,
ParametersT &&... parameters )
inline

Logging version of tryAdd.

Parameters
[in]nameThe element name.
[in]parametersThe other constructor parameters.
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doAddNoLockT().

Here is the call graph for this function:

◆ begin() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
auto castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
auto castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::begin ( )
inlinenoexcept

◆ cleanup()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::cleanup ( )
inlinenoexcept

◆ clear()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::clear ( )
inlinenoexcept

◆ create()

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::create ( ElementKeyT const & name,
ParametersT &&... parameters ) const
inline

Creates an element.

Parameters
[in]nameThe element name.
[in]parametersThe other constructor parameters.
Returns
The created element.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doCreateT(), and castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportCreation().

Referenced by castor3d::Engine::createFont(), and castor3d::Engine::createImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doAddNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doAddNoLock ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = true )
inlineprotected

◆ doAddNoLockT()

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doAddNoLockT ( ElementKeyT const & name,
ParametersT &&... parameters )
inlineprotected

◆ doCleanupNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doCleanupNoLock ( ) const
inlineprotectednoexcept

◆ doClearNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doClearNoLock ( )
inlineprotectednoexcept

◆ doCreateT()

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doCreateT ( ElementKeyT const & name,
ParametersT &&... parameters ) const
inlineprotected

◆ doTryAddNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryAddNoLock ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = true )
inlineprotected

◆ doTryAddNoLockT()

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryAddNoLockT ( ElementKeyT const & name,
bool initialise,
ElementObsT & created,
ParametersT &&... parameters )
inlineprotected

◆ doTryFindNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryFindNoLock ( ElementKeyT const & name) const
inlineprotectednoexcept

◆ doTryRemoveNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryRemoveNoLock ( ElementKeyT const & name,
bool cleanup = false )
inlineprotectednoexcept

◆ end() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
auto castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
auto castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::end ( )
inlinenoexcept

◆ find()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::find ( ElementKeyT const & name) const
inline

Logging version of tryRemove.

Parameters
[in]nameThe object name.
Returns
The found element, nullptr if not found.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryFindNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), castor::makeUniqueLock(), and castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportUnknown().

Referenced by castor3d::Engine::findFont(), and castor3d::Engine::findImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::findNoLock ( ElementKeyT const & name) const
inline

Logging version of tryRemove.

Parameters
[in]nameThe object name.
Returns
The found element, nullptr if not found.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryFindNoLock(), and castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportUnknown().

Here is the call graph for this function:

◆ forEach() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
template<typename FuncType >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::forEach ( FuncType func)
inline

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Here is the call graph for this function:

◆ forEach() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
template<typename FuncType >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::forEach ( FuncType func) const
inline

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Here is the call graph for this function:

◆ getObjectCount()

template<typename ResT , typename KeyT , typename TraitsT >
uint32_t castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::getObjectCount ( ) const
inlinenoexcept

◆ getObjectCountNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
uint32_t castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::getObjectCountNoLock ( ) const
inlinenoexcept

◆ getObjectTypeName()

template<typename ResT , typename KeyT , typename TraitsT >
String const & castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::getObjectTypeName ( ) const
inlinenoexcept

◆ has()

template<typename ResT , typename KeyT , typename TraitsT >
bool castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::has ( ElementKeyT const & name) const
inlinenoexcept

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryFind().

Referenced by castor3d::Engine::hasFont(), and castor3d::Engine::hasImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
bool castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::hasNoLock ( ElementKeyT const & name) const
inlinenoexcept

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryFindNoLock().

Here is the call graph for this function:

◆ isEmpty()

template<typename ResT , typename KeyT , typename TraitsT >
bool castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::isEmpty ( ) const
inlinenoexcept

◆ isEmptyNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
bool castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::isEmptyNoLock ( ) const
inlinenoexcept

◆ lock()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock ( ) const
inline

◆ mergeInto()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::mergeInto ( ElementCacheBaseT & destination)
inline

Merges this cache's elements to the one given.

Parameters
[out]destinationThe destination cache.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doClearNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_merge, and castor::makeUniqueLock().

Here is the call graph for this function:

◆ operator=() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
ResourceCacheBaseT & castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::operator= ( ResourceCacheBaseT< ResT, KeyT, TraitsT > && )
deletenoexcept

◆ operator=() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
ResourceCacheBaseT & castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::operator= ( ResourceCacheBaseT< ResT, KeyT, TraitsT > const & )
delete

◆ remove()

template<typename ResT , typename KeyT , typename TraitsT >
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::remove ( ElementKeyT const & name,
bool cleanup = false )
inlinenoexcept

Logging version of tryRemove.

Parameters
[in]nameThe element name.
[in]cleanuptrue if the element needs to be cleaned up.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::cleanup(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryRemoveNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), castor::makeUniqueLock(), and castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportUnknown().

Referenced by castor3d::Engine::removeFont(), and castor3d::Engine::removeImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::removeNoLock ( ElementKeyT const & name,
bool cleanup = false )
inlinenoexcept

Logging version of tryRemove.

Parameters
[in]nameThe element name.
[in]cleanuptrue if the element needs to be cleaned up.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::cleanup(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryRemoveNoLock(), and castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportUnknown().

Here is the call graph for this function:

◆ rename()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::rename ( ElementKeyT const & oldName,
ElementKeyT const & newName )
inline

◆ reportAdded()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportAdded ( String const & name) const
inline

◆ reportCreation()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportCreation ( String const & name) const
inline

◆ reportDuplicate()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportDuplicate ( String const & name) const
inline

◆ reportNull()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportNull ( ) const
inline

◆ reportUnknown()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::reportUnknown ( String const & name) const
inline

◆ tryAdd() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryAdd ( ElementKeyT const & name,
bool initialise,
ElementObsT & created,
ParametersT &&... parameters )
inline

Add an element, constructed in-place.

Parameters
[in]nameThe element name.
[in]initialisetrue to initialise the added element (no effect on duplicates).
[out]createdThe created element.
[in]parametersThe other constructor parameters.
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryAddNoLockT(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Here is the call graph for this function:

◆ tryAdd() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryAdd ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = false )
inline

Adds an element.

Parameters
[in]nameThe element name.
[in,out]elementThe resource, will be emptied on add (the cache now owns it).
[in]initialisetrue to initialise the added element (no effect on duplicates).
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryAddNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Referenced by castor3d::Engine::tryAddImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryAddNoLock() [1/2]

template<typename ResT , typename KeyT , typename TraitsT >
template<typename ... ParametersT>
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryAddNoLock ( ElementKeyT const & name,
bool initialise,
ElementObsT & created,
ParametersT &&... parameters )
inline

Add an element, constructed in-place.

Parameters
[in]nameThe element name.
[in]initialisetrue to initialise the added element (no effect on duplicates).
[out]createdThe created element.
[in]parametersThe other constructor parameters.
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryAddNoLockT().

Here is the call graph for this function:

◆ tryAddNoLock() [2/2]

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryAddNoLock ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = false )
inline

Adds an element.

Parameters
[in]nameThe element name.
[in,out]elementThe resource, will be emptied on add (the cache now owns it).
[in]initialisetrue to initialise the added element (no effect on duplicates).
Returns
The real element (added or duplicate original ).

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryAddNoLock().

Here is the call graph for this function:

◆ tryFind()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryFind ( ElementKeyT const & name) const
inlinenoexcept

Looks for an element with given name.

Parameters
[in]nameThe object name.
Returns
The found element, nullptr if not found.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryFindNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Referenced by castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::has(), castor3d::Engine::tryFindFont(), and castor3d::Engine::tryFindImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryFindNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementObsT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryFindNoLock ( ElementKeyT const & name) const
inlinenoexcept

Looks for an element with given name.

Parameters
[in]nameThe object name.
Returns
The found element, nullptr if not found.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryFindNoLock().

Referenced by castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::hasNoLock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryRemove()

template<typename ResT , typename KeyT , typename TraitsT >
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryRemove ( ElementKeyT const & name,
bool cleanup = false )
inlinenoexcept

Removes an element, given a name.

Parameters
[in]nameThe element name.
[in]cleanuptrue if the element needs to be cleaned up.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::cleanup(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryRemoveNoLock(), castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::lock(), and castor::makeUniqueLock().

Here is the call graph for this function:

◆ tryRemoveNoLock()

template<typename ResT , typename KeyT , typename TraitsT >
ElementPtrT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::tryRemoveNoLock ( ElementKeyT const & name,
bool cleanup = false )
inlinenoexcept

Removes an element, given a name.

Parameters
[in]nameThe element name.
[in]cleanuptrue if the element needs to be cleaned up.

References castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::cleanup(), and castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::doTryRemoveNoLock().

Here is the call graph for this function:

◆ unlock()

template<typename ResT , typename KeyT , typename TraitsT >
void castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::unlock ( ) const
inlinenoexcept

Member Data Documentation

◆ m_clean

template<typename ResT , typename KeyT , typename TraitsT >
ElementCleanerT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_clean
protected

◆ m_initialise

template<typename ResT , typename KeyT , typename TraitsT >
ElementInitialiserT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_initialise
protected

◆ m_logger

template<typename ResT , typename KeyT , typename TraitsT >
LoggerInstance& castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_logger
protected

◆ m_merge

template<typename ResT , typename KeyT , typename TraitsT >
ElementMergerT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_merge
protected

The elements collection merger.

Referenced by castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::mergeInto().

◆ m_mutex

template<typename ResT , typename KeyT , typename TraitsT >
CheckedMutexT< MutexT > castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_mutex
protected

◆ m_resources

template<typename ResT , typename KeyT , typename TraitsT >
ElementContT castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >::m_resources
mutableprotected

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