Lumiera  0.pre.03
»edit your freedom«
buildinstruct.hpp
Go to the documentation of this file.
1 /*
2  BUILDINSTRUCT.hpp - Instructions for building some configuration of render nodes.
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 
22 #ifndef STEAM_ASSET_BUILDINSTRUCT_H
23 #define STEAM_ASSET_BUILDINSTRUCT_H
24 
25 
26 #include "lib/symbol.hpp"
27 
28 #include <boost/variant.hpp>
29 #include <string>
30 
31 using std::string;
32 
33 
34 
35 namespace steam {
36 namespace asset {
37 
38  using lib::Symbol;
39  using lib::Literal;
40 
41  class Proc;
42  class ProcPatt;
43 
44  using PProc = lib::P<const asset::Proc>;
45  using PProcPatt = lib::P<const asset::ProcPatt>;
46 
47 
48  static Symbol CURRENT = "current";
49 
50  struct DoAttach
51  {
52  vector<PProc> nodes;
53 
56 
57  DoAttach (Symbol where = CURRENT)
58  : point(where)
59  { }
60 
61  DoAttach (PProc& node, Symbol where = CURRENT)
62  : point(where)
63  {
64  nodes.push_back(node);
65  }
66 
67  };
68 
69 
70  struct DoRecurse
71  {
72  PProcPatt subPattern_;
73 
74  explicit DoRecurse (PProcPatt& pattern) : subPattern_(pattern) {}
75  };
76 
77 
78 
80  {
81  // How to do this? we need some context to test the condition...
82  };
83 
84 
85  typedef boost::variant< DoAttach, DoRecurse, DoConditional > InstructEntry;
86 
103  : public InstructEntry
104  {
105  template<typename T>
106  BuildInstruct (T& instr) : InstructEntry() {}
107 
108  // TODO: this ctor is *not* correct, just to make it compile
109  // There is a strange problem with boost::variant, probably because the
110  // template parameter T could be anything (but actually we know it's one
111  // of our Instruction types.
112  // I have to re-investigate this design anyway, and probably will replace
113  // the boost::variant by something else, derive from a common base or such.
114  // Note: as of 8/2008 ProcPatt is just a draft and not implemented.
115 
116  // Note: 9/2013 : meanwhile the obvious solution would be to use our "polymorphic value",
117  // which was invented exactly to solve this notorious design mismatch in C++
118  };
119 
120 
121 
122 
123 
124 }} // namespace steam::asset
125 #endif
Literal point
identifying the point where the nodes should be attached
inline string literal This is a marker type to indicate that
Definition: symbol.hpp:76
Steam-Layer implementation namespace root.
Token or Atom with distinct identity.
Definition: symbol.hpp:117
Marker types to indicate a literal string and a Symbol.
(Interface) building instructions to be executed by the Builder on the render node network under cons...
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
Proc
Result instruction from Activity activation.
Definition: activity.hpp:140
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35