Commit graph

1601 commits

Author SHA1 Message Date
7d448be97a Rectify TypedCounter_test fixture -- Type-IDs are not stable
Hehe...
with GenNode, we started to use these global Type-IDs to generate
unique Names for unnamed Children in a diff::Record. This means,
when running in the test-suite, the TypeID for 'short' and 'long' are
likely to be allready allocated, so our Test can not not observe the
allocateion, nor is it sensible to assume fixed numbers for these Type-IDs.
Instead, we create two local types right within the test function, to force
generation of new unique type-IDs, which we can observe
2015-11-02 00:03:29 +01:00
d7f87c9b72 GenNodeBasic_test : do not match on random IDs
otherwise the test will fail when run within the suite....
Lovely spam!
2015-11-01 23:26:26 +01:00
34d79ee8df tree-diff-application: unit test PASS
well... this was quite a piece of work
Added some documentation, but a complete documentation,
preferably to the website, would be desirable, as would
be a more complete test covering the negative corner cases
2015-11-01 07:03:47 +01:00
289bc7114c implement mutation of the current element (_THIS_)
while implementing this, I've discovered a conceptual error:
we allow to accept attributes, even when we've already entered
the child scope. This means that we can not predictable get back
at the "last" (i.e. the currently touched) element, because this
might be such an attribute. So a really correct implementation
would have to memorise the "current" element, which is really
tricky, given the various ways of touching elements in our
diff language.

In the end I've decided to ignore this problem (maybe a better
solution would have been to disallow those "late" attributes?)
My reasoning is that attributes are unlikely to be full records,
rather just values, and values are never mutated. (but note
that it is definitively possible to have an record as attribute!)
2015-11-01 03:29:35 +01:00
daa13ab6dc implement anonymous pick or delete of children
...while I must admit that I'm a bit doubtful about that
language feature, but it does come in handy when manually
writing diff messages. The reason is the automatic naming
of child objects, which makes it often hard to refer to
a child after the fact, since the name can not be
reconstructed systematically.

Obviously the downside of this "anonymous pick / delete"
is that we allow to pick (accept) or even delete just
any child, which happens to sit there, without being
able to detect a synchronisation mismatch between
sender and receiver.
2015-11-01 02:33:35 +01:00
1aac072224 additional test coverage to document "shallow match" 2015-10-31 03:12:49 +01:00
614e1f81e5 Generic Record: implement equivalence of Record and RecRef in comparison
...that is, we have "magic" in the access functions, which allows
a RecRef to "stand-in" for the Record it points to
2015-10-30 22:02:09 +01:00
2882d78755 implementation: simplest case (insert element)
...so now the stage is set. We can reimplement
the handling of the list diff cases here in the context
of tree diff application. The additional twist of course
being the distinction between attribute and child scope
2015-10-24 03:15:35 +02:00
2b619d6622 implement RecordContentMutator - unit test pass 2015-10-24 01:49:07 +02:00
5cbdcc0f22 stub ContentMutator implementation 2015-10-23 20:55:02 +02:00
2cad7a3692 WIP: draft expected behaviour of content manipulation helper class 2015-10-23 20:11:43 +02:00
e438a9fe51 chosing an implementation approach for tree-diff-application 2015-10-23 19:24:34 +02:00
c90e6a6f65 on second thought: yet a better solution
...is to let the diff applicator work *on* a Rec::Mutator
This is outright natural -- why is it that I needed 2 days
to come up with this solution?
2015-10-23 01:32:47 +02:00
18320224a7 add code to check for the changed content
...as is to be expected after applying the two demo diffs
2015-10-10 03:05:30 +02:00
4fb37c8172 reorganise generation of the diff sequences for test
...just inherit from TreeDiffLanguage -- gives us the
diff step ctors for free.
2015-10-10 01:29:58 +02:00
90f31df8c0 stub the diff verb operations.
passes compilation again
2015-10-09 03:44:38 +02:00
2704b38da6 WIP rework demonstration diff to be valid type-wise
so basically it's time to explicate the way
our diff language will actually be written.

Similar to the list diff case, it's a linear sequence
of verb tokens, but in this case, the payload value
in each token is a GenNode. This is the very reason
why GenNode was conceived as value object with an
opaque DataCap payload
2015-10-09 03:03:27 +02:00
f43fb2167f WIP demonstration draft continued... 2015-10-02 19:41:14 +02:00
eaba418d15 WIP start definition with a basic tree diff example... 2015-10-02 18:47:44 +02:00
6b32d1f37d fix inconsistency in conception of HierarchyOrientationIndicator
while it's still not really clear how we'll use this helper
and if we need it at all -- some weeks ago I changed its
semantics to be strictly based on the delta to a reference level.

Now this means, we could go below level zero, but this doesn't
make any sense in the context of navigating a tree. Actually,
our test case triggered this situation, which caused the
reference level to wrap around, since it is stored in an
unsigned variable.

