Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
session-impl.hpp
Go to the documentation of this file.
1/*
2 SESSION-IMPL.hpp - holds the complete session data to be edited by the user
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
37#ifndef STEAM_MOBJECT_SESSION_SESSIONIMPL_H
38#define STEAM_MOBJECT_SESSION_SESSIONIMPL_H
39
45
50
52
53
54
55
56
57namespace steam {
58namespace mobject {
59namespace session {
60
62
63
68 : protected SessionInterfaceModules
69 , public mobject::Session
70 {
72
73 PFixture fixture_;
74
75
76
77
78 /* ==== Session API ==== */
79 virtual bool isValid() override;
80 virtual MObjectRef attach (PMO const& placement) override;
81 virtual bool detach (PMO const& placement) override;
82
83 virtual MObjectRef getRoot() override;
84
85 virtual PFixture& getFixture() override;
86 virtual void rebuildFixture() override;
87
88 protected: /* == management API === */
89 SessionImpl ();
90
91 void clear ();
92 friend class SessManagerImpl;
93
96 {
97 ENSURE (contents_.isValid());
98 return contents_;
99 }
100
101 };
102
103
104
105 /* ===== providing internal services for Steam ===== */
106
107 template<class IMPL>
109 : IMPL
110 {
111 bool
112 isRegisteredID (PMO::ID const& placementID)
113 {
114 return IMPL::getPlacementIndex().contains (placementID); //never throws
115 }
116
117 PMO&
118 resolveID (PMO::ID const& placementID)
119 {
120 return IMPL::getPlacementIndex().find (placementID); //may throw
121 }
122 };
123
124
125
126
127 template<class IMPL>
129 : IMPL
130 {
131 PMO::ID const&
132 insertCopy (PMO const& newPlacement, PMO::ID const& scope)
133 {
134 return index().insert (newPlacement,scope);
135 }
136
137 bool
138 purgeScopeRecursively (PMO::ID const& scope)
139 {
140 size_t siz = index().size();
141 if (index().contains (scope))
142 index().clear (scope);
143
144 ENSURE (!index().contains (scope) or (scope == index().getRoot().getID()));
145 ENSURE (siz >= index().size());
146 return siz != index().size();
147 }
148
149 bool
150 detachElement (PMO::ID const& placementID)
151 {
152 return index().remove (placementID);
153 }
154
155 private:
158 {
159 return IMPL::getPlacementIndex();
160 }
161 };
162
163
164
165
166 template<class IMPL>
168 : IMPL
169 {
172 {
173 return resolvingWrapper_;
174 }
175
177 getScope (PlacementMO const& placement2locate)
178 {
179 return IMPL::getPlacementIndex().getScope(placement2locate);
180 }
181
183 getScope (PlacementMO::ID const& placement2locate)
184 {
185 return IMPL::getPlacementIndex().getScope(placement2locate);
186 }
187
190 {
191 return IMPL::getPlacementIndex().getRoot();
192 }
193
194 private:
196
199 struct
200 AccessCurrentIndex
201 {
203 PlacementIndex& operator() (void) { return accessPoint_.getPlacementIndex(); }
204
205 AccessCurrentIndex (IMPL& impl) : accessPoint_(impl) { }
206 };
207
208 protected:
210 : resolvingWrapper_(AccessCurrentIndex (*this))
211 { }
212 };
213
214
215
216
217
218 template<class IMPL>
220 : IMPL
221 {
224 {
225 if (mockIndex_ and mockIndex_->isValid())
226 return *mockIndex_;
227 else
228 return IMPL::getPlacementIndex();
229 }
230
231 void
233 {
234 mockIndex_ = alternativeIndex;
235 }
236
237 protected:
239 : mockIndex_(0)
240 { }
241
242 private:
244 };
245
246
247
248 template<class IMPL>
250 : IMPL
251// , SessionServiceDefaults
252 {
254 };
255
256
257
258
259
260
261 class SessManagerImpl;
262
276 > // List of the APIs to provide
277 , SessManagerImpl // frontend for access
278 , SessionImpl // implementation base class
279 >; //
280
281
282
283}}} // namespace steam::mobject::session
284#endif
Interface: a facility for resolving (some kind of) queries A concrete subclass has the ability to cre...
The (current) Session holds all the user visible content to be edited and manipulated within the Lumi...
Definition session.hpp:102
Wrapper for the PlacementIndex, allowing to resolve scope contents discovery.
Structured compound of Placement instances with lookup capabilities.
bool isValid() const
validity self-check, used for sanity checks and the session self-check.
Session manager implementation class holding the actual smart pointer to the current Session impl.
Implementation class for the Session interface.
virtual void rebuildFixture() override
SessionImpl()
create a new empty session with default values.
virtual MObjectRef attach(PMO const &placement) override
attach a copy within the scope of the current QueryFocus point
virtual PFixture & getFixture() override
virtual MObjectRef getRoot() override
virtual bool detach(PMO const &placement) override
detach the denoted object (placement) from model, together with any child objects contained in the sc...
Implementation-level service for resolving an Placement-ID.
there is an implicit PlacementIndex available on a global level, by default implemented within the cu...
Implementation-level service for resolving an Placement-ID.
Collection of configured implementation-level services to provide by the Session.
Backbone data structure of the low-level render node model The fixture defines the boundary between t...
variadic sequence of types
Definition typelist.hpp:102
shared_ptr< Fixture > PFixture
Definition fixture.hpp:91
Namespace of Session and user visible high-level objects.
Definition sequence.hpp:65
SessionServices< Types< SessionServiceFetch, SessionServiceMutate, SessionServiceExploreScope, SessionServiceMockIndex, SessionServiceDefaults >, SessManagerImpl, SessionImpl > SessionImplAPI
actual configuration of the session implementation compound: forming an inheritance chain of all inte...
Access point to a single implementation-level API.
MORef< MObject > MObjectRef
Steam-Layer implementation namespace root.
Implementing resolution of "discover contents"-queries based on PlacementIndex.
Core of the session implementation datastructure.
Self-contained sub-elements on the Session API.
Implementation level session API: to manage default configured objects.
Implementation level session API: query a scope.
Implementation level session API: resolve a Placement by hash-ID.
Implementation level session API: PlacementIndex mock for tests.
A mechanism for exposing and accessing implementation level services of the session.
Primary Interface to the current Session.
PlacementMO & getScope(PlacementMO::ID const &placement2locate)
PMO::ID const & insertCopy(PMO const &newPlacement, PMO::ID const &scope)
Collection of implementation components, providing self-contained sub-elements exposed on the public ...
Implementation-level service for issuing contents/discovery queries.