Lumiera  0.pre.03
»edit your freedom«
AssetManager Class Reference

#include "steam/assetmanager.hpp"

Description

Facade for the Asset subsystem.

Definition at line 77 of file assetmanager.hpp.

Public Member Functions

void clear ()
 deregister and evict all known Assets. More...
 
template<class KIND >
lib::P< KIND > getAsset (const ID< KIND > &id)
 find and return corresponding object More...
 
bool known (IDA id)
 
bool known (IDA id, const Category &cat)
 
list< PcAssetlistContent () const
 extract a sorted list of all registered Assets
 
void remove (IDA id)
 remove the given asset from the internal DB. More...
 

Static Public Member Functions

static ID< AssetgetID (const Asset::Ident &)
 provide the unique ID for given Asset::Ident tuple
 
template<class KIND >
static lib::P< KIND > wrap (const KIND &asset)
 retrieve the registered smart-ptr for any asset More...
 

Static Public Attributes

static lib::Depend< AssetManagerinstance
 get at the system-wide asset manager instance. More...
 

Friends

class lib::DependencyFactory< AssetManager >
 

Protected Member Functions

friend Asset::Asset (Asset::Ident const &idi)
 

Static Protected Member Functions

static void destroy (Asset *aa)
 deleter function used by the Asset smart pointers to delete Asset objects
 
template<class KIND >
static ID< KIND > reg (KIND *obj, const Asset::Ident &idi)
 registers an asset object in the internal DB, providing its unique key. More...
 

Private Attributes

asset::DBregistry
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Function Documentation

◆ wrap()

template P< ErrorLog > wrap ( const KIND &  asset)
static

retrieve the registered smart-ptr for any asset

Convenience shortcut for fetching the registered smart-ptr which is in charge of the given asset instance.

By querying directly asset.id (of type ID<Asset>), the call to registry.get() can bypass the dynamic cast, because the type of the asset is explicitly given by type KIND.

Definition at line 162 of file assetmanager.cpp.

Referenced by Builder< ErrorLog >::commit(), Asset::defineDependency(), Clip::findClipAsset(), Clip::getClipAsset(), and Clip::getMedia().

+ Here is the caller graph for this function:

◆ getAsset()

template P< Pipe > getAsset ( const ID< KIND > &  id)

find and return corresponding object

Note
the KIND of asset needs to be assignable by the actual stored asset
Exceptions
error::Invalidif nothing is found or if the actual KIND of the stored object differs and can't be casted.

Definition at line 143 of file assetmanager.cpp.

Referenced by CreateAsset_test::createMedia().

+ Here is the caller graph for this function:

◆ known() [1/2]

bool known ( IDA  id)
Returns
true if the given id is registered in the internal asset DB

Definition at line 176 of file assetmanager.cpp.

Referenced by CreateAsset_test::createMedia().

+ Here is the caller graph for this function:

◆ known() [2/2]

bool known ( IDA  id,
const Category cat 
)
Returns
true if the given id is registered with the given Category

Definition at line 187 of file assetmanager.cpp.

◆ remove()

void remove ( IDA  id)

remove the given asset from the internal DB.

remove the given asset from the internal DB together with all its dependents

together with all its dependents

Definition at line 214 of file assetmanager.cpp.

◆ clear()

void clear ( )

deregister and evict all known Assets.

Note
the actual object instances are managed by reference count, i.e. typically the Assets will be kept alive by MObjects from the session
Warning
unsure if this design is sane. Asset subsystem needs a rework ////////////////////////////TICKET #691
Todo:
verify this actually works, especially with session shutdown ////////////////////////////TICKET #154

Definition at line 224 of file assetmanager.cpp.

◆ reg()

template ID< Asset > reg ( KIND *  obj,
const Asset::Ident idi 
)
staticprotected

registers an asset object in the internal DB, providing its unique key.

used by the Asset base class ctor to create Asset::id.

This includes creating the smart ptr in charge of the asset's lifecycle

Exceptions
error::Invalidin case of invalid identity spec

Definition at line 121 of file assetmanager.cpp.

Member Data Documentation

◆ instance

+ Inheritance diagram for AssetManager:
+ Collaboration diagram for AssetManager:

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