Thus I'll add a precondition to keep the level positive,
and I'll change the test to comply.
2015-09-25 03:57:29 +02:00
a07eb58cef GenNodeBasic_test PASS (finally) 2015-09-25 03:12:04 +02:00
08e7e3df15 prefer more readable bool operator spelling
especially the '!' for negation is sometimes too terse
and easily overlooked.
2015-09-25 03:12:04 +02:00
7b7d12d99e add internal / diagnostic display for low-level time values and time spans
Initially I've deliberately omitted those, to nudge towards
using time quantisation and TCode formatting for any external
representation of time values.

While this recommendation is still valid, the overloaded
string conversion turns out to be helpful for unit testing
and diagnostics in compound data structures.
See Record<GenNode>
2015-09-25 03:12:04 +02:00
6da0785d0a decision how to support tree exploration/reconstruction
initially the intention was to include a "bracketing construct"
into the values returned by the iterator. After considering
the various implementation and representation approaches,
it seems more appropriate just to expose a measure for the
depth-in-tree through the iterator itself, leaving any concerns
about navigation and structure reconstruction to the usage site.

As rationale we consider the full tree reconstruction as a very
specialised use case, and as such the normal "just iteration" usage
should not pay for this in terms of iterator size and implementation
complexity. Once a "level" measure is exposed, the usage site
can do precisely the same, with the help of the
HierarchyOrientationIndicator.
2015-09-24 20:59:04 +02:00
8e8a67e6df test fixes up to (not including) the iteration scope bracketing
...since for the latter I'll actually chose quite another
approach, based on the HierarchyOrientationIndicator
2015-09-17 19:39:34 +02:00
7f2e328ab3 generalise containment check to anything that matches the GenNode
Whooa!
Templates are powerful.
programming this way is really fun.

under the assumption that the parts are logical,
all conceivable combinations of theses parts are bound to be correct
2015-09-11 20:25:39 +02:00
3576b30cd2 formally complete implementation of GenNode iteration
it passes compilation, but the test still fails, since
I've changed the expected semantics of the iteration,
in the light of the insights I've gained during
re-investigation of the IterExplorer.

What I now actually intend is rather to embed a
HierarchyOrientationIndicator into the iterator,
instead of returning a special "bracket" marker
reference to indicate return from a nested scope.
2015-09-11 20:00:36 +02:00
25459028cc extend and adjust semantics of the HierarchyOrientationIndicator
This helper was drafted for the Job / JobPlanning and Scheduler
interface in 2013, but seemingly not yet put into action. While
in the original use case, we have a genuine measuerment for the
tree depth (given by the depth of the processing stack), in other
use cases we want to use to offset embedded within the indicator
itself for keeping track of the depth. Thus I add a second
mark operation, which usess the current offset to set a new
reference level. This has the consequence that the offset
has now to reflect the new reference point immediately
2015-09-04 22:15:44 +02:00
be70e58441 considering how to implement the GenNode sequence iteration
remembered that some years ago I had to deal with a very similar problem
for planning the frame rendering jobs. It turned out, that the
iterator monad developed for this looks promising for our task at hand
2015-08-31 03:34:23 +02:00
2ba7978ce7 draft behaviour of the GenNode sequence iteration
this design is rather into the blue,
not sure what we actually need for diff generation
and object serialisation. Anyhow, I considered including
a bracketing construct a good idea, and I considered it
sensible to expose inner nodes, not only the leaf nodes.

Obviously, this is not a real monad iteration then.
2015-08-30 17:47:20 +02:00
a56ca7308f implement the data matching predicate on GenNode
TODO: need built-in special treatment for RecRef
2015-08-30 04:44:20 +02:00
efe97b9174 util: epsilon comparison for doubles
add the usual standard implementation to compare floating point numbers
based on the machine epsilon and the magnitude of the involved numbers
2015-08-30 04:14:28 +02:00
25f78bfa83 draft a more premissive matching predicate
the intention is to combine this with content iteration
to build containment check and find operations
2015-08-30 00:00:41 +02:00
b0368a6d2b full unit test coverage of equality
horay!
seems like madness?
well -- found and squashed a bug: equality on RecordRef
implicitly converted to GenNode(RecordRef), which always
generates new (distinct) IDs and so never succeeds. What
we really want is equality test on the references
2015-08-29 21:27:33 +02:00
11ca89a2fd cover usage of predicate in unit test 2015-08-29 19:07:51 +02:00
a05c9f81a6 Segfault: one move to much
the temporary was destroyed before moving it out.
2015-08-29 01:46:24 +02:00
bb92b49340 GenNode diagnostics -- debugging 2015-08-28 23:09:10 +02:00
96791d4a45 fix omission in generic ID functions and add unit test
while in debugging, it turned out that the short type-prefix
was implemented in a too simplistic way; it fails on stuff
like 'lib::diff::Record<lib::diff::GenNode>'


