31 using std::placeholders::_1;
46 Asset::Ident::Ident(
const string& n,
const Category& cat,
const string& o,
const uint ver)
62 TRACE (asset_mem,
"ctor Asset(id=%zu) : adr=%p %s",
size_t(
id),
this,
cStr(this->
ident) );
67 TRACE (asset_mem,
"dtor Asset(id=%zu) : adr=%p",
size_t(
id),
this );
71 Asset::Ident::operator string ()
const 73 return string (
_Fmt(
"(%2%:%3%.%1% v%4%)")
81 Asset::operator string ()
const 83 return string (
_Fmt(
"Asset(%2%:%3%.%1% v%4%)")
92 Asset::Ident::isValid()
const 94 return not isnil (
name)
96 and version <= 1000000;
102 function<bool(const PAsset&)> check_isActive
104 , bind (&PAsset::get, _1 )
108 all_parents_enabled (
const vector<PAsset>& parents)
110 return and_all (parents, check_isActive);
121 and all_parents_enabled (parents);
126 propagate_down (
PAsset child,
bool on)
135 if (on == this->enabled)
137 if (on and not all_parents_enabled (parents))
142 for_each (dependants, &propagate_down, _1 ,on);
152 other->unlink (this->
id);
168 for_each (parents, forget_me);
177 removeall (dependants,asset);
178 removeall (parents,asset);
186 REQUIRE (!contains (parent->dependants, p_this));
187 REQUIRE (!contains (this->parents, parent));
188 parents.push_back (parent);
189 parent->dependants.push_back(p_this);
virtual void unlink()
release all links to other Asset objects held internally.
string name
element ID, comprehensible but sanitised.
Steam-Layer Interface: Asset Lookup and Organisation.
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
bool isActive() const
weather this asset is switched on and consequently included in the fixture and participates in render...
const Ident ident
Asset identification tuple.
std::string sanitise(std::string const &)
produce an identifier based on the given string.
bool and_all(CON const &elements, FUN function, P1 &&bind1, ARGS &&...args)
Accept binding for arbitrary function arguments.
Facade for the Asset subsystem.
Steam-Layer implementation namespace root.
A front-end for using printf-style formatting.
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
bool enable(bool on=true)
change the enabled status of this asset.
a POD comprised of all the information sufficiently identifying any given Asset.
void unregister(PAsset &other)
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Superinterface describing especially bookkeeping properties.
Steam-Layer Interface: Assets.
void for_each(CON const &elements, FUN function, P1 &&bind1, ARGS &&...args)
Accept binding for arbitrary function arguments.
const string org
origin or authorship id.
static lib::P< KIND > wrap(const KIND &asset)
retrieve the registered smart-ptr for any asset
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
SEQ::iterator removeall(SEQ &coll, typename SEQ::value_type const &val)
shortcut for removing all copies of an Element in any sequential collection
void defineDependency(PAsset parent)
establish a connection between this and the given parent asset, denoting we are in some way dependent...
const uint version
version number of the thing or concept represented by this asset.
asset::Category category
primary tree like classification of the asset.
The asset subsystem of the Steam-Layer.
Perform operations "for each element" of a collection.
bool contains(SEQ const &cont, typename SEQ::const_reference val)
shortcut for brute-force containment test in any sequential container