Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
AssetManager Class Reference

#include "steam/assetmanager.hpp"

Description

Facade for the Asset subsystem.

Definition at line 68 of file assetmanager.hpp.

Static Public Attributes

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

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
 

Public Member Functions

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

Friends

class lib::DependencyFactory< AssetManager >
 

Protected Member Functions

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

Static Protected Member Functions

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.
 
static void destroy (Asset *aa)
 deleter function used by the Asset smart pointers to delete Asset objects
 

Private Attributes

asset::DBregistry
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ AssetManager()

AssetManager ( )
protected

Definition at line 90 of file assetmanager.cpp.

Member Function Documentation

◆ getID()

ID< Asset > getID ( const Asset::Ident idi)
static

provide the unique ID for given Asset::Ident tuple

Definition at line 98 of file assetmanager.cpp.

References steam::asset::hash_value().

Referenced by MediaFactory::operator()(), and AssetManager::reg().

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

◆ wrap()

template<class KIND >
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 153 of file assetmanager.cpp.

References DB::get(), AssetManager::instance, AssetManager::known(), and AssetManager::registry.

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

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

◆ getAsset()

template<class KIND >
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 134 of file assetmanager.cpp.

References DB::get(), AssetManager::known(), and AssetManager::registry.

Referenced by IdentityOfAssets_test::createDuplicate(), CreateAsset_test::createMedia(), MediaFactory::operator()(), and AssetManager::remove().

+ Here is the call graph for this function:
+ 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
true if the given id is registered in the internal asset DB

Definition at line 167 of file assetmanager.cpp.

References DB::get(), and AssetManager::registry.

Referenced by IdentityOfAssets_test::createDuplicate(), CreateAsset_test::createMedia(), BasicPipe_test::dependProcPatt(), AssetManager::getAsset(), TimelineSequenceHandling_test::indirect_SequenceHandling(), MediaFactory::operator()(), DeleteClip_test::run(), SessionElementTracker_test::verify_integration(), TimelineSequenceHandling_test::verify_removalBinding(), TimelineSequenceHandling_test::verify_removalSequence(), TimelineSequenceHandling_test::verify_removalTimeline(), DefsManager_test::verifyRemoval(), and AssetManager::wrap().

+ Here is the call graph for this function:
+ 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
true if the given id is registered with the given Category

Definition at line 178 of file assetmanager.cpp.

References DB::get(), and AssetManager::registry.

+ Here is the call graph for this function:

◆ 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 205 of file assetmanager.cpp.

References DB::del(), AssetManager::getAsset(), and AssetManager::registry.

Referenced by BasicPipe_test::dependProcPatt(), SessionElementTracker_test::verify_integration(), TimelineSequenceHandling_test::verify_removalSequence(), TimelineSequenceHandling_test::verify_removalTimeline(), and DefsManager_test::verifyRemoval().

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

◆ 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 215 of file assetmanager.cpp.

References DB::clear(), and AssetManager::registry.

+ Here is the call graph for this function:

◆ listContent()

list< PcAsset > listContent ( ) const

extract a sorted list of all registered Assets

Definition at line 223 of file assetmanager.cpp.

References DB::asList(), and AssetManager::registry.

+ Here is the call graph for this function:

◆ reg()

template<class KIND >
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 112 of file assetmanager.cpp.

References AssetManager::destroy(), AssetManager::getID(), AssetManager::instance, DB::put(), and AssetManager::registry.

+ Here is the call graph for this function:

◆ destroy()

static void destroy ( Asset aa)
inlinestaticprotected

deleter function used by the Asset smart pointers to delete Asset objects

Definition at line 121 of file assetmanager.hpp.

Referenced by AssetManager::reg().

+ Here is the caller graph for this function:

◆ Asset::Asset()

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

Member Data Documentation

◆ registry

◆ instance

Friends And Related Symbol Documentation

◆ lib::DependencyFactory< AssetManager >

friend class lib::DependencyFactory< AssetManager >
friend

Definition at line 125 of file assetmanager.hpp.

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

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