![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
Steam-Layer Interface: Assets. More...
Go to the source code of this file.
Steam-Layer Interface: Assets.
Declares the Asset top level Interface, the Asset::Ident identification tuple and the asset::ID primary key wrapper. Normally, Assets should be handled using asset::PAsset, a ref counting smart pointer.
These classes are placed into namespace asset and proc_interface.
Assets are handled by a hierarchy of interfaces. Below the top level Asset interface there are interfaces for various different Kinds of Assets, like asset::Media, asset::Proc, etc. Code utilising the specific properties of e.g. Media assets, will be implemented directly against the asset::Media interface. To make this feasible while at the same time being able to handle all asset Kinds in a uniform manner, we use a hierarchy of ID classes. These IDs are actually just thin wrappers around a hash value, but they carry a template parameter specifying the Asset Kind and the Asset Kind subinterfaces provide a overloaded getID method with a covariant return value. For example the asset::Media::getID returns an ID<Media>. By using the templated query function AssetManager::getAsset, we can get at references to the more specific subinterface asset::media just by using the ID value in a typesafe manner. This helps avoiding dynamic typing and switch-on-type, leading to more robust, extensible and clear code.
(Implementation detail: as g++ is not able to handle member function template instantiations completely automatic, we need to trigger some template instantiations at the end of assetmanager.cpp )
Definition in file asset.hpp.
#include "lib/error.hpp"#include "lib/nocopy.hpp"#include "include/logging.h"#include "steam/asset/category.hpp"#include "lib/hash-value.h"#include "lib/p.hpp"#include <type_traits>#include <compare>#include <string>#include <vector>#include <set>Namespaces | |
| namespace | steam |
| Steam-Layer implementation namespace root. | |
| namespace | steam::asset |
| The asset subsystem of the Steam-Layer. | |
| namespace | proc_interface |
Typedefs | |
| typedef const ID< Asset > & | IDA |
| typedef lib::P< Asset > | PAsset |
| typedef lib::P< const Asset > | PcAsset |
Classes | |
| class | ID< KIND > |
| thin wrapper around a size_t hash ID used as primary key for all Asset objects. More... | |
| class | Asset |
| Superinterface describing especially bookkeeping properties. More... | |
| struct | Asset::Ident |
| a POD comprised of all the information sufficiently identifying any given Asset. More... | |
| struct | is_pAsset< X > |
| type trait for detecting a shared-ptr-to-asset More... | |
| struct | is_pAsset< shared_ptr< A > > |
Functions | |
| template<class A > | |
| const PcAsset | pAsset (shared_ptr< A > const &subPtr) |
| promote subtype-ptr to PAsset, e.g. | |