diff --git a/wiki/renderengine.html b/wiki/renderengine.html index 5a744b2cc..af4d8e0b2 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -1483,6 +1483,34 @@ Some further details As the builder and thus render engine //only consults the fixture,// while all editing operations finally propagate to the fixture as well, we get an isolation layer between the high level part of the Proc layer (editing, object manipulation) and the render engine. Creating the Fixture can be seen as a preprocessing step to simplify the build process. For this reason, the process of [[(re)building the fixture|PlanningBuildFixture]] has been designed together with the [[Builder]] +
The situation focussed by this concept is when an API needs to expose a sequence of results, values or objects, instead of just yielding a function result value. As the naive solution of passing an pointer or array creates coupling to internals, it was superseded by the ~GoF [[Iterator pattern|http://en.wikipedia.org/wiki/Iterator]]. Iteration can be implemented by convention, polymorphically or by generic programming; we use the latter approach.
+
+!Lumiera Forward Iterator concept
+''Definition'': An Iterator is a self-contained token value, representing the promise to pull a sequence of data
+* rather then deriving from an specific interface, anything behaving appropriately //is a Lumiera Forward Iterator.//
+* the client finds a typedef at a suitable, nearby location. Objects of this type can be created, copied and compared.
+* any Lumiera forward iterator can be in //exhausted// (invalid) state, which can be checked by {{{bool}}} conversion.
+* especially, default constructed iterators are fixed to that state. Non-exhausted iterators may only be obtained by API call.
+* the exhausted state is final and can't be reset, meaning that any iterator is a disposable one-way-off object.
+* when an iterator is //not// in the exhausted state, it may be //dereferenced// ({{{*i}}}), yielding the "current" value
+* moreover, iterators may be incremented ({{{++i}}}) until exhaustion.
+
+!!Discussion
+The Lumiera Forward Iterator concept is a blend of the STL iterators and iterator concepts found in Java, C#, Python and Ruby. The chosen syntax should look familiar to C++ programmers and indeed is compatible to STL containers and ranges. To the contrary, while a STL iterator can be thought off as being just a disguised pointer, the semantics of Lumiera Forward Iterators is deliberately reduced to a single, one-way-off forward iteration, they can't be reset, manipulated by any arithmetic, and the result of assigning to an dereferenced iterator is unspecified, as is the meaning of post-increment and stored copies in general. You //should not think of an iterator as denoting a position// — just a one-way off promise to yield data.
+
+Another notable difference to the STL iterators is the default ctor and the {{{bool}}} conversion. The latter allows using iterators painlessly within {{{for}}} and {{{while}}} loops; a default constructed iterator is equivalent to the STL container's {{{end()}}} value — indeed any //container-like// object exposing Lumiera Forward Iteration is encouraged to provide such an {{{end()}}}-function, additionally enabling iteration by {{{std::for_each}}} (or Lumiera's even more convenient {{{util::for_each()}}}).
+
+!!Implementation notes
+''iter-adapter.hpp'' provides some helper templates for building Lumiera Forward Iterators.
+* __~IterAdapter__ is the most flexible variant, intended for use by custom facilities. An ~IterAdapter maintains an internal back-link to a facilitiy exposing an iteration control API, which is accessed through free functions as extension point. This iteration control API is similar to C#, allowing to advance to the next result and to check the current iteration state.
+* __~RangeIter__ wraps two existing iterators — usually obtained from {{{begin()}}} and {{{end()}}} of an STL container embedded within the implementation. This allows for iterator chaining.
+* __~PtrDerefIter__ works similar, but can be used on an STL container holding //pointers,// to be dereferenced automatically on access
+
+Similar to the STL habits, Lumiera Forward Iterators should expose typedefs for {{{pointer}}}, {{{reference}}} and {{{value_type}}}.
+Additionally, they may be used for resource management purposes by "hiding" a ref-counting facility, e.g. allowing to keep a snapshot or restult set around until it can't be accessed anymore.
+
+This term has //two meanings, //so care has to be taken for not confusing them. # in general use, a Frame means one full image of a video clip, i.e an array of rows of pixels. For interlaced footage, one Frame contains two halfimages, commonly called Fields. (Cinelerra2 confuses this terms) @@ -1664,7 +1692,7 @@ Besides routing to a global pipe, wiring plugs can also connect to the source po Finally, this example shows an ''automation'' data set controlling some parameter of an effect contained in one of the global pipes. From the effect's POV, the automation is simply a ParamProvider, i.e a function yielding a scalar value over time. The automation data set may be implemented as a bézier curve, or by a mathematical function (e.g. sine or fractal pseudo random) or by some captured and interpolated data values. Interestingly, in this example the automation data set has been placed relatively to the meta clip (albeit on another track), thus it will follow and adjust when the latter is moved.
This wiki page is the entry point to detail notes covering some technical decisions, details and problems encountered in the course of the implementation of the Lumiera Renderengine, the Builder and the related parts. * [[Packages, Interfaces and Namespaces|InterfaceNamespaces]] @@ -1687,6 +1715,7 @@ Finally, this example shows an ''automation'' data set controlling some paramete * the relation of [[Project, Timelines and Sequences|TimelineSequences]] * how to [[start the GUI|GuiStart]] and how to [[communicate|GuiCommunication]] * build the first LayerSeparationInterfaces +* create an uniform pattern for [[passing and accessing object collections|ForwardIterator]] * decide on SessionInterface and create [[Session datastructure layout|SessionDataMem]] * shaping the GUI/~Proc-Interface, based on MObjectRef and the [[Command frontend|CommandHandling]] * defining PlacementScope in order to allow for [[discovering session contents|Query]]