Commit graph

4446 commits

Author SHA1 Message Date
18b6a388a0 implement state reset handlers / mock handlers 2016-02-14 03:42:10 +01:00
afeedfc288 draft state reset behaviour (test)
indeed building on the new broadcast functionality now.
Probably this implies we'll get some broadcast-with-filter eventually
2016-02-14 02:42:14 +01:00
44bb044eee message broadcast implementation unit test PASS
...was indeed dead easy to implement
2016-02-14 02:20:51 +01:00
b5b62f101f WIP: draft a message broadcasting function
not really sure about its usefullness, but it seems
low hanging fruit for me right now (while I am still
aware of all details how the UI-Bus works).

This might possibly be helpful to broadcast "reset" messages....
2016-02-14 01:47:21 +01:00
1b9e4a7310 test to cover call sequence of message dispatch in UI-Bus 2016-02-14 01:34:58 +01:00
8dac2a541a change the semantics of EventLog "clearing"
use the smart-ptr semantics to just detach from the log.
This allows other entities still to hold onto a joined log
2016-02-14 00:56:52 +01:00
cbd69ea4fb cover additional message/error diagnostics in MockElm
NOTE: we don't have any "real" UI-Element implementation yet.
Such would have to define its own, private error and message handling.
It is likely that we'll end up with some kind of base implementation
within model::Element and model::Controller.

Anyhow, this is future work
2016-02-14 00:23:24 +01:00
1059458e11 MockElm: add the ability to store/query received errors and messages
this is just a draft and in expectation of what we'll likely
add to the real model::Element and model::Controller entities
2016-02-14 00:16:10 +01:00
0be12aaa79 PresentationStateManager unit test PASS
basic state capturing, storage and replay now works as intended
More elaborate state management will be implemented later,
when we know more about perspectives and work sites!
2016-02-13 23:53:09 +01:00
4da75dd4d3 bus protocol change: special handling for reset state marks
- suppres sending redundant stat mark messages from MockElm
- emit a "reset" state mark when an actual reset happens
- let the PresentationStateManager discard recorded special state
  when receiving a "reset" mark for a given element
2016-02-13 23:48:34 +01:00
d57af50ad6 state manager storage implemented and covered by unit test
sigh.
If you want to feel slick and cool,
never dare to write any unit test....
2016-02-13 22:55:59 +01:00
f80982b52b gen-node: fix insidious data conssitency problem
I assumed that, since GenNode is composed of copyable and
assignable types, the standard implementation will do.
But I overlooked the run time type check on the opaque
payload type within lib::Variant. When a type mismatch
is detected, the default implementation has already
assigned and thus altered the IDs.

So we need to roll our own implementation, and to add
insult to injury, we can't use the copy-and-swap idiom either.
2016-02-13 22:55:59 +01:00
121cd41408 ouch: GCC-4.9 doesn't yet support the C++14 transparent comparators
This is actually a STL library feature, and was added precisely
for the reason encountered here: if we want logarithmic search,
we'll have to construct a new GenNode object, just to have something
for the set to invoke the comparison operator.

C++14 introduced the convention that the Comparator of the set
may define a marker type `is_transparent` alongside with a generic
comparison operator. But, as is obvious from the source code of
our GNU Standard library implementation, our std::set has no such
overload to make use of that feature

http://en.cppreference.com/w/cpp/container/set/find
http://stackoverflow.com/questions/20317413/what-are-transparent-comparators

