Lumiera  0.pre.03
»edit your freedom«
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 
30 namespace steam {
31 namespace mobject {
32 namespace 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
73  SessionImpl::isValid ()
74  {
75  return true;
76  }
77 
78 
79 
86  MObjectRef
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 
125  MObjectRef
126  SessionImpl::getRoot()
127  {
128  MObjectRef refRoot;
129  refRoot.activate (contents_.getRoot());
130  return refRoot;
131  }
132 
133 
134 
135  PFixture&
136  SessionImpl::getFixture ()
137  {
138  return fixture_;
139  }
140 
141 
142  void
143  SessionImpl::rebuildFixture ()
144  {
145  UNIMPLEMENTED ("rebuild Fixture");
146  }
147 
148 
149 
150 }}} // namespace steam::mobject::session
Representation of the current scope when navigating the session model.
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
Definition: mobject-ref.hpp:85
Core abstraction: placement of a media object into session context.
Core abstraction of the Session model: a media object.
PlacementMO & getRoot() const
retrieve the logical root scope
Steam-Layer implementation namespace root.
QueryFocus & shift(Scope const &)
shift this QueryFocus to a container-like scope, causing it to navigate, changing the current ScopePa...
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:65
A Placement scope within the high-level-model.
Definition: scope.hpp:69
MObject is the interface class for all "Media Objects".
Definition: mobject.hpp:70
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:190
The (current) Session holds all the user visible content to be edited and manipulated within the Lumi...
Definition: session.hpp:100
Collection of implementation components, providing self-contained sub-elements exposed on the public ...
SessionImpl()
create a new empty session with default values.
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.
Lumiera error handling (C++ interface).
Core factory to generate media objects for use in the Session model.
Session and SessionServices Implementation classes.
MORef & activate(Placement< MO > const &placement)
activate an MObject reference, based on an existing placement, which needs to be contained (added to)...
virtual MObjectRef attach(PMO const &placement) override
attach a copy within the scope of the current QueryFocus point
virtual bool detach(PMO const &placement) override
detach the denoted object (placement) from model, together with any child objects contained in the sc...
Current focus location to use as point-of reference for contents and location discovery queries...