while I must add, that the whole purpose of these ID functions
is somewhat unclear and needs to reveal itself as we move forward
2015-08-28 17:18:52 +02:00
cc989d171f investigate hash collisions on 32bit platform
...while on the train back from FrOSCon.
still the same old problem: we need a better hash function
for generating our Entry-IDs. The default hash function from Boost performs
poor on strings with common prefix and trailing number.

We use a hackish workaround, which is sufficient to avoid collisions
among the first 10000 numbers.
2015-08-27 23:48:39 +02:00
da43d7f00f follow-up to the bugfix: just plain int is yet more readable
basically the 32/64bit problem was caused by things like 23L, which creates a long.
Unfortunately on 64bit platforms, this is aliased to int64_t,
while on 32bit i386, it is a distinct data type, but just 32bit,
like int.

The code in question here is just test / demonstration code
and actually just needs "some integer number". So let's stick
to good old boring int then.
2015-08-27 23:46:12 +02:00
4b2f7ef3ad fix a 32/64 bug
the obnoxious problem with long, which is
only 32bit on 32bit platforms.

incidentally, sitting here at FrOSCon 15
in the Lumiera developers room
2015-08-22 22:20:58 +02:00
a56226f297 Record "object" representation now finished and passes Test 2015-08-17 22:13:36 +02:00
0bff4f21d5 Record References: fix copy and assignment handling
not entirely sure about the design, but lets try this approach:
they can be "cloned" and likewise move-assigned, but we do not
allow the regular assignment, because this would enable to use
references like pointers (what we deliberately do not want)
2015-08-17 20:56:40 +02:00
7650b36f1e Generic Record: finish implementation of Mutator
especially setting (changing) attributes turned out to be tricky,
since in case of a GenNode this would mean to re-bind the hash ID;
we can not possibly do that properly without knowing the type of the payload,
and by design this payload type is opaque (erased).

As resort, I changed the semantics of the assign operation:
now it rather builds a new payload element, with a given initialiser.
In case of the strings, this ends up being the same operation,
while in case of GenNode, this is now something entirely different:
we can now build a new GenNode "in place" of the old one, and both
will have the same symbolic ID (attribute key). Incidentally,
our Variant implementation will reject such a re-building operatinon
when this means to change the (opaque) payload type.

in addition, I created a new API function on the Mutator,
allowing to move-in a complete attribute object. Actually this
new function became the working implementation. This way, it is
still possible to emplace a new attribute efficiently (consider
this to be a whole object graph!). But only, if the key (ID)
embedded in the attribute object is already what is the intended
key for this attribute. This way, we elegantly circumvent the
problem of having to re-bind a hash ID without knowing the type seed
2015-08-17 20:31:07 +02:00
46bfc0638f Generic Record: settle type handling
initially, the intention was to inject the type as a magic attribute.
But this turned out to make the implementation brittle, asymmetric
and either quite demanding, or inefficient.

The only sane approach would be to introduce a third collection,
the metadata attributes. Then it would be possible to handle these
automatically, but expose them through the iterator.

In the end I decided against it, just the type attribute
allone does not justify that effort. So now the type is an
special magic field and kept apart from any object data.
2015-08-17 06:34:51 +02:00
0cde55a67f Generic Record: finish basic implementation 2015-08-17 03:59:53 +02:00
24d7f55935 Merge Platform upgrade and Diff-Framework development 2015-08-16 01:42:26 +02:00
9ff79b86cf fix warnings found by CLang (3.5)
Note: not fixing all relevant warnings.

Especially, the "-Woverloaded-virtual" of Clang defeats the whole purpose
of generated generic interfaces. For example, our Variant type is instantiated
with a list of types the variant can hold. Through metaprogramming, this
instantiation generates also an embedded Visitor interface, which has
virtual 'handle(TY)' functions for all the types in question

The client now may implement, or even partially implement this Visitor,
to retrieve specific data out of given Variant instance with unknown conent.
To complain that some other virtual overload is now shaddowed is besides the point,
so we might consider to disable this warning altogether
2015-08-16 01:37:04 +02:00
bfb7bbd2f5 implement Record: operator string() for diagnostics 2015-08-16 01:35:30 +02:00
7f51a01631 clean-up some library and linkage problems
the object VTable is typically emitted when the compiler
encounters the first non-static non-inline function of
the class or a derived class.

Sometimes this happens within the wrong library and so
the compiler needs a nudge to emit those infrastructure functions.
But in most cases this works out of the box and need no further
magic incanctations, which might have a downside.
Especially because also a non-inline dtor does incur a call overhead,
whereas an inline dtor can be trivially elided.
2015-08-16 01:35:30 +02:00