Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
locatingpin.cpp
Go to the documentation of this file.
1/*
2 LocatingPin - Chaining and constraining the Placement of a Media Object
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
29
30using std::unique_ptr;
31
32namespace steam {
33namespace mobject {
34namespace session {
35
36 inline LocatingPin*
37 cloneChain (const unique_ptr<LocatingPin>& chain)
38 {
39 if (!chain)
40 return 0;
41 else
42 return chain->clone();
43 }
44
45
50 : next_(cloneChain (other.next_))
51 { }
52
53
56 {
57 if (this != &other)
58 this->next_.reset (cloneChain (other.next_));
59 return *this;
60 }
61
62
65 {
66 return new LocatingPin(*this);
67 }
68
69
70
73 {
74 REQUIRE (newLp);
75 REQUIRE (!newLp->next_, "can insert only single LocatingPins");
76
77 if (next_ and newLp->getPrioLevel() > next_->getPrioLevel())
78 return next_->addChain (newLp);
79 else
80 {
81 unique_ptr<LocatingPin> tmp_next (newLp);
82 tmp_next->next_.swap(next_);
83 next_.swap(tmp_next);
84 return *newLp;
85 }
86 }
87
88
101 {
102 LocatingSolution solution;
103 resolve (solution);
104 return SolutionData (solution.getTime(), solution.getPipe());
105 }
106
107 bool
109 {
110 LocatingSolution solution;
111 resolve (solution);
112 return solution.is_impossible();
113 }
114
115
116
117 void
119 {
120 if (!solution.still_to_solve())
121 return;
122 this->intersect (solution);
123 if (next_ and solution.still_to_solve())
124 next_->resolve(solution);
125 }
126
127
128 void
130 {
131 REQUIRE (solution.still_to_solve());
132 // base class Implementation is NOP...
133 }
134
135
147
150 {
151 TODO ("implement Placement LocatingSolution");
152 return asset::Pipe::query ("pipe(master)"); // yet another idiotic dummy
153 }
154
155
156 bool
158 {
159 return (minTime == maxTime and minTrack == maxTrack);
160 }
161
162 bool
164 {
165 if (minTime > maxTime) impo = true;
166 TODO ("track???");
167 return impo;
168 }
169
170 bool
172 {
173 return not (is_definite() or is_impossible());
174 }
175
176
177
178
179
180
181
182
183 /* === Factory functions for adding LocatingPins === */
184
187 {
188 return static_cast<FixedLocation&>
189 (addChain (new FixedLocation (start, track)));
190 }
191
192
194 LocatingPin::operator() (PlaRef& refObj, Offset const& offset)
195 {
196 return static_cast<RelativeLocation&>
197 (addChain (new RelativeLocation (refObj, offset)));
198 }
199
200
201
202
203}}} // namespace steam::mobject::session
Offset measures a distance in time.
Lumiera's internal time value datatype.
static PPipe query(string const &properties)
convenience shortcut for retrieving default configured pipes
Definition pipe.cpp:57
The most common case of positioning a MObject in the Session: directly specifying a constant position...
Positioning specification, possibly chained to further specifications.
LocatingPin & operator=(const LocatingPin &)
virtual LocatingPin * clone() const
std::pair< Time, Pipe > SolutionData
FixedLocation & operator()(Time start, Fork track=0)
std::shared_ptr< asset::Pipe > Pipe
virtual void intersect(LocatingSolution &) const
virtual int getPrioLevel() const
order to consider when resolving.
const SolutionData resolve() const
implementing the core Placement functionality.
std::unique_ptr< LocatingPin > next_
next additional Pin, if any
LocatingPin & addChain(LocatingPin *)
Specialised LocatingPin for use in Placement, especially for globally fixed positions The FixedLocati...
Implementing the Placement mechanics.
Core abstraction of the Session model: a media object.
Namespace of Session and user visible high-level objects.
Definition sequence.hpp:65
LocatingPin * cloneChain(const unique_ptr< LocatingPin > &chain)
Steam-Layer implementation namespace root.
Core abstraction: placement of a media object into session context.
Time getTime()
get some time value which could stand in for this solution.