Lumiera  0.pre.03
»edit your freedom«
session-services.cpp
Go to the documentation of this file.
1 /*
2  SessionServices - accessing Steam-Layer internal session implementation services
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 
40 
44 
46 #include "lib/symbol.hpp"
47 
48 using lib::Symbol;
49 
50 namespace steam {
51 namespace mobject {
52 namespace session {
53 
57  bool
59  {
60  return Session::initFlag
62  }
63 
68  bool
69  SessionServiceFetch::isRegisteredID (PlacementMO::ID const& placementID)
70  {
71  return SessionImplAPI::current->isRegisteredID (placementID);
72  }
73 
74 
86  SessionServiceFetch::resolveID (PlacementMO::ID const& placementID)
87  {
88  return SessionImplAPI::current->resolveID (placementID);
89  }
90 
91 
99  PlacementMO::ID const&
100  SessionServiceMutate::attach_toModel(PMO newPlacement, PID scope)
101  {
102  return SessionImplAPI::current->insertCopy (newPlacement,scope);
103  }
104 
105 
111  bool
113  {
114  return SessionImplAPI::current->purgeScopeRecursively (scope);
115  }
116 
117 
123  bool
125  {
126  return SessionImplAPI::current->detachElement (leafElement);
127  }
128 
129 
130 
131 
132  namespace { // deleter function to clean up test/mock PlacementIndex
133  void
134  remove_testIndex (PlacementIndex* testIdx)
135  {
136  REQUIRE (testIdx);
137  SessionImplAPI::current->reset_PlacementIndex(); // restore default Index from Session
138 
139  testIdx->clear();
140  ASSERT (0 == testIdx->size());
141  delete testIdx;
142  }
143  }
144 
146  PPIdx
148  {
149  Symbol typeID ("dummyRoot");
150  PMO dummyRoot (MObject::create (typeID));
151  PPIdx mockIndex (new PlacementIndex(dummyRoot), &remove_testIndex); // manage instance lifecycle
152  ENSURE (mockIndex);
153  ENSURE (mockIndex->isValid());
154  ENSURE (1 == mockIndex.use_count());
155 
156  SessionImplAPI::current->reset_PlacementIndex (mockIndex.get());
157  return mockIndex;
158  }
159 
160 
162  QueryResolver const&
164  {
165  return SessionImplAPI::current->getScopeQueryResolver();
166  }
167 
168 
170  PlacementMO&
172  {
173  return SessionImplAPI::current->getScope(placementToLocate);
174  }
175 
176 
177  PlacementMO&
178  SessionServiceExploreScope::getScope (PlacementMO::ID const& placementToLocate)
179  {
180  return SessionImplAPI::current->getScope(placementToLocate);
181  }
182 
183 
185  PlacementMO&
187  {
188  return SessionImplAPI::current->getScopeRoot();
189  }
190 
191 
192 
193 }}} // namespace steam::mobject::session
Implementation level session API: query a scope.
static FRONT & current
intended to be hard-wired to SessManagerImpl singleton
static lumiera::QueryResolver const & getResolver()
static bool isRegisteredID(PlacementMO::ID const &)
verify the given placement-ID (hash) is valid, by checking if it refers to a Placement instance curre...
Interface: a facility for resolving (some kind of) queries A concrete subclass has the ability to cre...
Implementation level session API: resolve a Placement by hash-ID.
static session::SessManager & current
access point to the current Session
Definition: session.hpp:120
static PlacementMO & resolveID(PlacementMO::ID const &)
actually retrieve a Placement tracked by the index.
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:65
A mechanism for exposing and accessing implementation level services of the session.
Token or Atom with distinct identity.
Definition: symbol.hpp:117
static PlacementMO & getScope(PlacementMO const &)
Implementation facility for session management.
static bool isAccessible()
is the element-fetch service usable? Effectively this means: is the session up?
Marker types to indicate a literal string and a Symbol.
static PID attach_toModel(PMO, PID)
attach an object by placement onto the session.
Implementation level session API: PlacementIndex mock for tests.
void clear(ID targetScope)
recursively kill a complete scope, including the given element and all children.
Structured compound of Placement instances with lookup capabilities.
Core factory to generate media objects for use in the Session model.
static bool detach_and_clear(PID)
detach the denoted element from the model including all children.
Session and SessionServices Implementation classes.
virtual bool isUp()=0
diagnostics: session interface opened?
static bool initFlag
temporary fix for init problems
Definition: session.hpp:118
static PPIdx install()
Re-define the implicit PlacementIndex temporarily, e.g.
static session::MObjectFactory create
Storage for the (single, static) MObject factory object.
Definition: mobject.hpp:89
Implementation level session API: add or remove Session contents.
static bool detach(PID)
detach the denoted leaf element from the model.
Implementation level session API: to manage default configured objects.