The only good thing is that, just 10 minutes ago, I felt like
a complete moron because I'm writing a unit test for such a simple
storage class. ;-)
2016-02-13 22:55:59 +01:00
94fc160525 implementation of storage for state manager 2016-02-13 22:55:59 +01:00
94576af4df finialise simple state manager implementation
...and rearrange storage interface to suit
2016-02-13 22:55:59 +01:00
92d9a7323f implement state manager through stubbed storage functions
...push down the frontier by one level
2016-02-13 22:55:58 +01:00
071f49027f change presentation state manager API
...based on elementIDs rather, to avoid any
tangling and trickery with reconstructing IDs
2016-02-13 22:55:58 +01:00
c54dfd6a94 factor out generic map based state manager implementation 2016-02-13 22:55:58 +01:00
15c1343fae class name rochade
it occured to me that my "mock implementation" actually
is entirely generic, so it could as well be "the" implementation
2016-02-13 22:55:58 +01:00
49a42b4d50 add outline of corresponding storage implementation 2016-02-13 22:55:58 +01:00
ef04ebfb17 add skeleton of a mock implementation within test::Nexus 2016-02-13 22:55:58 +01:00
f58b2af228 stub new parts 2016-02-13 22:55:58 +01:00
1e5c1059d3 WIP: draft basics of state manager interface 2016-02-13 22:55:58 +01:00
358fd84c71 write down the understanding about presentation state gained thus far 2016-02-13 22:55:58 +01:00
26d0f50e47 state mark handling within the base element: unit test PASS
...and I made the decision *not* to consider any kind of
generic properties for now. YAGNI.

