#include <asset.hpp>


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< PAsset > | dependants |
| bool | enabled |
| set< string > | groups |
| additional classification, selections or departments this asset belongs to. | |
| const ID< Asset > | id |
| Asset primary key. | |
| const string | longDesc |
| user visible qualification of the thing, unit or concept represented by this asset. | |
| vector< PAsset > | parents |
| 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... | |
Definition at line 139 of file asset.hpp.
| 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] |
| 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 }

| 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
false if the state could not be changed due to parent objects being disabledDefinition 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] |
| const vector<PAsset>& asset::Asset::getParents | ( | ) | const [inline] |
| bool asset::Asset::isActive | ( | ) | const |
| 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.
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 }

| void asset::Asset::unregister | ( | PAsset & | other | ) | [private] |
set<string> asset::Asset::groups [protected] |
const string asset::Asset::longDesc [protected] |
perferably "in one line". To be localized.
Reimplemented in asset::Pipe.
const string asset::Asset::shortDesc [protected] |
1.5.5