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) 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 
23 
61 #ifndef ASSET_STRUCT_H
62 #define ASSET_STRUCT_H
63 
64 #include "lib/symbol.hpp"
65 #include "steam/asset.hpp"
66 #include "common/query.hpp"
67 #include "lib/nocopy.hpp"
68 
69 #include <memory>
70 #include <string>
71 
72 
73 
74 namespace steam {
75 namespace asset {
76 
77  using std::string;
78  using std::unique_ptr;
79  using lumiera::Query;
80  using lib::Symbol;
81 
82  class Struct;
83  class StructFactory;
84  class StructFactoryImpl;
85  class Pipe;
86 
87 
88  template<>
89  class ID<Struct> : public ID<Asset>
90  {
91  public:
92  ID (HashVal id);
93  ID (const Struct&);
94  };
95 
96 
97 
113  class Struct : public Asset
114  {
115  public:
117 
118  virtual const ID<Struct>&
119  getID() const
120  {
121  return static_cast<const ID<Struct>& > (Asset::getID());
122  }
123 
124 
125 
126  protected:
127  Struct (const Asset::Ident& idi) : Asset(idi) {}
128  };
129 
130 
131  // definition of ID<Struct> ctors is possible now,
132  // after providing full definition of class Struct
133 
134  inline ID<Struct>::ID(HashVal id) : ID<Asset> (id) {};
135  inline ID<Struct>::ID(const Struct& stru) : ID<Asset> (stru.getID()) {};
136 
137 
138 
139 
140 
141 
147  {
148  unique_ptr<StructFactoryImpl> impl_;
149 
150  protected:
151  StructFactory ();
152  friend class Struct;
153 
154 
155  public:
156  template<class STRU>
157  lib::P<STRU> operator() (Query<STRU> const& query);
158 
159 // lib::P<Timeline> operator() (MORef<Binding>); ///////////TODO doesn't this create circular includes?? Any better idea how to refer to an existing binding?
160 
161  template<class STRU>
162  lib::P<STRU> newInstance (Symbol nameID ="");
163 
164  template<class STRU>
165  lib::P<STRU> made4fake (Query<STRU> const& query);
166 
167  lib::P<Pipe> newPipe (string pipeID, string streamID);
168  };
169 
170 
171 
172 }} // namespace steam::asset
173 #endif
Basic and generic representation of an internal query.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Steam-Layer implementation namespace root.
virtual const ID< Struct > & getID() const
<
Definition: struct.hpp:119
static StructFactory retrieve
storage for the static StructFactory instance
Definition: struct.hpp:116
Token or Atom with distinct identity.
Definition: symbol.hpp:116
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:158
Marker types to indicate a literal string and a Symbol.
Superinterface describing especially bookkeeping properties.
Definition: asset.hpp:148
Steam-Layer Interface: Assets.
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:56
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:78
key abstraction: structural asset Created automatically as a sideeffect of building the structure of ...
Definition: struct.hpp:113
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:44
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition: query.hpp:279
Factory specialised for creating Structural Asset objects.
Definition: struct.hpp:145
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition: asset.hpp:108