40 using std::placeholders::_1;
55 Asset::Ident::Ident(
const string& n,
const Category& cat,
const string& o,
const uint ver)
71 TRACE (asset_mem,
"ctor Asset(id=%zu) : adr=%p %s",
size_t(
id),
this,
cStr(this->
ident) );
76 TRACE (asset_mem,
"dtor Asset(id=%zu) : adr=%p",
size_t(
id),
this );
80 Asset::Ident::operator string ()
const 82 return string (
_Fmt(
"(%2%:%3%.%1% v%4%)")
90 Asset::operator string ()
const 92 return string (
_Fmt(
"Asset(%2%:%3%.%1% v%4%)")
101 Asset::Ident::isValid()
const 103 return not isnil (
name)
105 and version <= 1000000;
111 function<bool(const PAsset&)> check_isActive
113 , bind (&PAsset::get, _1 )
117 all_parents_enabled (
const vector<PAsset>& parents)
119 return and_all (parents, check_isActive);
130 and all_parents_enabled (parents);
135 propagate_down (
PAsset child,
bool on)
144 if (on == this->enabled)
146 if (on and not all_parents_enabled (parents))
151 for_each (dependants, &propagate_down, _1 ,on);
161 other->unlink (this->
id);
177 for_each (parents, forget_me);
186 removeall (dependants,asset);
187 removeall (parents,asset);
195 REQUIRE (!contains (parent->dependants, p_this));
196 REQUIRE (!contains (this->parents, parent));
197 parents.push_back (parent);
198 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