Commit graph

270 commits

Author SHA1 Message Date
0d5f29446b TreeMutator: provide no-op implementation
how to further your career with eight simple steps
2018-10-12 01:07:13 +02:00
fb93e349da TreeMutator: conjure up a black hole mutator
...which is a somewhat involved version of /dev/null
2018-10-11 23:56:33 +02:00
9894542bf9 Introduce predefined constants for magic IDs in UI communication
...these magical strings are already spreading dangerously throughout the code base


PS: also fixup for c6b8811af0  (broken whitespace in test definition)
2018-10-08 05:00:06 +02:00
5a7a5a5720 DOC: fix syntax of some doxygen links
seemingly we really need the \ref in the link target expression
2018-09-21 14:33:12 +02:00
89d93a13e4 Modernise Unknown Exception handler and Exception messages 2018-04-02 01:48:51 +02:00
685a9b84ee Library: replace boost::noncopyable by our own library solution
Benefits
 - get rid of yet another pervasive Boost dependency
 - define additional more fine grained policies (move only, clonable)
2018-03-24 05:35:13 +01:00
52edf7d930 Refactoring: switch IterStateWrapper to member function based API
Considering the fact that we are bound to introduce yet another iteration control function,
because there is literally no other way to cause a refresh within the IterTreeExplorer-Layers,
it is indicated to reconsider the way how IterStateWrapper attaches to the
iteration control API.

As it turns out, we'll never need an ADL-free function here;
and it seems fully adequate to require all "state core" objects to expose
the API as argument less member function. Because these reflect precisely
the contract of a "state core", so why not have them as member functions.
And as a nice extra, the implementation becomes way more concise in
all the cases refactored with this changeset!

Yet still, we stick to the basic design, *not* relying on virtual functions.
So this is a typical example of a Type Class (or "Concept" in C++ terminology)
2017-12-05 03:28:00 +01:00
b5453cc429 TreeExplorer: reimplementation with simpler design
- always layer the TreeExplorer (builder) on top of the stack
- always intersperse an IterableDecorator in between adjacent layers
- consequently...
  * each layer implementation is now a "state core"
  * and the source is now always a Lumiera Iterator

This greatly simplifies all the type rebindings and avoids the
ambiguities in argument converison. Basically now we can always convert
down, and we just need to pick the result type of the bound functor.

Downside is we have now always an adaptation wrapper in between,
but we can assume the compiler is able to optimise such inline
accessors away without overhead.
2017-12-04 04:34:26 +01:00
16abe82cde LocationQuery: fix a segfault due to ill guided conversion path 2017-10-27 05:12:28 +02:00
1406aa5532 Library: allow Initialisiation of a GenNode from a Rec::Mutator
up to now, we allowed only initialisation with a precisely matching type.
But this special case seems worth supporting, since it typically occurs
within the "object builder" syntax based on Rec::Mutator
2017-10-24 03:51:06 +02:00
198dcc622a Bugfix Library: forward initialiser properly into GenNode
...to avoid unnecessary copy.
Especially relevant for initialising a sub-Record from the object builder syntay "MakeRec()"
2017-10-24 02:44:47 +02:00
5dfd135595 Library: remove redundant checks from IterAdapter implementation
Explicitly assuming that those functions are called solely from IterAdapter
and that they are implemented in a typical standard style, we're able to elide
two redundant calls to the checkPoint() function. Since checkPoint typically performs
some non-trivial checks, this has the potential of a significant performance improvement

- we check (and throw ITER_EXHAUST) anyway from operator++, so we know that pos is valid
- the iterate() function ensures checkPoint is invoked right after iterNext,
  and thus the typical standard implementation of iterNext need not do the same
