Lumiera  0.pre.03
»edit your freedom«
struct.hpp
Go to the documentation of this file.
1 /*
2  STRUCT.hpp - 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 
52 #ifndef ASSET_STRUCT_H
53 #define ASSET_STRUCT_H
54 
55 #include "lib/symbol.hpp"
56 #include "steam/asset.hpp"
57 #include "common/query.hpp"
58 #include "lib/nocopy.hpp"
59 
60 #include <memory>
61 #include <string>
62 
63 
64 
65 namespace steam {
66 namespace asset {
67 
68  using std::string;
69  using std::unique_ptr;
70  using lumiera::Query;
71  using lib::Symbol;
72 
73  class Struct;
74  class StructFactory;
75  class StructFactoryImpl;
76  class Pipe;
77 
78 
79  template<>
80  class ID<Struct> : public ID<Asset>
81  {
82  public:
83  ID (HashVal id);
84  ID (const Struct&);
85  };
86 
87 
88 
104  class Struct : public Asset
105  {
106  public:
108 
109  virtual const ID<Struct>&
110  getID() const
111  {
112  return static_cast<const ID<Struct>& > (Asset::getID());
113  }
114 
115 
116 
117  protected:
118  Struct (const Asset::Ident& idi) : Asset(idi) {}
119  };
120 
121 
122  // definition of ID<Struct> ctors is possible now,
123  // after providing full definition of class Struct
124 
125  inline ID<Struct>::ID(HashVal id) : ID<Asset> (id) {};
126  inline ID<Struct>::ID(const Struct& stru) : ID<Asset> (stru.getID()) {};
127 
128 
129 
130 
131 
132 
138  {
139  unique_ptr<StructFactoryImpl> impl_;
140 
141  protected:
142  StructFactory ();
143  friend class Struct;
144 
145 
146  public:
147  template<class STRU>
148  lib::P<STRU> operator() (Query<STRU> const& query);
149 
150 // lib::P<Timeline> operator() (MORef<Binding>); ///////////TODO doesn't this create circular includes?? Any better idea how to refer to an existing binding?
151 
152  template<class STRU>
153  lib::P<STRU> newInstance (Symbol nameID ="");
154 
155  template<class STRU>
156  lib::P<STRU> made4fake (Query<STRU> const& query);
157 
158  lib::P<Pipe> newPipe (string pipeID, string streamID);
159  };
160 
161 
162 
163 }} // namespace steam::asset
164 #endif
Basic and generic representation of an internal query.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
Steam-Layer implementation namespace root.
virtual const ID< Struct > & getID() const
<
Definition: struct.hpp:110
static StructFactory retrieve
storage for the static StructFactory instance
Definition: struct.hpp:107
Token or Atom with distinct identity.
Definition: symbol.hpp:117
Mix-Ins to allow or prohibit various degrees of copying and cloning.
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:149
Marker types to indicate a literal string and a Symbol.
Superinterface describing especially bookkeeping properties.
Definition: asset.hpp:139
Steam-Layer Interface: Assets.
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:52
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
key abstraction: structural asset Created automatically as a sideeffect of building the structure of ...
Definition: struct.hpp:104
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition: query.hpp:270
Factory specialised for creating Structural Asset objects.
Definition: struct.hpp:136
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition: asset.hpp:99