Lumiera  0.pre.03
»edit your freedom«
test-scopes.cpp
Go to the documentation of this file.
1 /*
2  TEST-SCOPES.cpp - builds a test PlacementIndex containing dummy Placements as nested scopes
3 
4  Copyright (C) Lumiera.org
5  2009, 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 
34 
35 
36 namespace steam {
37 namespace mobject {
38 namespace session {
39 namespace test {
40 
41 
46  PPIdx
48  {
49  PDum p1(*new TestSubMO21);
50  PDum p2(*new TestSubMO21);
51  PDum p3(*new TestSubMO21);
52  PDum p4(*new TestSubMO21);
53  PDum p5(*new TestSubMO21);
54 
55  PDum ps1(*new DummyMO);
56  PDum ps2(*new TestSubMO2);
57  PDum ps3(*new TestSubMO1);
58 
59  // Prepare an (test)Index backing the PlacementRefs
61 
62  PMO& root = index->getRoot();
63 
64  typedef PMO::ID ID;
65  ID i1 = index->insert (p1, root);
66  ID i2 = index->insert (p2, i1 );
67  ID i3 = index->insert (p3, i2 );
68  ID i4 = index->insert (p4, i3 );
69  index->insert (p5, i4 );
70 
71  index->insert (ps1,root);
72  ID is2 =index->insert (ps2,root);
73  index->insert (ps3, is2);
74 
75  return index;
76  }
77 
78  namespace {
79  template<class MO>
81  retrieve_firstElmOfType()
82  {
85  }
86  }
87 
88 
97  {
98  return retrieve_firstElmOfType<TestSubMO1>();
99  }
100 
101  PlacementMO&
102  retrieve_firstTestSubMO21()
103  {
104  return retrieve_firstElmOfType<TestSubMO21>();
105  }
106 
107 
109  explore_testScope (PlacementMO const& scopeTop)
110  {
111  return ScopeQuery<MObject>(scopeTop, CHILDREN)
113  }
114 
115 
116 }}}} // namespace steam::mobject::session::test
Implementation level session API: query a scope.
Query a scope to discover it&#39;s contents or location.
Subclass-1 is not defined "processible", thus will always be handled as DummyMO...
Test MObject subclass, which, contrary to any real MObject, can be created directly without involving...
static lumiera::QueryResolver const & getResolver()
Definition: run.hpp:49
PPIdx build_testScopes()
helper for tests: create a pseudo-session (actually just a PlacementIndex), which contains some neste...
Definition: test-scopes.cpp:47
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
PlacementMO & retrieve_startElm()
complement to the helper: retrieve one of the dummy placements which is a Placement<> and way down in...
Definition: test-scopes.cpp:96
Unit test helper to generate a system of nested test scopes.
ScopeQuery< MObject >::iterator explore_testScope(PlacementMO const &scopeTop)
shortcut to explore the contents of a scope within the current index.
Implementation level session API: PlacementIndex mock for tests.
Specific queries to explore contents of a scope within the high-level model.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:80
discover the immediate children
static PPIdx install()
Re-define the implicit PlacementIndex temporarily, e.g.
Subclass-2 is defined "processible", but we omit the necessary "applicable" definition in TestTool...
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition: asset.hpp:108