Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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) 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 
31 #ifndef PROC_ASSET_BUILDINSTRUCT_H
32 #define PROC_ASSET_BUILDINSTRUCT_H
33 
34 
35 #include "lib/symbol.hpp"
36 
37 #include <boost/variant.hpp>
38 #include <string>
39 
40 using std::string;
41 
42 
43 
44 namespace proc {
45 namespace asset {
46 
47  using lib::Symbol;
48  using lib::Literal;
49 
50  class Proc;
51  class ProcPatt;
52 
55 
56 
57  static Symbol CURRENT = "current";
58 
59  struct DoAttach
60  {
61  vector<PProc> nodes;
62 
65 
66  DoAttach (Symbol where = CURRENT)
67  : point(where)
68  { }
69 
70  DoAttach (PProc& node, Symbol where = CURRENT)
71  : point(where)
72  {
73  nodes.push_back(node);
74  }
75 
76  };
77 
78 
79  struct DoRecurse
80  {
82 
83  explicit DoRecurse (PProcPatt& pattern) : subPattern_(pattern) {}
84  };
85 
86 
87 
89  {
90  // How to do this? we need some context to test the condition...
91  };
92 
93 
94  typedef boost::variant< DoAttach, DoRecurse, DoConditional > InstructEntry;
95 
112  : public InstructEntry
113  {
114  template<typename T>
115  BuildInstruct (T& instr) : InstructEntry() {}
116 
117  // TODO: this ctor is *not* correct, just to make it compile
118  // There is a strange problem with boost::variant, probably because the
119  // template parameter T could be anything (but actually we know it's one
120  // of our Instruction types.
121  // I have to re-investigate this design anyway, and probably will replace
122  // the boost::variant by something else, derive from a common base or such.
123  // Note: as of 8/2008 ProcPatt is just a draft and not implemented.
124 
125  // Note: 9/2013 : meanwhile the obvious solution would be to use our "polymorphic value",
126  // which was invented exactly to solve this notorious design mismatch in C++
127  };
128 
129 
130 
131 
132 
133 }} // namespace proc::asset
134 #endif
DoAttach(PProc &node, Symbol where=CURRENT)
DoAttach(Symbol where=CURRENT)
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:76
static Symbol CURRENT
vector< PProc > nodes
The asset subsystem of the Proc-Layer.
Definition: id-scheme.hpp:64
inline string literal This is a marker type to indicate that
Definition: symbol.hpp:75
Token or Atom with distinct identity.
Definition: symbol.hpp:116
Marker types to indicate a literal string and a Symbol.
DoRecurse(PProcPatt &pattern)
const_SList pattern
Definition: slist.h:605
boost::variant< DoAttach, DoRecurse, DoConditional > InstructEntry
Literal point
identifying the point where the nodes should be attached
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
(Interface) building instructions to be executed by the Builder on the render node network under cons...