Lumiera
0.pre.03
»edit your freedom«
|
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 <boost/type_traits/is_base_of.hpp>
#include <boost/operators.hpp>
#include <cstddef>
#include <string>
#include <vector>
#include <set>
Classes | |
class | Asset |
Superinterface describing especially bookkeeping properties. More... | |
class | ID< KIND > |
thin wrapper around a size_t hash ID used as primary key for all Asset objects. 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 > > |
Typedefs | |
typedef const ID< Asset > & | IDA |
typedef lib::P< Asset > | PAsset |
typedef lib::P< const Asset > | PcAsset |
Functions | |
template<class A > | |
const PcAsset | pAsset (shared_ptr< A > const &subPtr) |
promote subtype-ptr to PAsset, e.g. More... | |
Namespaces | |
steam | |
Steam-Layer implementation namespace root. | |
steam::asset | |
The asset subsystem of the Steam-Layer. | |