asset::Asset Class Reference

Superinterface describing especially bookeeping properties. More...

#include <asset.hpp>

Inheritance diagram for asset::Asset:

Inheritance graph
[legend]
Collaboration diagram for asset::Asset:

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool enable (bool on=true) throw (lumiera::error::State)
 change the enabled status of this asset.
const vector< PAsset > & getDependant () const
 All the other assets requiring this asset to be functional.
virtual const ID< Asset > & getID () const
const vector< PAsset > & getParents () const
 List of entities this asset depends on or requires to be functional.
bool isActive () const
 weather this asset is swithced on and consequently included in the fixture and participates in rendering
virtual operator string () const
bool operator< (const Asset &oa) const
bool operator== (const Asset &oa) const

Public Attributes

const Ident ident
 Asset identification tuple.

Protected Member Functions

 Asset (const Ident &idi)
 Asset is a Interface class; usually, objects of concrete subclasses are created via specialized Factories.
void defineDependency (Asset &parent)
void defineDependency (PAsset parent)
 establish a connection between this and the given parent asset, denoting we are in some way dependant on the parent.
virtual void unlink (IDA target)
 variant of unlink() dropping only the links to the given specific Asset, leaving all other links intact.
virtual void unlink ()
 release all links to other Asset objects held internally.
virtual ~Asset ()=0

Protected Attributes

vector< PAssetdependants
bool enabled
set< string > groups
 additional classification, selections or departments this asset belongs to.
const ID< Assetid
 Asset primary key.
const string longDesc
 user visible qualification of the thing, unit or concept represented by this asset.
vector< PAssetparents
const string shortDesc
 user visible Name-ID.

Private Member Functions

void unregister (PAsset &other)

Friends

class AssetManager
class DB

Classes

struct  Ident
 a POD comprised of all the information sufficiently identifying any given Asset. More...


Detailed Description

As of 09/2007, there are four Kinds of Assets, each comprising a sub-Interface of the Asset Interface: And of course there are various concret Asset subclasses, like asset::Clip, asset::Effect, asset::Codec, asset::Track, asset::Dataset.
Note:
Assets objects have a strict unique identity and because of this are non-copyable. You can not create an Asset derived object without registering it with the AssetManager automatically. It is possible to copy the PAsset (smart pointer) though.
Since:
09/2007
Author:
Ichthyo

Definition at line 139 of file asset.hpp.


Constructor & Destructor Documentation

asset::Asset::Asset ( const Ident idi  )  [protected]

Calling this base ctor causes registration with AssetManager.

Definition at line 55 of file asset.cpp.

References ident.

00056     : ident(idi), id(AssetManager::reg (this, idi)), enabled(true)
00057   {
00058     TRACE (assetmem, "ctor Asset(id=%lu) :  adr=%x %s", size_t(id), this, cStr(this->ident) );
00059   }

asset::Asset::~Asset (  )  [protected, pure virtual]

Note:
Asset is abstract

Definition at line 61 of file asset.cpp.

00062   { 
00063     TRACE (assetmem, "dtor Asset(id=%lu) :  adr=%x", size_t(id), this );
00064   }


Member Function Documentation

void asset::Asset::defineDependency ( PAsset  parent  )  [protected]

Definition at line 164 of file asset.cpp.

References asset::AssetManager::wrap().

00165   {
00166     PAsset p_this (AssetManager::wrap(*this));
00167     REQUIRE (!contains (parent->dependants, p_this));
00168     REQUIRE (!contains (this->parents, parent));
00169     parents.push_back (parent);
00170     parent->dependants.push_back(p_this);
00171   }

Here is the call graph for this function:

bool asset::Asset::enable ( bool  on = true  )  throw (lumiera::error::State)

change the enablement status of this asset.

Note the corresponding isActive predicate may depend on the enablement status of parent assets as well

Returns:
false if the state could not be changed due to parent objects being disabled

Definition at line 114 of file asset.cpp.

00115   {
00116     if (on == this->enabled)
00117       return true;
00118     if (on && !all_parents_enabled (parents))
00119       return false;
00120     
00121     // can indeed to do the toggle...
00122     this->enabled = on;
00123     for_each (dependants, bind (&propagate_down, _1 ,on));
00124     return true;
00125   }

const vector<PAsset>& asset::Asset::getDependant (  )  const [inline]

For example, all the clips depending on a given media file. May be empty. The dependency relation is transitive.

Definition at line 279 of file asset.hpp.

00279 { return dependants; }

const vector<PAsset>& asset::Asset::getParents (  )  const [inline]

May be empty. The head of this list can be considered the primary prerequisite

Definition at line 273 of file asset.hpp.

00273 { return parents; }

bool asset::Asset::isActive (  )  const

whether this asset is swithced on and consequently included in the fixture and participates in rendering.

Definition at line 99 of file asset.cpp.

00100   {
00101     return this->enabled
00102         && all_parents_enabled (parents);
00103   }

void asset::Asset::unlink ( IDA  target  )  [protected, virtual]

variant dropping only the links to the given Asset

Usable for propagating

Definition at line 155 of file asset.cpp.

References asset::AssetManager::instance.

00156   {
00157     PAsset asset (AssetManager::instance().getAsset (target));
00158     removeall (dependants,asset);
00159     removeall (parents,asset);
00160   }

void asset::Asset::unlink (  )  [protected, virtual]

release all links to other dependant asset objects held internally and advise all parent assets to do so with the link to this asset.

The lifecycle of Asset objects is managed by smart pointers and the Asset manager. Calling release() breaks interconnectons to other Assets in the central Object network comprising the session. It is up to the AssetManager to asure the notification of any other components that may need to release references to the Asset object beeing removed. The rationale is, after releasing all interlinkings, when the AssetManager removes its DB entry for this asset, the smart pointer goes out of scope and triggers cleanup.

Note:
we don't release upward links to parent assets, thus effectively keeping the parents alive, because frequently these accessible parent assets are part of our own contract. (e.g. media for clip assets)

Definition at line 145 of file asset.cpp.

References unregister().

00146   {
00147     function<void(PAsset&)> forget_me = bind(&Asset::unregister, this,_1);
00148     
00149     for_each (parents, forget_me);
00150     dependants.clear();
00151   }

Here is the call graph for this function:

void asset::Asset::unregister ( PAsset other  )  [private]

Parameters:
other 

For internal use only.

Definition at line 131 of file asset.cpp.

Referenced by unlink().

00132   {
00133     other->unlink (this->id);  
00134   }

Here is the caller graph for this function:


Member Data Documentation

set<string> asset::Asset::groups [protected]

Groups are optional, non-exclusive and may be overlapping.

Definition at line 215 of file asset.hpp.

const string asset::Asset::longDesc [protected]

perferably "in one line". To be localized.

Reimplemented in asset::Pipe.

Definition at line 222 of file asset.hpp.

const string asset::Asset::shortDesc [protected]

To be localized.

Reimplemented in asset::Pipe.

Definition at line 218 of file asset.hpp.


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

Generated on Sat Aug 16 18:10:40 2008 for Lumiera by  doxygen 1.5.5