2017-10-01 03:25:33 +02:00
937ad64596 DiffMessage: now uniformly plays the role of MutationMessage (closes #1066) 2017-08-13 07:25:32 +02:00
82a12115c3 DiffMessage: complete documentation 2017-08-13 07:25:32 +02:00
b45ffe5cbe DiffMessage: fix insidious initialisation bug (related to #963)
basically DiffMessage has a "take everything" ctor, which happens
to match on type DiffMessage itslef, since the latter is obviously
a Lumiera Forward Operator. Unfortunately the compiler now considers
this "take everyting" ctor as copy constructor. Worse even, such a
template generated ctor qualifies as "best match".

The result was, when just returing a DiffMessage by value form a
function, this erroneous "copy" operation was invoked, thus wrapping
the existing implementation into a WrappedLumieraIterator.

The only tangible symptom of this unwanted storage bloat was the fact
that our already materialised diagnostics where seemingly "gone". Indee
they weren't gone for real, just covered up under yet another layer of
DiffMessage wrapping another Lumiera Forward Iterator
2017-08-12 18:16:06 +02:00
06ff5c4e71 DiffMessage: complete test of diagnostic output 2017-08-12 14:33:26 +02:00
efc27fd07b DiffMessage: draft content diagnostics wrapper 2017-08-12 05:55:31 +02:00
d4ac2d78e2 C++11: improve moving and forwarding of iterators
this becomes more relevant now, since the actual MutationMessage iterators
are implemented in terms of a shared_ptr to IterSource. Thus, when building
processing pipelines, we most definitively want to move that smart-ptr into
the destination, since this avoids touching the shared count and thus avoids
generating unnecessary memory barriers.
2017-08-12 03:01:35 +02:00
4a2384e242 DiffMessage: add further convenience ctor for varargs
hey... all my dream constructors became true
2017-08-12 03:00:38 +02:00
380fa5bb38 DiffMessage: add further convenience ctors for STL containers 2017-08-11 22:23:51 +02:00
7dc0fdd67a DiffMessage: implement convenience ctor to build from Lumiera Iterator 2017-08-11 21:27:51 +02:00
f6baef16c5 DiffMessage: consider to unite the handling of mutation messages (#1066) 2017-08-11 15:23:33 +02:00
fdcf431a9b DiffMesage: use as payload within MutationMessage and pass Diff by RValue
now this highlights the unsettled decision still the more,
as can be seen by all that unnecessary copying. Basically we move the
Diff into the lambda-closure, from there into an anonymous instance,
from there into the embedded Buffer in MutationMessage, which again
just happens to sit in the closure storage when the action is invoked.
And all of this copying just to move the DiffMessage for consumption
into the TreeMutator...

thus by #1066 we should really get rid of the MutationMessage class altogether!
2017-08-11 02:00:54 +02:00
fd0a011ea4 DiffMessage: bold attempt towards a way to produce diffs (#1066)
actually I do not know much regarding the actual situation when,
within the Builder run, we're able to detect a change and generate
a diff description. However, as a first step, I'll pick IterSrouce
as a base interface and use a "generation context", which is to be
passed by shared-ptr
2017-08-11 00:59:10 +02:00
9c21164ae6 Doxygen Fixes (#1062)
This changeset fixes a huge pile of problems, as indicated in the
error log of the Doxygen run after merging all the recent Doxygen improvements

unfortunately, auto-linking does still not work at various places.
There is no clear indication what might be the problem.
Possibly the rather unstable Sqlite support in this Doxygen version
is the cause. Anyway, needs to be investigated further.
2017-04-02 04:22:51 +02:00
efad48c831 Function-Tools: new improved function signature trait including lambda support (#994)
move the reworked solution in place,
replacing the existing workarounds, partial solutions and variations
2017-03-19 02:07:18 +01:00
ffd2b079df GuiNotification: use placeholder for the yet unsolved diff passing problem
see Ticket #1066
2017-01-20 03:46:48 +01:00
0d5ca55019 GuiNotification: define outline of this service interface 2017-01-20 03:27:32 +01:00
4975712b5e copy-n-paste-programming to define SessionCommand interface / service
...the sheer amount of mechanical replacements scattered all over these
files might be a vivid indication, that the design of the interface system
is subobptimal ;-)
2016-12-12 03:09:08 +01:00
803a71cc31 define the diff bindings for the TrackPresenter
Phew, convoluted.
And I was doubtful that we need to support multiple typed child collection
Well, we get three such collections already in the first real world example...
2016-12-04 00:03:24 +01:00
22f06dca23 Bugfix: must init TreeMutator explicitly now
as consequence of previous fix.
Also, when building the preconfigured TreeMutator for GenNode,
the init hook must be called explicitly now.
2016-10-04 03:24:44 +02:00
1725a31df1 Bugfix: insidious dangling pointer caused by move after construction
Damn sideeffect of the suppport for move-only types: since we're
moving our binding now into place /after/ construction, in some cases
the end() iterator (embedded in RangeIter) becomes invalid. Indeed this
was always broken, but didn't hurt, as long as we only used vectors.

Solution: use a dedicated init() hook, which needs to be invoked
*after* the TreeMutator has been constructed and moved into the final
location in the stack buffer.
2016-10-03 23:54:09 +02:00
bada8ecffd TreeMutator binding: fix collection binding to support move-only types
unintentionally we used copy construction in the builder expression,
wenn passing in the CollectionBinding to the ChildCollectionMutator.

The problem is that CollectionBinding owns a shaddow buffer, where
the contents of the target collection are moved temporarily while
applying the diff. The standard implementation of copy construction
would cause a copy of that shaddow buffer, which boils down to
a copy of the storage of the target collection.

If we want to support move-only types in the collection, most notably
std::unique_ptr, we can thus only use the move constructor. Beyond that
there is no problem, since we're only ever moving elements, and new
elements will be move constructed via emplace() or emplace_back()
2016-10-03 20:08:54 +02:00
d58f8c853a TreeMutator binding: extend collection binding to support std::map
actually this is a pragmatic extension for some special use cases,
and in general rather discurraged, since it contradicts the
established diff semantics. Yet with some precaution, it should
be possible to transport information via an intermediary ETD

Map -> ETD -> Map
2016-10-03 19:31:59 +02:00
15ac0d6310 clean-up: remove one leftover of Ref::THIS (#996)
for the record: while it is indeed sweet-and-simple to support Ref::THIS
here, it is near impossible to represent it in general, in a setup with
multiple "onion-layers". The reason is, we'd have to incorporate such
special treatment into the /selector predicate/, which in turn undermines
the ability to pick the right onion layer to handle a given diff verb,
since "Ref::THIS" is a generic marker and we have no other data to base
the decision in the selector on.
2016-10-03 17:33:30 +02:00
b251b9a022 MutationMessage: generic implementation based on the DiffMutable interface 2016-10-02 23:34:07 +02:00
d87111f703 DOC: MutationMessage 2016-10-01 22:36:52 +02:00
2a26cef010 remove leftovers of first diff-applicator implementation
...obsoleted by new generic implementation
2016-09-08 18:30:27 +02:00
4267d3d1d7 application via TreeMutator is now the default
remove the intermediary header
2016-09-05 04:36:07 +02:00
a066650eb7 remove the now obsolete, dedicated first diff implementation
yay! this piece of code has served its purpose:
it was the blueprint to build a way better design and implementation,
which can now cover this "generic tree" case as a special case as well
2016-09-05 04:05:31 +02:00
840d9e4397 make Rec::Mutator as such diff mutable
this adds kind of an extension point to diff::Record<GenNode>::Mutator,
which is then actually defined (implemented) within the diff framework.

This allows the TreeDiffTraits automatically to use this function
to get a TreeMutator for a given Rec::Mutator. Which in turn allows
the generic version of DiffApplicator automatically to attach and
bind to a Record<GenNode>

together this allows us to ditch the explicit specialisation
and dedicated, hand-written implementation of DiffApplication
to GenNode in favour of using the TreeMutator and friends.
2016-09-05 02:25:07 +02:00
ebb3ccb589 clean-up: move PlantingHandle over to the OpaqueHolder facility
...where it belongs; it is entirely generic
and we'd expect more usage on APIs for callbacks
2016-09-04 23:21:15 +02:00
5c0baba2eb finish implementation of GenNode - TreeMutator binding
some minor code clean-up and comments;
the solution dafted yesterday is the way to go.
2016-09-04 20:55:21 +02:00
17f8922775 solution (draft) for the type field problem
unit test PASS

but the resulting code is hard to understand
should refactor it to use a binding class
similar to the other binding cases
2016-09-03 22:34:36 +02:00
a73e5ffffe TreeMutator binding: change handling of AFTER(Ref::ATTRIBS)
this is a subtle change in the semantics of the diff language,
actually IMHO a change towards the better. It was prompted by the
desire to integrate diff application onto GenNode-trees into the
implementation framework based on TreeMutator, and do away with
the dedicated implementation.

Now it is a matter of the *selector* to decide if a given layer
is responsible for "attributes". If so, then *all* elements within
this layer count as "attribute" and an after(Ref::ATTRIBS) verb
will fast forward behind *the end of this layer*

Note that the meta token Ref::ATTRIBS is a named GenNode,
and thus trivially responds to isNamed() == true
2016-09-02 18:40:16 +02:00
05768e4ac5 first part of unit-test for GenNode TreeMutator-binding PASS
needed to use a forward function declaration within the
lambda for recursive scope mutator building, since otherwise
everything is inline and thus the compilation fails when it
comes to deducing the auto return type of the builder.

Other than that, the whole mechanics seem to work out of the box!
2016-09-02 03:10:27 +02:00
e00d6c2a4c reorganise inclusion of TreeMutator-DSL builders
previously they where included in the middle of tree-mutator.hpp
This was straight forward, since the builder relies on the classes
defined in the detail headers.

However, the GenNode-binding needs to use a specifically configured
collection binding, and this in turn requires writing a recursive
lambda to deal with nested scopes. This gets us into trouble with
circular definition dependencies.

As a workaround we now only *declare* the DSL builder functions
in the tree-mutator-builder object, and additionally use auto on
all return types. This allows us to spell out the complete builder
definition, without mentioning any of the implementation classes.
Obviously, the detail headers have then to be included *after*
the builder definition, at bottom of tree-mutator.hpp
This also allows us to turn these implementation headers into
completely normal headers, with namespaces and transitive #includes

In the end, the whole setup looks much more "innocent" now.

But beware: the #include of the implementation headers at bottom
of tree-mutator.hpp needs to be given in reverse dependency order,
due to the circular inclusion (back to tree-mutator.hpp) in
conjunction with the inclusion guards!
2016-09-02 01:29:32 +02:00
f907ff05d6 WIP: define binding behaviour for diff->GenNode
...need still to solve a problem with circular definition dependencies
2016-09-01 22:58:08 +02:00
c791763890 implement builder setup for Rec<GenNode>
this compiles just fine.
But we still need to define the concrete closures
to make it work with the actual contents of GenNode
2016-08-31 18:40:09 +02:00
a01435f367 WIP: outline of a new GenNode binding
...instead of using a hand written implementation,
the idea is to rely on the now implemented building blocks,
with just some custom closures to make it work.
2016-08-31 17:09:32 +02:00