Lumiera  0.pre.03
»edit your freedom«
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 
31 #include "steam/asset/struct.hpp"
32 #include "steam/assetmanager.hpp"
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 
44 using util::_Fmt;
45 using lib::Symbol;
49 
50 using util::contains;
51 
52 
53 namespace steam {
54 namespace 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 
157  lib::P<Pipe>
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"
179 #include "steam/asset/procpatt.hpp"
180 #include "steam/asset/timeline.hpp"
181 #include "steam/asset/sequence.hpp"
182 
183 
184 namespace steam {
185 namespace asset {
186  using PPipe = lib::P<Pipe>;
187 
192 
197 
198  template PPipe StructFactory::made4fake (Query<Pipe> const&);
202 
203 }} // namespace asset
Utilities to support working with predicate queries.
Steam-Layer Interface: Asset Lookup and Organisation.
Definition of a structural asset to express patterns of wiring or processing Processing patterns can ...
A "processing pipe" represented as Asset.
Basic and generic representation of an internal query.
the "front side" interface: the Steam-Layer code can use this QueryHandler to retrieve instances of t...
void normaliseID(string &id)
ensure standard format for a given id string.
Definition: query-util.cpp:52
Front-end for printf-style string template interpolation.
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.
This header is for including and configuring NoBug.
Steam-Layer implementation namespace root.
A front-end for using printf-style formatting.
Definition of the concrete frontend for rule based configuration within the session.
structural asset corresponding to the part of the model forming a processing pipe for generating medi...
Definition: pipe.hpp:70
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
lib::P< STRU > newInstance(Symbol nameID="")
invoke the factory to create new Structural Asset.
Definition: struct.cpp:85
Implementation details, especially concerning how configuration queries are resolved and when to crea...
static StructFactory retrieve
storage for the static StructFactory instance
Definition: struct.hpp:107
lib::P< STRU > operator()(Query< STRU > const &query)
Retrieve a suitable Structural Asset instance, possibly create one.
Definition: struct.cpp:112
Structural building block of the session: a sequence of clips.
Token or Atom with distinct identity.
Definition: symbol.hpp:117
static lib::Depend< ConfigResolver > instance
Singleton factory instance, configured with the actual implementation type.
StructFactory()
using private implementation detail class
Definition: struct.cpp:67
Marker types to indicate a literal string and a Symbol.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Private implementation details of creating various structural assets.
lib::P< Pipe > newPipe(string pipeID, string streamID)
Factory method for creating Pipes explicitly.
Definition: struct.cpp:158
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
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
user-visible Interface to the ConfigRules subsystem.
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35
Asset representation of structural elements within the model.
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition: query.hpp:270
bool contains(SEQ const &cont, typename SEQ::const_reference val)
shortcut for brute-force containment test in any sequential container
Definition: util.hpp:255
Top level structural element within the session.