Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT > Class Template Reference

#include <ObjectCacheBase.hpp>

Inheritance diagram for castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >:
Inheritance graph
[legend]
Collaboration diagram for castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >:
Collaboration graph
[legend]

Public Types

using OnChangedFunction = castor::Function< void() >
 
using OnChanged = castor::SignalT< OnChangedFunction >
 
- Public Types inherited from castor::ResourceCacheBaseT< ObjT, KeyT, TraitsT >
using ElementT
 
using ElementKeyT
 
using ElementCacheTraitsT
 
using ElementCacheBaseT
 
using ElementCacheT
 
using ElementPtrT
 
using ElementObsT
 
using ElementContT
 
using ElementInitialiserT
 
using ElementCleanerT
 
using ElementMergerT
 

Public Member Functions

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< ObjT, KeyT, TraitsT >
 ResourceCacheBaseT (ResourceCacheBaseT const &)=delete
 
 ResourceCacheBaseT (ResourceCacheBaseT &&) noexcept=delete
 
ResourceCacheBaseToperator= (ResourceCacheBaseT const &)=delete
 
ResourceCacheBaseToperator= (ResourceCacheBaseT &&) noexcept=delete
 
void cleanup () noexcept
 Sets all the elements to be cleaned up.
 
void clear () noexcept
 Flushes the collection.
 
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 tryAdd (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 Add an element, constructed in-place.
 
ElementObsT tryAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=false)
 Adds an element.
 
