Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | List of all members
castor3d::ObjectCacheT< SceneNode, castor::String, SceneNodeCacheTraits > Class Reference

SceneNode cache. More...

#include <SceneNodeCache.hpp>

Inheritance diagram for castor3d::ObjectCacheT< SceneNode, castor::String, SceneNodeCacheTraits >:
Inheritance graph
[legend]
Collaboration diagram for castor3d::ObjectCacheT< SceneNode, castor::String, SceneNodeCacheTraits >:
Collaboration graph
[legend]

Public Types

using ElementT = SceneNode
 
using ElementKeyT = castor::String
 
using ElementCacheTraitsT = SceneNodeCacheTraits
 
using ElementObjectCacheT = ObjectCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
 
using ElementPtrT = typename ElementObjectCacheT::ElementPtrT
 
using ElementContT = typename ElementObjectCacheT::ElementContT
 
using ElementInitialiserT = typename ElementObjectCacheT::ElementInitialiserT
 
using ElementCleanerT = typename ElementObjectCacheT::ElementCleanerT
 
using ElementMergerT = typename ElementObjectCacheT::ElementMergerT
 
using ElementAttacherT = typename ElementObjectCacheT::ElementAttacherT
 
using ElementDetacherT = typename ElementObjectCacheT::ElementDetacherT
 
- Public Types inherited from castor3d::ObjectCacheBaseT< SceneNode, castor::String, SceneNodeCacheTraits >
using OnChangedFunction
 
using OnChanged
 
- Public Types inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >
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

C3D_API ObjectCacheT (Scene &scene, ElementInitialiserT initialise, ElementCleanerT clean, ElementMergerT merge, ElementAttacherT attach, ElementDetacherT detach)
 Constructor.
 
C3D_API ElementObsT add (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
C3D_API ElementObsT add (ElementKeyT const &name)
 Logging version of tryAdd.
 
- Public Member Functions inherited from castor3d::ObjectCacheBaseT< SceneNode, castor::String, SceneNodeCacheTraits >
void mergeInto (ElementObjectCacheT &destination)
 Merges this cache's elements to the one given.
 
EnginegetEngine () const noexcept
 
castor::String const & getObjectTypeName () const noexcept
 
- Public Member Functions inherited from castor::OwnedBy< Scene >
Scene * getOwner () const
 
- Public Member Functions inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >
 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.
 
template<typename FuncType >
void forEach (FuncType func) const
 
template<typename FuncType >
void forEach (FuncType func)
 
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
 
void lock () const
 
void unlock () const noexcept
 
auto begin () noexcept
 
auto begin () const noexcept
 
auto end () noexcept
 
auto end () const noexcept
 
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
 

Additional Inherited Members

- Public Attributes inherited from castor3d::ObjectCacheBaseT< SceneNode, castor::String, SceneNodeCacheTraits >
OnChanged onChanged
 
- Protected Types inherited from castor3d::ObjectCacheBaseT< SceneNode, castor::String, SceneNodeCacheTraits >
using ElementT
 
using ElementKeyT
 
using ElementCacheTraitsT
 
using ElementCacheT
 
using ElementCacheBaseT
 
using ElementObjectCacheT
 
using ElementPtrT
 
using ElementObsT
 
using ElementContT
 
using ElementInitialiserT
 
using ElementCleanerT
 
using ElementMergerT
 
using ElementAttacherT
 
using ElementDetacherT
 
- Protected Types inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >
using MutexT = castor::RecursiveMutex
 
- Protected Member Functions inherited from castor3d::ObjectCacheBaseT< SceneNode, castor::String, SceneNodeCacheTraits >
 ObjectCacheBaseT (Scene &scene, SceneNodeRPtr rootNode, SceneNodeRPtr rootCameraNode, SceneNodeRPtr rootObjectNode, ElementInitialiserT initialise=ElementInitialiserT{}, ElementCleanerT clean=ElementCleanerT{}, ElementMergerT merge=ElementMergerT{}, ElementAttacherT attach=ElementAttacherT{}, ElementDetacherT detach=ElementDetacherT{})
 Constructor.
 
- Protected Member Functions inherited from castor::OwnedBy< Scene >
 OwnedBy (Scene &owner)
 Constructor.
 
- Protected Member Functions inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >
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 inherited from castor3d::ObjectCacheBaseT< SceneNode, castor::String, SceneNodeCacheTraits >
Enginem_engine
 
SceneNodeRPtr m_rootNode
 
SceneNodeRPtr m_rootCameraNode
 
SceneNodeRPtr m_rootObjectNode
 
ElementMergerT m_merge
 
ElementAttacherT m_attach
 
ElementDetacherT m_detach
 
- Protected Attributes inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT >
LoggerInstancem_logger
 
CheckedMutexT< MutexTm_mutex
 
ElementContT m_resources
 
ElementInitialiserT m_initialise
 
ElementCleanerT m_clean
 
ElementMergerT m_merge
 

Detailed Description

SceneNode cache.

Member Typedef Documentation

◆ ElementAttacherT

◆ ElementCacheTraitsT

◆ ElementCleanerT

◆ ElementContT

◆ ElementDetacherT

◆ ElementInitialiserT

◆ ElementKeyT

◆ ElementMergerT

◆ ElementObjectCacheT

◆ ElementPtrT

◆ ElementT

Constructor & Destructor Documentation

◆ ObjectCacheT()

Constructor.

Parameters
[in]sceneThe scene.
[in]initialiseThe element initialiser.
[in]cleanThe element cleaner.
[in]mergeThe element collection merger.
[in]attachThe element attacher (to a scene node).
[in]detachThe element detacher (from a scene node).

Member Function Documentation

◆ add() [1/2]

Logging version of tryAdd.

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

◆ add() [2/2]

C3D_API ElementObsT castor3d::ObjectCacheT< SceneNode, castor::String, SceneNodeCacheTraits >::add ( ElementKeyT const & name,
ElementPtrT & element,
bool initialise = true )

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 ).

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