Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
assetmanager.hpp
Go to the documentation of this file.
1/*
2 ASSETMANAGER.hpp - Facade for the Asset subsystem
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
34#ifndef STEAM_INTERFACE_ASSETMANAGER_H
35#define STEAM_INTERFACE_ASSETMANAGER_H
36
37
38#include "steam/asset.hpp"
39#include "lib/error.hpp"
40#include "lib/depend.hpp"
41
42
43#include <cstddef>
44#include <string>
45#include <list>
46#include <boost/utility.hpp>
47
48using std::string;
49using std::list;
50
51
52namespace lumiera {
53namespace error {
54 LUMIERA_ERROR_DECLARE (UNKNOWN_ASSET_ID);
55 LUMIERA_ERROR_DECLARE (WRONG_ASSET_KIND);
56}}
57
58
59namespace steam {
60namespace asset {
61
62 class DB;
63
64
70 {
72
73
74 public:
76
78 static ID<Asset> getID (const Asset::Ident&);
79
81 template<class KIND>
82 static lib::P<KIND> wrap (const KIND& asset);
83
85 template<class KIND>
86 lib::P<KIND> getAsset (const ID<KIND>& id);
87
88
90 bool known (IDA id) ;
91
93 bool known (IDA id, const Category& cat) ;
94
97 void remove (IDA id) ;
98
105 void clear() ;
106
108 list<PcAsset> listContent() const;
109
110
111
112 protected:
116 template<class KIND>
117 static ID<KIND>
118 reg (KIND* obj, const Asset::Ident& idi);
119
121 static void destroy (Asset* aa) { delete aa; }
122
123 friend Asset::Asset (Asset::Ident const& idi);
124
126
128
129 };
130
131
132}} // namespace steam::asset
133
134
135
136namespace proc_interface
137 {
139}
140
141#endif
Steam-Layer Interface: Assets.
Access point to singletons and other kinds of dependencies designated by type.
Definition depend.hpp:281
Helper to abstract creation and lifecycle of a dependency.
Definition depend.hpp:127
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition p.hpp:77
Facade for the Asset subsystem.
static void destroy(Asset *aa)
deleter function used by the Asset smart pointers to delete Asset objects
static ID< Asset > getID(const Asset::Ident &)
provide the unique ID for given Asset::Ident tuple
list< PcAsset > listContent() const
extract a sorted list of all registered Assets
void clear()
deregister and evict all known Assets.
static lib::P< KIND > wrap(const KIND &asset)
retrieve the registered smart-ptr for any asset
lib::P< KIND > getAsset(const ID< KIND > &id)
find and return corresponding object
static ID< KIND > reg(KIND *obj, const Asset::Ident &idi)
registers an asset object in the internal DB, providing its unique key.
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
void remove(IDA id)
remove the given asset from the internal DB.
Superinterface describing especially bookkeeping properties.
Definition asset.hpp:139
Asset(const Ident &idi)
Asset is a Interface class; usually, objects of concrete subclasses are created via specialised Facto...
Definition asset.cpp:57
Tree like classification of Assets.
Definition category.hpp:68
Implementation of the registry holding all Asset instances known to the Asset Manager subsystem.
Definition db.hpp:90
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition asset.hpp:98
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
Singleton services and Dependency Injection.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition error.h:62
Lumiera error handling (C++ interface).
Lumiera public interface.
Definition advice.hpp:102
The asset subsystem of the Steam-Layer.
Steam-Layer implementation namespace root.
a POD comprised of all the information sufficiently identifying any given Asset.
Definition asset.hpp:147