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)
5  2009, 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 
25 
26 
27 namespace steam {
28 namespace mobject {
29 namespace session {
30 namespace test {
31 
32 
37  PPIdx
39  {
40  PDum p1(*new TestSubMO21);
41  PDum p2(*new TestSubMO21);
42  PDum p3(*new TestSubMO21);
43  PDum p4(*new TestSubMO21);
44  PDum p5(*new TestSubMO21);
45 
46  PDum ps1(*new DummyMO);
47  PDum ps2(*new TestSubMO2);
48  PDum ps3(*new TestSubMO1);
49 
50  // Prepare an (test)Index backing the PlacementRefs
52 
53  PMO& root = index->getRoot();
54 
55  typedef PMO::ID ID;
56  ID i1 = index->insert (p1, root);
57  ID i2 = index->insert (p2, i1 );
58  ID i3 = index->insert (p3, i2 );
59  ID i4 = index->insert (p4, i3 );
60  index->insert (p5, i4 );
61 
62  index->insert (ps1,root);
63  ID is2 =index->insert (ps2,root);
64  index->insert (ps3, is2);
65 
66  return index;
67  }
68 
69  namespace {
70  template<class MO>
72  retrieve_firstElmOfType()
73  {
76  }
77  }
78 
79 
88  {
89  return retrieve_firstElmOfType<TestSubMO1>();
90  }
91 
93  retrieve_firstTestSubMO21()
94  {
95  return retrieve_firstElmOfType<TestSubMO21>();
96  }
97 
98 
100  explore_testScope (PlacementMO const& scopeTop)
101  {
102  return ScopeQuery<MObject>(scopeTop, CHILDREN)
104  }
105 
106 
107 }}}} // 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:40
PPIdx build_testScopes()
helper for tests: create a pseudo-session (actually just a PlacementIndex), which contains some neste...
Definition: test-scopes.cpp:38
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:65
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:87
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:71
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:99