Commit graph

4944 commits

Author SHA1 Message Date
10c2e4b9a9 CmdAccess: rename the front-end to CmdContext to clarify the purpose 2017-04-17 20:00:07 +02:00
82d66cef73 CmdAccess: discard the InvocationTrail concept
after extended analysis, it turned out to be a "placeholder concept"
and introduces an indirection, which can be removed altogether

- simple command invocation happens at gui::model::Tangible
- it is based on the command (definition) ID
- instance management happens automatically and transparently
- the extended case of context-bound commands will be treated later,
  and is entirely self-contained
2017-04-17 18:21:52 +02:00
8c7ac997de CmdAccess: replace existing usages of InvocationTrail 2017-04-17 16:57:09 +02:00
876c1dd1fd Commands: change implementation frame to include the command-ID
while the initial design treated the commands in a strictly top-down manner,
where the ID is known solely to the CommandRegistry, this change and information
duplication became necessary now, since by default we now always enqueue and
dispatch anonymous clone copies from the original command definition (prototype).

This implementation uses the trick to tag this command-ID when a command-hanlde
is activated, which is also the moment when it is tracked in the registry.
2017-04-17 03:09:12 +02:00
471fa5b9c4 CommandInstanceManager: fix error check accidentally killing the local instance
due to the refactorings, the instance was moved out prior to checking for
bound arguments. This is ammended now, albeit at the price of passing an
additional flagn and some tricky boolean conditions
2017-04-17 01:51:27 +02:00
3922bb58e1 Commands: fix and adapt instance management test 2017-04-17 01:51:27 +02:00
cfe192f8c6 Commands: some unit test coverage for unbinding arguments
...just to make sure it is properly integrated with the state predicates
2017-04-16 19:38:56 +02:00
bb7bba5dc2 Commands: add API to unbind and discard command arguments
this seems like an obvious functionality and basically harmless,
since commands are designed to be inherently stateful, which is reflected
in all the internal storage holders to expos an assignment operator
(even while the actual implementation is based on placement new instead
of assigning values into the storage, and thus even supports immutable
values). The only possible ramification is that argument values must
be default constructible
2017-04-16 19:21:29 +02:00
410c36d2c3 Commands: change semantics of command instance management (#1089)
in accordance to the design changes concluded yesterday.
 - in the standard cases we now check the global registry first
 - automatically create anonymous clone copy from global commands
 - reorganise code internally to use common tail implementation
2017-04-16 18:27:05 +02:00
079ad715b0 Commands: change API to allow moving commands into the dispatcher queue 2017-04-16 16:16:26 +02:00
67e1032f7d Commands: draft the changes to be done with command instance management
...as consequence to be drawn from the design critique
2017-04-16 02:51:38 +02:00
730f559ab2 CmdAccess: design critique 2017-04-15 23:48:42 +02:00
5f6854621e Command-Cycle: remove the separate 'bang!' message
as it turns out, we can always trigger commands right away,
the moment all arguments are known. Thus it is sufficient to
send a single argument binding message, which allows us to
get rid of a lot or ugly complexities (payload visitor).
2017-04-14 23:45:35 +02:00
35a4e7705b CmdAccess: expand on the DSL draft 2017-04-14 03:22:08 +02:00
08d332c70f CmdAccess: initial draft for a framework and DSL to use commands (#1090) 2017-04-13 18:55:07 +02:00
aecef2a8f4 Commands: refactor integration into SessionCommandService (#1089)
It seems more adequate to push the somewhat intricate mechanics
for the "fall back" onto generic commands down into the implementation
level of CommandInstanceManager. The point is, we know the standard
usage situation is to rely on the instance manager, and thus we want
to avoid redundant table lookups, only to support the rare case of
fallback to global commands. The latter is currently used only from
unit-tests, but might in future also be used by scripts.

Due to thread safety considerations, I have refrained from handing
out a direct reference to the command token sitting in the registry,
even while not doing so incurs a small runtime penalty (accessing
the shared ref-count for creating a copy of the smart-handle).
This is the typical situation where you'd be tempted to sacrifice
sanity for the sake of an imaginary performance benefit, which
in fact is dwarfed by all the machinery of UI-Bus and argument
passing via GenNode.
2017-04-09 19:11:40 +02:00
45f86e42e4 Commands: Instance management integrated in SessionCommandService
but I am not happy with the implementation yet: the maybeGet just
doesn't feel right. Likely it will be a better idea to push that
fallback mechanism generally down into the CommandInstanceManager?
2017-04-09 03:58:38 +02:00
0dad15209d Commands: add new slot into SessionCommand facade
for the operation to start a new command cycle and open a new instance
2017-04-09 03:01:12 +02:00
a53032cfc5 Analysis regarding the next step, integration of InstanceManagement into SessionCommand facade 2017-04-09 01:34:18 +02:00
22c1a1d189 Commands: rename some of the planned components for command access
...to make the names more handy
2017-04-08 16:24:36 +02:00
a4527c5e75 Commands: Instance management implementation finished (#1089) 2017-04-08 15:42:51 +02:00
f495a069aa Symbol: also document usage as (tree)map key
especially note the absence of an comparison operator,
which causes std::map to fall back on pointer comparison.
2017-04-08 03:50:29 +02:00
dd0656e812 Symbol: add more test coverage for comparisons 2017-04-08 03:30:12 +02:00
32a76a5703 SymbolTable: needs proper locking (#158)
this might turn into lock contention problem, but better optimise
a correct implementation than fix a fast yet broken one.

Hint: SessionCommandFunction_test demonstrates that the
symbol table can be corrupted by creating Symbol instances
in parallel without proper locking. So yes, this is for real.
2017-04-08 02:27:51 +02:00
3f17e6558e Symbol: clean-up of some occasional usages
hereby overlooking the elephant in the room: EntryID could switch to Symbol now
2017-04-08 00:40:04 +02:00
baa4111358 Symbol: use a dedicated hash function
since Symbol instance are now backed by a symbol table,
we can use a much faster hash function by just hashing the
pointer into the symbol table, since the Symbol string content
is already checked at initialisation.
2017-04-07 23:34:35 +02:00
2204066a94 Symbol: test coverage for empty and bool
oh yeah
yet another opportunity for mistakes
2017-04-07 20:06:19 +02:00
4df59678a3 Symbol: rework initialisation and introduce a "bottom" Symbol
Up to now, we tolerated null pointers in Literal instances.
But we can not tolerate passing a null cString to Symbol initialisation.
Rather, hereby we introduce a dedicated "bottom" Symbol, a valid "null object"
2017-04-07 19:25:21 +02:00
23c412bc42 Symbol: rework equality comparisons (#417)
For this task, I've also investigated to use boost::operators
This would only incur a negligible penalty on build times and executable sizes,
however, I don't consider the boost based solution to improve readability,
since many of these comparisons are tricky or subtly different.

Moreover, since boost::operators needs to be mixed-in, the initialisation
of Symbol objects becomes difficult, not to mention the additional base class
information visible in the debugger when inspecting Symbol or Literal objects

For that reason, I decided *against* using Boost here and coded up
all the operators in all combinations manually
2017-04-07 18:04:49 +02:00
29b8b2b8bc Symbol: switch to using the symbol-table as backing implementation (#158)
...which means, from now on identical input strings
will produce the same Symbol object (embedded pointer).

TODO: does not handle null pointers passed in as c-String properly
2017-04-07 06:34:41 +02:00
f9c3b8b61c Commands: get second testcase to PASS 2017-04-07 04:19:10 +02:00
f7d4a3c83e Commands: draft test case to cover lifecycle sanity checks 2017-04-06 20:40:18 +02:00
228f7d441f Commands: draft further test case to cover handling of duplicates
The instance manager opens (creates) a new instance by cloning
from the prototype. Unless this instance is dispatched, it does not
allow to open a further instance (for the same instanceID). But of course
it allows to open a different instance from the same prototype
2017-04-06 20:12:31 +02:00
b2dc6a0cb4 Commands: draft test case to clarify command instance identity 2017-04-06 19:58:45 +02:00
d37037fc22 Commands: change policy to disallow duplicate command instances
just by reasoning from the concept, an instance should always correspond
to a single invocation trail. Having several sets of invocation state
compete with each other, means to keep them distinct, otherwise the
implicit state is going to be corrupted
2017-04-06 18:32:01 +02:00
0446f49e7d resolve some further uses implicit bool conversion trickery (closes #178) 2017-04-02 06:49:05 +02:00
afe07bdb16 decommission the safe-bool-idiom (closes #477)
obsoleted by C++11

 * in most cases, it can be replaced by an explicit conversion operator
 * especially for the Lumiera Forward Iterators, we need an implicit conversion
2017-04-02 06:42:23 +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
26651a0a86 Fix notorious warning
...especially nasty on full rebuild
2017-04-01 23:59:37 +02:00
05aaa74422 MERGE Doxygen clean-up done during the last months 2017-04-01 23:59:00 +02:00
a9cb417320 Enable move-initialisation on command activation 2017-04-01 19:26:23 +02:00
0b63cdd88e Modernise lib::Handle
...to enable move initialisation

And while we're at it, also drop the obsolete 'safe bool idiom'
2017-04-01 18:57:44 +02:00
32f995f1ce Commands: simple instance management unit test PASS (#1089) 2017-04-01 18:39:53 +02:00
16737eb74c Commands: adjustments due to the change to anonymous instances
this is indeed a change of concept.
A 'command instance' can not be found through the official
Command front-end anymore, since we do not create a registration.
This allows us to avoid decorating command IDs with running counters
2017-04-01 02:56:49 +02:00
97e42f75ee Commands: code up implementation of CommandInstanceManager
interesting new twist: we do not even need to decorate with a running number,
since we'll get away with an anonymous command instance, thanks to Command
being a smart-handle
2017-04-01 02:33:15 +02:00
ce71ae1ae4 Symbol-Table: use a more decent hack (#158)
it is not *that* hard to behave in a somewhat sane manner here.
And even more: this *is* basically the symbol table implementation we need.

Thus we only need to build the right front-end now...
2017-04-01 02:33:15 +02:00
3dcd84232c Symbol-Table hack: the disease starts to spread (#158)
we need a real symbol table implementation, so we can assemble symbols
and then intern them. This was the whole purpose of inventing the class Symbol
2017-04-01 02:33:15 +02:00
97d7a6804e Commands: implement test fixture
...which acts here as a mocked "ProcDispatcher"
2017-04-01 02:33:15 +02:00
99d23570cd Commands: test driven stubbing.... 2017-04-01 02:33:15 +02:00
a13270a6b8 Commands: static registration for the existing test dummy commands
Up to now, these dummy functions where used by various unit tests
directly, by creating command definitions within the test fixture.

But since it is foreseeable that we'll need dummy commands for various
further unit tests, it seems adequate to setup a global static registration
with the newly created system of command registrations for these dummies.
2017-04-01 02:33:15 +02:00