Commit graph

4929 commits

Author SHA1 Message Date
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
a91d03b60a Commands: draft usage of CommandInstanceManager (#1089) 2017-04-01 02:33:15 +02:00
12a7d96d9f Adjust logging for command definitions to be quiet by default
...otherwise our log will be flooded with command definition messages soon

NOTE: to see all command definitions happening, set into environment:

NOBUG_LOG='command:TRACE
2017-04-01 02:33:11 +02:00
95af930a71 Commands: finish CommandSetup helper (#1088)
this is a prerequisite for command instance management:
We have now an (almost) complete framework for writing actual
command definitions in practice, which will be registered automatically.

This could be complemented (future work) by a script in the build process
to regenerate proc/cmd.hpp based on the IDs of those automatic definitions.
2017-03-31 18:30:29 +02:00
e7d24febee Commands: add automatic registration ON_GLOBAL_INIT
...which makes the unit test PASS
2017-03-31 04:36:26 +02:00
49102ff18f Commands: define typical standard usage of CommandSetup 2017-03-31 04:14:45 +02:00
b303bcebc0 Commands: complete the test case
verify the commands where indeed defined as given by the lambda
2017-03-31 03:27:26 +02:00
27c2f843da Commands: ensure the CommandDef is not messed up by copying
...better make it noncopyable to enforce the builder-style use.

In the recent test, I observed strange behaviour when erroneously passing
the CommandDef by value; the command seemed to be registered just fine,
but afterwards, the registry was empty. I must admit I don't understand
this, just from reading the code in CommandDef and Command it should
work just fine to activate a copy of the originally started CommandDef;
anyway, I didn't care to track that issue down, rather make the
CommandDef noncopyable as it should have been right from start.
2017-03-19 06:07:54 +01:00
de7b9f87ed Commands: ensure the commands where actually defined by the closures
...next step in the CommandSetup_test
2017-03-19 06:03:17 +01:00
09b91197d3 Commands: now able to define commands by lambda!
...just pipe all passed functor-like objects
through the reworked function signature trait
2017-03-19 04:09:25 +01:00
017c72e74c Function-Tools: unit test for signature trait PASS 2017-03-19 04:09:25 +01:00
58898997d8 Function-Tools: get rid of the old-style FunctionSignature template
...it is now completely redundant, even superseded by the new _Fun
signature trait (which additionally also handles lambdas)
2017-03-19 04:09:24 +01:00
9a0b72e8ca Function-Tools: include the investigation code as unit test
...since there is not any test coverage for this trait, which
turned out to be quite deeply rooted in the system by now and
handles several rather subtle special cases
2017-03-19 02:29:39 +01: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
e2c4dec015 Function-Tools: verify coverage of reference and rvalue reference types
the usual suspects...
turns out we need specialisations for those too, even while in most cases
those special reference type won't make it far, and just degrade to function pointer
2017-03-19 01:26:48 +01:00
f8f8cc02d1 Function-Tools: simplify and modernise the main cases
...to not rely on the old-style signature templates anymore,
i.e. get rid of typename FunctionSignature<function<RET(ARGS...)>>

now, most cases just delegate to the "plain signature" case
2017-03-19 00:56:52 +01:00