Lumiera  0.pre.03
»edit your freedom«
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 
48 using std::string;
49 using std::list;
50 
51 
52 namespace lumiera {
53 namespace error {
54  LUMIERA_ERROR_DECLARE (UNKNOWN_ASSET_ID);
55  LUMIERA_ERROR_DECLARE (WRONG_ASSET_KIND);
56 }}
57 
58 
59 namespace steam {
60 namespace asset {
61 
62  class DB;
63 
64 
70  {
71  asset::DB & registry;
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 
125  AssetManager();
126 
127  friend class lib::DependencyFactory<AssetManager>;
128 
129  };
130 
131 
132 }} // namespace steam::asset
133 
134 
135 
136 namespace proc_interface
137  {
139 }
140 
141 #endif
Tree like classification of Assets.
Definition: category.hpp:66
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
Facade for the Asset subsystem.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:62
Steam-Layer implementation namespace root.
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:280
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
Implementation of the registry holding all Asset instances known to the Asset Manager subsystem...
Definition: db.hpp:89
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:149
Superinterface describing especially bookkeeping properties.
Definition: asset.hpp:139
Steam-Layer Interface: Assets.
Singleton services and Dependency Injection.
Lumiera error handling (C++ interface).
Lumiera public interface.
Definition: advice.cpp:104
Helper to abstract creation and lifecycle of a dependency.
Definition: depend.hpp:125
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
static void destroy(Asset *aa)
deleter function used by the Asset smart pointers to delete Asset objects
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35