2008-11-05 05:03:03 +01:00
|
|
|
|
/*
|
2023-04-25 18:27:16 +02:00
|
|
|
|
Segmentation - Partitioning of a timeline for organising the render graph.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2023, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** is free software; you can redistribute it and/or modify it
|
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
|
option) any later version. See the file COPYING for further details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
* *****************************************************************/
|
2008-11-05 05:03:03 +01:00
|
|
|
|
|
2016-11-03 18:20:10 +01:00
|
|
|
|
|
2016-11-03 18:22:31 +01:00
|
|
|
|
/** @file segmentation.cpp
|
2023-05-03 05:01:45 +02:00
|
|
|
|
** Implementation details regarding the Segmentation of the Fixture.
|
|
|
|
|
|
**
|
|
|
|
|
|
** @todo 2023 WIP-WIP-WIP »Playback Vertical Slice«
|
2016-11-03 18:20:10 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2017-04-02 04:22:51 +02:00
|
|
|
|
#include "lib/error.hpp"
|
2023-04-25 18:27:16 +02:00
|
|
|
|
#include "steam/fixture/segmentation.hpp"
|
2023-05-02 21:24:26 +02:00
|
|
|
|
#include "lib/time/timevalue.hpp"
|
2023-05-03 05:01:45 +02:00
|
|
|
|
#include "lib/split-splice.hpp"
|
2008-11-05 05:03:03 +01:00
|
|
|
|
|
2023-05-05 03:46:42 +02:00
|
|
|
|
using lib::time::Time;
|
|
|
|
|
|
using lib::time::TimeSpan;
|
|
|
|
|
|
|
2008-11-05 05:03:03 +01:00
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
namespace steam {
|
2023-04-25 18:27:16 +02:00
|
|
|
|
namespace fixture {
|
2011-12-02 16:10:03 +01:00
|
|
|
|
|
2017-04-02 04:22:51 +02:00
|
|
|
|
namespace error = lumiera::error;
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-04-25 13:40:20 +02:00
|
|
|
|
Segmentation::~Segmentation() { } // emit VTable here...
|
|
|
|
|
|
|
2023-05-03 04:42:17 +02:00
|
|
|
|
|
2023-05-03 05:01:45 +02:00
|
|
|
|
namespace {// Implementation details...
|
2023-05-03 04:42:17 +02:00
|
|
|
|
|
2023-05-02 21:24:26 +02:00
|
|
|
|
|
2023-05-03 05:01:45 +02:00
|
|
|
|
}//(End) impl
|
|
|
|
|
|
|
2017-04-02 04:22:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
2023-05-02 04:16:39 +02:00
|
|
|
|
/**
|
|
|
|
|
|
* @param start (optional) definition of the new Segment's start point (inclusive)
|
|
|
|
|
|
* @param after (optional) definition of the end point (exclusive)
|
|
|
|
|
|
* @param jobTicket specification of provided render functionality for the new Segment
|
|
|
|
|
|
* @remarks missing definitions will be derived or interpolated according to context
|
|
|
|
|
|
* - if start point is omitted, the new Segment will start seamlessly after
|
|
|
|
|
|
* any preceding Segment's end, in case this preceding Segment ends earlier
|
|
|
|
|
|
* - otherwise the preceding Segment's start point will be used, thereby effectively
|
|
|
|
|
|
* replacing and expanding or trimming or inserting into the preceding Segment
|
|
|
|
|
|
* - similar for the end point: if the definition is omitted, the new Segment
|
|
|
|
|
|
* will cover the time range until the next Segmen's start
|
|
|
|
|
|
* - if upper/lower boundaries can not be established, the covered range will be
|
2023-07-28 02:21:59 +02:00
|
|
|
|
* expanded from Time::ANYTIME up to Time::NEVER, taking into account the current context
|
2023-05-02 04:16:39 +02:00
|
|
|
|
* - after start and end point have been established by the above rules, the actual
|
|
|
|
|
|
* splicing operation will be determined; either an existing Segment is replaced
|
|
|
|
|
|
* altogether, or it is trimmed to fit, or the new Segment is inserted, thereby
|
|
|
|
|
|
* creating a second (copied) part of the encompassing old Segment.
|
|
|
|
|
|
* - in case the JobTicket is omitted, the new Segment will be marked as _passive_
|
|
|
|
|
|
* and any job created from such a Segment will then be a »NOP-job«
|
2023-06-08 03:21:43 +02:00
|
|
|
|
* @see SplitSplice_test
|
2023-05-02 04:16:39 +02:00
|
|
|
|
*/
|
|
|
|
|
|
Segment const&
|
2023-06-10 04:52:40 +02:00
|
|
|
|
Segmentation::splitSplice (OptTime start, OptTime after, engine::ExitNodes&& modelLink)
|
2023-05-02 04:16:39 +02:00
|
|
|
|
{
|
2023-05-05 03:46:42 +02:00
|
|
|
|
ASSERT (!start or !after or start != after);
|
2023-05-03 04:42:17 +02:00
|
|
|
|
using Iter = typename list<Segment>::iterator;
|
|
|
|
|
|
|
2023-05-05 03:46:42 +02:00
|
|
|
|
auto getStart = [](Iter elm) -> Time { return elm->start(); };
|
|
|
|
|
|
auto getAfter = [](Iter elm) -> Time { return elm->after(); };
|
2023-06-10 04:52:40 +02:00
|
|
|
|
auto createSeg= [&](Iter pos, Time start, Time after) -> Iter { return segments_.emplace (pos, TimeSpan{start, after}, move(modelLink)); };
|
2023-05-05 03:46:42 +02:00
|
|
|
|
auto emptySeg = [&](Iter pos, Time start, Time after) -> Iter { return segments_.emplace (pos, TimeSpan{start, after}); };
|
|
|
|
|
|
auto cloneSeg = [&](Iter pos, Time start, Time after, Iter src) -> Iter { return segments_.emplace (pos, *src, TimeSpan{start, after}); };
|
|
|
|
|
|
auto discard = [&](Iter pos, Iter after) -> Iter { return segments_.erase (pos,after); };
|
2023-05-03 04:42:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
2023-05-03 05:01:45 +02:00
|
|
|
|
lib::splitsplice::Algo splicer{ getStart
|
|
|
|
|
|
, getAfter
|
|
|
|
|
|
, createSeg
|
|
|
|
|
|
, emptySeg
|
|
|
|
|
|
, cloneSeg
|
|
|
|
|
|
, discard
|
|
|
|
|
|
, Time::NEVER
|
|
|
|
|
|
, segments_.begin(),segments_.end()
|
|
|
|
|
|
, start,after
|
|
|
|
|
|
};
|
|
|
|
|
|
splicer.determineRelations();
|
|
|
|
|
|
auto [s,n,e] = splicer.performSplitSplice();
|
2023-05-03 03:32:49 +02:00
|
|
|
|
return *n;
|
2023-05-02 04:16:39 +02:00
|
|
|
|
}
|
2017-04-02 04:22:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-04-25 18:27:16 +02:00
|
|
|
|
}} // namespace steam::fixture
|