UI coding is notorious spaghetti code.
No point in fighting that, it is just the way it is,
because somewhere you're bound to get concrete, hands-on.
2016-02-13 22:55:58 +01:00
e4a57e27d2 complete the sending of state mark notifications
...everything working out of the box thus far,
which is remarkable, since I didn't write a single
line of implementation code beyond what's available
as basic bus functionality. So this one just
fell into place
2016-02-13 22:55:58 +01:00
35a0e8e5b4 draft first part of the test regarding state-marks 2016-02-13 22:55:58 +01:00
622364a904 message dispatching unit test PASS
...just had to fix the definition of the verifyMark test helper
function to better suit its purpose
2016-02-13 22:55:57 +01:00
e9a649ff63 draft test for mesage dispatch to UI-Elements
seems to work already, just there is some mismatch
in the test verification code
2016-02-13 22:55:57 +01:00
0964e56c49 better use a named magic constant
right now, what we actually need here is just some integer,
so the GenNode payload is typed to int (or just to anything
different than a Record, because the Record signals that
we intend to bind, not to invoke the command)
2016-02-13 22:55:57 +01:00
fea6628b3c WIP some notes what could be addressed next 2016-02-13 22:55:57 +01:00
44785859ea convenience shortcut to simplify command invocation via Bus 2016-02-13 22:55:57 +01:00
41c8c948e3 explicit size check to generate a meaningful error message
the values.child() call would also do a bounds check,
but only to rise a error::Invalid "index out of bounds".
So now we generate a clear message to indicate that
actually a runtime-checked type mismatch caused this problem
2016-02-13 22:55:57 +01:00
35fbd9fa1e immutable-arguments(#989): add a first-class unit test (closes #989)
the functionality as such is already covered,
but it seems important enough to warrant a dedicated test.


incidentally, Duration still lacked a default ctor.
Time values are default constructible, yet immutable.
2016-02-07 02:59:03 +01:00
2a6e48d7b5 immutable-arguments(#989): verify the tuple builder can handle those too
incidentally, this uncovered yet another unwanted narrowing conversion,
namely from double via gavl_time_t to TimeValue or alternatively
from double via FSecs (= rational<long>) to Duration.

As in all the previos cases, actually the compiler is to blame,
and GCC-5 is known to get that one right, i.e. let the SFINAE fail
instead of passing it with a "narrowing conversion" warning.



Note: the real test for command binding with immutable types
can be found in BusTerm_test
2016-02-07 02:20:01 +01:00
e0f866092d rectify-design(#301): disentangle CmdClosure hierarchy
Completely removed the nested hierarchy, where
the top-level implementation forwarded to yet another
sub-implementation of the same interface. Rather, this
sub-implementation (OpClosure) is now a mere implementation
detail class without VTable, and without half-baked
re-implementation of the CmdClosure interface. And the
state-switch from unbound to bound arguments is now
implemented as a plain-flat boolean flag, instead of
hiding it in the VTable.

To make this possible, without having to rewrite lots of
tests, I've created a clone of StorageHolder as a
"proof-of-concept" dummy implementation, for the sole
purpose of writing test fixtures. This one behaves
similar to the real-world thing, but cares only
for closing the command operation and omits all
the gory details of memento capturing and undo.
2016-02-07 01:41:40 +01:00
9515e45723 evolution(#967): simplify by variadic arguments 2016-02-06 22:17:48 +01:00
a7cd8996aa immutable-arguments(#989): proof-of concept
seems to work as assumed; we'll just have to construct
a new holder tuple in place when binding arguments.
Doesn't look too bad for me
2016-02-06 19:42:41 +01:00
91e74b0456 clean-up(#301): separate inclusions by purpose
and remove some superfluous ones
2016-02-06 19:41:21 +01:00
9847888a00 make TimeSpan default constructible
...probably just an omission. TimeValue and Time are
also default constructible, and this makes sense, semantically.

Please note that Time values are *immutable* though.
Only TimeVar can be reassigned. This is so by design
2016-02-06 19:23:16 +01:00
37fb19ae0a refactoring: separate headers 2016-02-06 18:50:51 +01:00
2fbb7ba7c9 simplification(#301): use ctor chaining to remove clutter 2016-02-06 16:42:42 +01:00
be2179ea81 command-closure-design(#301): better naming of implementation classes
Seems this was part of the confusion when looking at
the inheritance graph: Names where almost reversed
to the meaning. the ArgumentHolder was *not* the
argument holder, but the top level closure. And
the class "Closure" was not "the" Closure, but
just the argument holder. ;-)
2016-02-06 16:29:06 +01:00
dfc28ca2a0 UI-Bus command handling protocol unit test PASS
still TODO: the ability to use immutable types
within the command framework. In theory, this
shouldn't be had to implement, since we're creating
a new opaque value holder within the command registry
anyway, so it should be sufficient to refrain from
re-assigning a new value tuple. This is relevant,
since e.g. our time framework is built on immutable
value types.
2016-02-06 01:28:39 +01:00
deb7a6758c add diagnostic output to the command implementation record
...allows better diagnostic in tests, when handling a command
through the new mock handling pattern within Test-Nexus
2016-02-05 23:55:07 +01:00
3faf586c56 format-frontend: print bool values textually
recently, I've introduced this ability in our toString template.
as it turned out, the bool type was not selected by our
boost::format frontend for special treatment, thus showing
just the fallback «bool»
2016-02-05 23:53:12 +01:00
20bdee4acc convenience ctor condition in Variant to build string from char literal
Because this is especially annoying when constructing any type
based on lib::Variant, which is assumed to hold a string.
2016-02-05 22:33:50 +01:00
743a30c1ed command binding via UI-Bus implemented and covered in mock setup 2016-02-05 17:07:42 +01:00
3f22150ab3 back to topic: get all the arguments of command binding logged
...when the Test-Nexus processes a command binding message.
In the real system of course we do not want to log every bind message.

The challenge here is the fact that command binding as such
is opaque, and the types of the data within the bind message
are opaque as well. Finally I settled on the compromise
to log them as strings, but only the DataCap part;
most value types applicable within GenNode
have a string representation to match.
2016-02-05 15:55:22 +01:00
536a3a94b9 add special iteration mechanism to visit enclosed child data
the rationale is that I deliberately do not want to provide
a mechanism to iterate "over all contents in stringified form".
Because this could be seen as an invitation to process GenNode-
datastructures in an imperative way. Please recall we do not
want that. Users shall either *match* contents (using a visitor),
or they are required to know the type of the contents beforehand.
Both cases favour structural and type based programming over
dynamic run-time based inspection of contents

The actual task prompting me to add this iteration mechanism
is that I want to build a diagnostic, which allows to verify
that a binding message was sent over the bus with some
specific parameter values.
2016-02-05 04:03:11 +01:00