Commit graph

4878 commits

Author SHA1 Message Date
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
f19fabfa3a Function-Tools: thus change behaviour for member-pointer-to-function
...to not include the "this" argument anymore
2017-03-19 00:40:10 +01:00
dfea57fd02 Function-Tools: switch tail-call to variadic template
..otherwise unchanged.

NOTE: we need two variants, since lambdas are always const functions,
      while a member pointer to (non)const function would not be captured
      by that overload and thus recurse into the main case and fail there
      with "has no operator()"
2017-03-19 00:27:59 +01:00
0b7559ce9a Function-Tools: include lambdas into the investigation
...and move the tail-call of the template instantiation into try.cpp


This experiment clearly shows the discrepancy now:
 - binding a member pointer directly into a function object will expand the argument list
 - but binding a similar lambda into a function object won't
   (it is not necessary due to the context capture)

The result is that we need to drop support for one of those cases,
and it is clear that the member poiter will be the looser...
2017-03-19 00:19:07 +01:00
c5bff75bc2 Function-Tools: start investigation regarding Signatures and member pointers
It is not clear what would be the 'right' way to handle a member pointer to function
within the function-trait _Fun. The existing implementation choose to inject
an additional parameter for the enclosing class ("this"), which seems to collide
with the intention to use this overload with the "decltype trick" to integrate
support for lambdas.

As it turns out, this specific code path of the existing _Fun trait was not
yet used, fortunately, so we're free to search for the proper design here...
2017-03-18 23:31:10 +01:00
4ff07b62f1 Functor-Tools: reshape generic function signature trait to integrate Lambdas (#994)
As a first step towards a gradual rework of our function metaprogramming helpers,
this change prepends a generic case for all kinds of functors to our existing
solution, which up to now was entirely based on explicit specialisations.

C++11 supplied the new language construct 'decltype(EXPR)', which allows us
to capture any class with an function operator, which also includes the Lambdas.

The solution was proposed 2011 on StackOverflow
http://stackoverflow.com/questions/7943525/is-it-possible-to-figure-out-the-parameter-type-and-return-type-of-a-lambda/7943765#7943765

We used it already with success within our TreeMutator.
But obviously the goal should be to unite all the function trait / metaprogramming helpers,
which unfortunately is a more expensive undertaking, since it also involves
to get rid of the explicit specialisations and retrofit our Types<XXX...> helper
to rely on variadic templates rather than on loki-style typelists.


This first step here is rather conservative, since we'll still rely on our
explicit specialisations in most cases. Only the Lambdas will go through the
new, generic case, and from there invoke the specialisation for member functions.
The latter need to be rectified as well, which is subject of the next changeset...
2017-03-18 22:06:44 +01:00
afadc35eab WIP: draft command binding by lambda...
as it stands, this does not work, since lambdas are passed by-value,
while function references can only be passed by explicit reference,
otherwise they'll degrade to a function pointer. And std::function
requires a plain function signature as type argument, not the type
of a function pointer (which doesn't mean you can't construct a
std::function from a FP, indeed there is an explicit overload for
that).
2017-03-18 19:02:41 +01:00
e9948084fc Commands: integrate inline command definition by lambda
...this was the problematic part of the whole design attempted here,
and seemingly it works like a charm!
2017-03-18 17:56:41 +01:00
180b1224e7 Commands: implement invocation of enqueued command definitions 2017-03-18 05:28:56 +01:00
d044abe3c7 Commands: implement the registration queue for command definitions 2017-03-18 04:40:16 +01:00
29ce5b9c69 Commands: define interface for installing a command definition
The idea is to assign a lambda, which will be enqueued by side-effect.
implementation is just stubbed.
2017-03-18 03:52:18 +01:00
833193342f Commands: define basic properties of unbound CommandSetup 2017-03-18 03:20:05 +01:00
4648703952 Commands: new test for shaping the CommandSetup helper 2017-03-18 02:27:11 +01:00
b865acf758 Commands: decide about the basic concept how commands are to be defined (#215)
The point in question is how to manage these definitions in practice,
since we're about to create a huge lot of them eventually. The solution
attempted here is heavily inspired by the boost-test framework
2017-03-18 01:55:45 +01:00
c251f9c2a9 Commands: establish location for defining commands 2017-03-17 21:07:12 +01:00
ada40609f5 more planning of command invocation structure 2017-03-17 04:09:44 +01:00
cfe9cc96f6 planning and analysis regarding command invocation 2017-03-15 04:37:06 +01:00
ff42530f25 push on the topic of global action definitions (#1085)
...because this topic serves as a vehicle to elaborate various core concepts
of the UI backbone, especially how to access, bind and invoke Proc-Layer commands
2017-03-14 04:30:02 +01:00
57a336ab49 more planning with respect to UI/Session command access (#1087) 2017-03-11 02:07:52 +01:00
789246fc3a draft a concept for command instantiation (#1070) 2017-03-08 04:25:33 +01:00
2f538f5f95 continue analysis regarding command invocation (#1070)
...turns out to be a nasty subject, now we're able to see
in more concrete detail how this interaction needs to be carried out.
Basically this is a blocker for the top-level, since it is obviously
some service in top-level, which ultimately becomes responsible for
orchestrating this activity
2017-03-05 02:53:04 +01:00
4acb9be4d2 Library: singleton / lib::Depend should be rewritten eventually (#1086) 2017-03-05 01:01:08 +01:00
c068779a80 command-invocation: use case analysis 2017-03-03 23:59:22 +01:00
40eba94917 planning: next steps towards command invocation (#1070) 2017-03-03 19:42:53 +01:00
41ea59176c UI-top-level: include global help controller ("wizzard") 2017-03-02 23:49:23 +01:00
8d27585976 Menu-Actions: add stubs to forward session operations to InteractionDirector 2017-03-02 23:08:01 +01:00