Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
session-impl.cpp
Go to the documentation of this file.
1/*
2 SessionImpl - 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
27#include "lib/error.hpp"
28
29
30namespace steam {
31namespace mobject {
32namespace session {
33
34
35
43 , Session( defaultsManager_
44 , elementQueryAPI_
45 , timelineRegistry_
46 , sequenceRegistry_ )
47 , contents_( MObject::create (defaultsManager_))
48 , fixture_(new fixture::Fixture)
49 {
50 INFO (session, "new Session created.");
51 }
52
53
58 void
60 {
61 try
62 {
64 }
65 catch (...)
66 {
67 throw error::Fatal ("unexpected exception while clearing the session");
68 }
69 }
70
71
72 bool
74 {
75 return true;
76 }
77
78
79
87 SessionImpl::attach (PMO const& placement)
88 {
89 MObjectRef newAttachedInstance;
90 RefPlacement attachmentPoint = QueryFocus().currentPoint();
91 newAttachedInstance.activate(
92 contents_.insert (placement, attachmentPoint));
93 return newAttachedInstance;
94 }
95
96
106 bool
107 SessionImpl::detach (PMO const& placement)
108 {
109 bool is_known = contents_.contains (placement);
110 if (is_known)
111 {
112 if (Scope(placement).isRoot())
113 throw error::Invalid ("Can't detach the model root."
114 , LERR_(INVALID_SCOPE));
115
116 QueryFocus currentFocus;
117 currentFocus.shift (Scope(placement).getParent());
118 contents_.clear (placement);
119 }
120 ENSURE (!contents_.contains (placement));
121 return is_known;
122 }
123
124
127 {
128 MObjectRef refRoot;
129 refRoot.activate (contents_.getRoot());
130 return refRoot;
131 }
132
133
134
135 PFixture&
137 {
138 return fixture_;
139 }
140
141
142 void
144 {
145 UNIMPLEMENTED ("rebuild Fixture");
146 }
147
148
149
150}}} // namespace steam::mobject::session
MObject is the interface class for all "Media Objects".
Definition mobject.hpp:72
The (current) Session holds all the user visible content to be edited and manipulated within the Lumi...
Definition session.hpp:102
PlacementMO & getRoot() const
retrieve the logical root scope
bool contains(PlacementMO const &) const
ID insert(PlacementMO const &newObj, ID targetScope)
Add a new Placement (Object "instance") into the index.
void clear(ID targetScope)
recursively kill a complete scope, including the given element and all children.
Current focus location to use as point-of reference for contents and location discovery queries.
QueryFocus & shift(Scope const &)
shift this QueryFocus to a container-like scope, causing it to navigate, changing the current ScopePa...
A Placement scope within the high-level-model.
Definition scope.hpp:70
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...
Lumiera error handling (C++ interface).
#define LERR_(_NAME_)
Definition error.hpp:45
Core abstraction of the Session model: a media object.
Core factory to generate media objects for use in the Session model.
LumieraError< LERR_(FATAL), Logic > Fatal
Definition error.hpp:208
LumieraError< LERR_(INVALID)> Invalid
Definition error.hpp:211
Namespace of Session and user visible high-level objects.
Definition sequence.hpp:65
MORef< MObject > MObjectRef
Steam-Layer implementation namespace root.
Core abstraction: placement of a media object into session context.
Representation of the current scope when navigating the session model.
Session and SessionServices Implementation classes.
Collection of implementation components, providing self-contained sub-elements exposed on the public ...