Lumiera  0.pre.03
»edit your freedom«
testasset.cpp
Go to the documentation of this file.
1 /*
2  TestClip - test clip (stub) for checking Model/Session functionality
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
29 #include "steam/assetmanager.hpp"
30 
31 using std::static_pointer_cast;
32 
33 
34 namespace steam {
35 namespace asset{
36 namespace test {
37 
38  namespace
39  {
40  uint counter (0);
41 
47  {
48  return Asset::Ident ( string(_Fmt("TestAsset.%i") % counter)
49  , Category (META)
50  , "test"
51  , counter++
52  );
53  }
55  make_new_ident (PAsset& ref)
56  {
57  return Asset::Ident ( string(_Fmt("%s-TestAsset.%i") % ref->ident.name
58  % counter)
59  , ref->ident.category
60  , "test"
61  , counter++
62  );
63  }
64  }
65 
66 
67  template<class A>
69  : A(make_new_ident ())
70  { };
71 
72 
73  template<class A>
75  : A(make_new_ident (pRef))
76  {
77  this->defineDependency(pRef);
78  };
79 
80 
85  template<class A>
88  {
89  return static_pointer_cast<TestAsset<A>,Asset>
90  (AssetManager::instance().getAsset (this->id));
91  };
92 
93 
94 
95 }}} // namespace steam::asset::test
96 
97 
98 
99 
100 
101  /*********************************************************/
102  /* explicit template instantiations for some Asset Kinds */
103  /*********************************************************/
104 
105 #include "steam/asset/unknown.hpp"
106 
107 
108 namespace steam {
109 namespace asset{
110 namespace test {
111 
112  template TestAsset<Asset>::TestAsset ();
113  template TestAsset<Unknown>::TestAsset ();
114 
115  template TestAsset<Asset>::TestAsset (PAsset& pRef);
116  template TestAsset<Unknown>::TestAsset (PAsset& pRef);
117 
120 
121 
122 
123 }}} // namespace steam::asset::test
Steam-Layer Interface: Asset Lookup and Organisation.
Tree like classification of Assets.
Definition: category.hpp:75
Definition: run.hpp:49
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.
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:158
Superinterface describing especially bookkeeping properties.
Definition: asset.hpp:148
Marker Asset to indicate an unknown media source.
A mock asset to support unit testing.
Test(mock) asset subclass usable for hijacking a given asset class (template parameter) and subsequen...
Definition: testasset.hpp:52
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:80
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:44