Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
struct.cpp
Go to the documentation of this file.
1/*
2 Struct(Asset) - key abstraction: structural asset
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
14
34
36
37#include "lib/util.hpp"
38#include "lib/symbol.hpp"
39#include "lib/query-util.hpp"
40#include "lib/format-string.hpp"
41#include "include/logging.h"
42#include "common/query.hpp"
43
44using util::_Fmt;
45using lib::Symbol;
49
50using util::contains;
51
52
53namespace steam {
54namespace asset {
55
56 /****** NOTE: not fully implemented yet. What follows is partially a hack to build simple tests *******/
57
58
59
60
61
63 StructFactory Struct::retrieve;
64
65
68 : impl_(new StructFactoryImpl(*this))
69 { }
70
71
83 template<class STRU>
86 {
87 Query<STRU> desired_name (isnil(nameID)? "" : "id("+nameID+")");
88 STRU* pS = impl_->fabricate (desired_name);
89 return AssetManager::instance().wrap (*pS);
90 }
91
92
93
110 template<class STRU>
113 {
114 lib::P<STRU> res;
116 typeHandler.resolve (res, capabilities);
117
118 if (res)
119 return res;
120
121 // create new one, since the
122 // ConfigQuery didn't yield any result
123 STRU* pS = impl_->fabricate(capabilities);
124 return AssetManager::instance().wrap (*pS);
125 }
126
127
129
138 template<class STRU>
141 {
142 STRU* pS = impl_->fabricate(query);
143 return AssetManager::instance().wrap (*pS);
144 }
146
147
158 StructFactory::newPipe (string pipeID, string streamID)
159 {
160 normaliseID (pipeID);
161 normaliseID (streamID);
162 _Fmt descriptor("pipe(%s), stream(%s).");
163 Pipe* pP = impl_->fabricate (Query<Pipe> (descriptor % pipeID % streamID));
164 return AssetManager::instance().wrap (*pP);
165 }
166
167
168
169}} // namespace asset
170
171
172
173
174 /**************************************************/
175 /* explicit instantiations of the factory methods */
176 /**************************************************/
177
178#include "steam/asset/pipe.hpp"
182
183
184namespace steam {
185namespace asset {
186 using PPipe = lib::P<Pipe>;
187
188 template PPipe StructFactory::operator() (Query<Pipe> const&);
189 template PProcPatt StructFactory::operator() (Query<const ProcPatt> const&);
190 template PTimeline StructFactory::operator() (Query<Timeline> const&);
191 template PSequence StructFactory::operator() (Query<Sequence>const&);
192
197
198 template PPipe StructFactory::made4fake (Query<Pipe> const&);
199 template PProcPatt StructFactory::made4fake (Query<const ProcPatt> const&);
200 template PTimeline StructFactory::made4fake (Query<Timeline> const&);
201 template PSequence StructFactory::made4fake (Query<Sequence>const&);
202
203}} // namespace asset
Steam-Layer Interface: Asset Lookup and Organisation.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition p.hpp:77
Token or Atom with distinct identity.
Definition symbol.hpp:120
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition query.hpp:254
the "front side" interface: the Steam-Layer code can use this QueryHandler to retrieve instances of t...
virtual bool resolve(P< TY > &solution, Query< TY > const &q)=0
try to find or create an object of type TY fulfilling the given query.
user-visible Interface to the ConfigRules subsystem.
static lib::Depend< ConfigResolver > instance
Singleton factory instance, configured with the actual implementation type.
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
structural asset corresponding to the part of the model forming a processing pipe for generating medi...
Definition pipe.hpp:72
Implementation details, especially concerning how configuration queries are resolved and when to crea...
lib::P< STRU > operator()(Query< STRU > const &query)
Retrieve a suitable Structural Asset instance, possibly create one.
Definition struct.cpp:112
StructFactory()
using private implementation detail class
Definition struct.cpp:67
lib::P< STRU > made4fake(Query< STRU > const &query)
special backdoor for fake-configrules.hpp This allows to simulate creation of objects triggered by ru...
Definition struct.cpp:140
unique_ptr< StructFactoryImpl > impl_
Definition struct.hpp:139
lib::P< STRU > newInstance(Symbol nameID="")
invoke the factory to create new Structural Asset.
Definition struct.cpp:85
lib::P< Pipe > newPipe(string pipeID, string streamID)
Factory method for creating Pipes explicitly.
Definition struct.cpp:158
static StructFactory retrieve
storage for the static StructFactory instance
Definition struct.hpp:107
A front-end for using printf-style formatting.
Definition of the concrete frontend for rule based configuration within the session.
Front-end for printf-style string template interpolation.
This header is for including and configuring NoBug.
void normaliseID(string &id)
ensure standard format for a given id string.
The asset subsystem of the Steam-Layer.
lib::P< Pipe > PPipe
Definition pipe.hpp:43
lib::P< Sequence > PSequence
Definition sequence.hpp:76
lib::P< Timeline > PTimeline
Definition timeline.hpp:82
lib::P< const asset::ProcPatt > PProcPatt
Steam-Layer implementation namespace root.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition util.hpp:230
A "processing pipe" represented as Asset.
Definition of a structural asset to express patterns of wiring or processing Processing patterns can ...
Utilities to support working with predicate queries.
Basic and generic representation of an internal query.
Structural building block of the session: a sequence of clips.
Private implementation details of creating various structural assets.
Asset representation of structural elements within the model.
Marker types to indicate a literal string and a Symbol.
Top level structural element within the session.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...