ElementObsT tryAddNoLock (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 Add an element, constructed in-place.
 
ElementObsT add (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
ElementObsT add (ElementKeyT const &name, ParametersT &&... parameters)
 Logging version of tryAdd.
 
ElementObsT addNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
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.
 
void forEach (FuncType func) const
 
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
 

Public Attributes

OnChanged onChanged
 

Protected Types

using ElementT = ObjT
 
using ElementKeyT = KeyT
 
using ElementCacheTraitsT = TraitsT
 
using ElementCacheT = castor::ResourceCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
 
using ElementCacheBaseT = ElementCacheT
 
using ElementObjectCacheT = ObjectCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
 
using ElementPtrT = ObjectPtrT< ElementT, ElementKeyT >
 
using ElementObsT = ObjectObsT< ElementT, ElementKeyT >
 
using ElementContT = ObjectContT< ElementT, ElementKeyT >
 
using ElementInitialiserT = ObjectInitialiserT< ElementT, ElementKeyT >
 
using ElementCleanerT = ObjectCleanerT< ElementT, ElementKeyT >
 
using ElementMergerT = ObjectMergerT< ElementT, ElementKeyT >
 
using ElementAttacherT = ObjectAttacherT< ElementT, ElementKeyT >
 
using ElementDetacherT = ObjectDetacherT< ElementT, ElementKeyT >
 
- Protected Types inherited from castor::ResourceCacheBaseT< ObjT, KeyT, TraitsT >
using MutexT
 

Protected Member Functions

 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< ObjT, KeyT, TraitsT >
void doCleanupNoLock () const noexcept
 
void doClearNoLock () noexcept
 
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)
 
ElementObsT doTryAddNoLockT (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 
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

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< ObjT, KeyT, TraitsT >
LoggerInstancem_logger
 
CheckedMutexT< MutexTm_mutex
 
ElementContT m_resources
 
ElementInitialiserT m_initialise
 
ElementCleanerT m_clean
 
ElementMergerT m_merge
 

Friends

class Scene
 

Detailed Description

template<typename ObjT, typename KeyT, typename TraitsT>
class castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >

Base class for a scene element cache.

Member Typedef Documentation

◆ ElementAttacherT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementAttacherT = ObjectAttacherT< ElementT, ElementKeyT >
protected

◆ ElementCacheBaseT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementCacheBaseT = ElementCacheT
protected

◆ ElementCacheT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementCacheT = castor::ResourceCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
protected

◆ ElementCacheTraitsT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementCacheTraitsT = TraitsT
protected

◆ ElementCleanerT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementCleanerT = ObjectCleanerT< ElementT, ElementKeyT >
protected

◆ ElementContT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementContT = ObjectContT< ElementT, ElementKeyT >
protected

◆ ElementDetacherT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementDetacherT = ObjectDetacherT< ElementT, ElementKeyT >
protected

◆ ElementInitialiserT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementInitialiserT = ObjectInitialiserT< ElementT, ElementKeyT >
protected

◆ ElementKeyT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementKeyT = KeyT
protected

◆ ElementMergerT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementMergerT = ObjectMergerT< ElementT, ElementKeyT >
protected

◆ ElementObjectCacheT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementObjectCacheT = ObjectCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
protected

◆ ElementObsT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementObsT = ObjectObsT< ElementT, ElementKeyT >
protected

◆ ElementPtrT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementPtrT = ObjectPtrT< ElementT, ElementKeyT >
protected

◆ ElementT

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ElementT = ObjT
protected

◆ OnChanged

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::OnChanged = castor::SignalT< OnChangedFunction >

◆ OnChangedFunction

template<typename ObjT , typename KeyT , typename TraitsT >
using castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::OnChangedFunction = castor::Function< void() >

Constructor & Destructor Documentation

◆ ObjectCacheBaseT()

template<typename ObjT , typename KeyT , typename TraitsT >
castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::ObjectCacheBaseT ( Scene & scene,
SceneNodeRPtr rootNode,
SceneNodeRPtr rootCameraNode,
SceneNodeRPtr rootObjectNode,
ElementInitialiserT initialise = ElementInitialiserT{},
ElementCleanerT clean = ElementCleanerT{},
ElementMergerT merge = ElementMergerT{},
ElementAttacherT attach = ElementAttacherT{},
ElementDetacherT detach = ElementDetacherT{} )
inlineprotected

Constructor.

Parameters
[in]sceneThe scene.
[in]rootNodeThe root node.
[in]rootCameraNodeThe cameras root node.
[in]rootObjectNodeThe objects root node.
[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

◆ getEngine()

template<typename ObjT , typename KeyT , typename TraitsT >
Engine * castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::getEngine ( ) const
inlinenoexcept

◆ getObjectTypeName()

template<typename ObjT , typename KeyT , typename TraitsT >
castor::String const & castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::getObjectTypeName ( ) const
inlinenoexcept
Returns
The objects type name.

◆ mergeInto()

template<typename ObjT , typename KeyT , typename TraitsT >
void castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::mergeInto ( ElementObjectCacheT & destination)
inline

Friends And Related Symbol Documentation

◆ Scene

template<typename ObjT , typename KeyT , typename TraitsT >
friend class Scene
friend

Member Data Documentation

◆ m_attach

template<typename ObjT , typename KeyT , typename TraitsT >
ElementAttacherT castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_attach
protected

The object attacher.

◆ m_detach

template<typename ObjT , typename KeyT , typename TraitsT >
ElementDetacherT castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_detach
protected

The object detacher.

◆ m_engine

template<typename ObjT , typename KeyT , typename TraitsT >
Engine& castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_engine
protected

◆ m_merge

template<typename ObjT , typename KeyT , typename TraitsT >
ElementMergerT castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_merge
protected

◆ m_rootCameraNode

template<typename ObjT , typename KeyT , typename TraitsT >
SceneNodeRPtr castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_rootCameraNode
protected

The root node used only for cameras.

◆ m_rootNode

template<typename ObjT , typename KeyT , typename TraitsT >
SceneNodeRPtr castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_rootNode
protected

The root node.

◆ m_rootObjectNode

template<typename ObjT , typename KeyT , typename TraitsT >
SceneNodeRPtr castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::m_rootObjectNode
protected

The root node for every object other than camera.

◆ onChanged

template<typename ObjT , typename KeyT , typename TraitsT >
OnChanged castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::onChanged

The signal emitted when the content has changed.

Referenced by castor3d::ObjectCacheBaseT< ObjT, KeyT, TraitsT >::mergeInto().


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