Commit graph

5375 commits

Author SHA1 Message Date
d0538a55ff ViewSpec: implement the generic access function in ViewLocator
still missing: internal wiring from the allocation token(s) of the DSL
into the ElementAccess service designed last week.
2018-04-15 03:07:54 +02:00
ba3d9e57b5 ViewSpec: draft a way to code an integration test for ViewLocator (#1129)
The original goal for #1129 (ViewSpecDSL_test) is impossible to accomplish,
at least within our existing test framework. Thus I'll limit myself to coding
a clean-room integration test with purely synthetic DSL definitions and mock widgets
2018-04-15 01:39:46 +02:00
86b1aac721 ElementAccess: somewhat improve the mock implementation to cover the standard case
...still quite braindead, but well....
2018-04-14 03:58:02 +02:00
c9dc9264b4 Library: fix possible follow-up error in errorhandling
usually the ID is hard coded, but when re-throwing errors, it might be
from "somewhere else", which means it is possibly a NULL ptr.
In those cases we fall back to the cannonical ID of the error class.
2018-04-14 03:24:45 +02:00
4205511405 ElementAccess: change the way of mock element creation
...still quite braindead, but allows at least to cover the standard case as well.

A better mock element access service would at least traverse a GenNode-Tree,
and thus emulate the behaviour of the real service; yet both seems way beyond
scope right now, and all I need is some basic coverage of the Interface
2018-04-14 03:14:19 +02:00
a565fc3321 ElementAccess: rearrange files according to namespace 2018-04-14 02:06:31 +02:00
4071a58454 ElementAccess: fix first unit test case
ouch, the typedef Base /is/ already a pointer...
2018-04-14 01:59:41 +02:00
4c273d902c ElementAccess: add very simplistic mock implementation 2018-04-14 01:37:56 +02:00
bf9fcc3b2e ElementAccess: make the metaprogramming helper part of lib::Variant
...since such a metafunction makes sense, generally.
Get me the first of the possible variant types, which fulfils predicate _P_
2018-04-13 04:19:50 +02:00
22f50b1b00 ElementAccess: streamline error cases
My understanding is that in the standard use case, we precisely know what to expect
and just go ahead and perform the conversion. Thus it is pointless to introduce
fine grained distinctions. When the access fails, this always indicates some broken
application logic, and just raises an error.
2018-04-13 03:29:08 +02:00
ac4f0bc6db ElementAccess: possibly working solution based on lib::variant
With this solution, somewhere deep down within the implementation
the knowledge about the actual result type would be encoded into
the embedded VTable within a lib::variant. At interface level,
ther will be a double dispatch based on that result type
and the desired result type, leading either to a successful
access or an error response.
2018-04-13 02:39:46 +02:00
35ea547fd1 ElementAccess: (WIP) another unsuccessful attempt
Problem is, we can not even compile the conversion in the "other branch".
Thus we need to find some way to pick the suitable branch at compile time.

Quite similar to the solution found for binding Rec<GenNode> onto a typed Tuple
2018-04-09 02:19:54 +02:00
91b83f5ede ElementAccess: (WIP) unsuccessful attempt to solve the typing problem
the intention was to return disparate result types, just depending on the
actual position in the UI-Coordinates. The client knows what to expect
2018-04-09 01:14:12 +02:00
c245098d45 ElementAccess: (WIP) first draft for internal accessor function
...but can not work this way.
Since void* has not RTTI, no secure access with downcast is possible
2018-04-09 00:51:24 +02:00
20ecc3f0d0 DI: allow to trigger the lazy instantiation of a mock service instance directly
Basically the mocking mechanism just switches the configuration
and then waits for the service to be accessed in order to cause acutual
instantiation of the mock service implementation. But sometimes we want
to prepare and rig the mock instance prior to the first invocation;
in such cases it can be handy just to trigger the lazy creating process
2018-04-08 18:43:27 +02:00
e99ad7a3e6 ElementAccess: draft simple lookup interface 2018-04-08 18:43:27 +02:00
ca9abaa9d9 ElementAccess: change wiring in ViewLocator into a dependency
...reduce immediate coupling, since we do not really now what actions ElementAccess
will actually perform, and this is likely to remain this way for some time.
So just let it sit there are an on-demand dependency.

Moreover, create an (empty placeholder) implementation within WindowLocator.
So everything is set now for the actual implementation to be filled in
2018-04-07 02:55:47 +02:00
09359cf92a ElementAccess: initial brainstorming about the interface mechanics 2018-04-07 02:28:29 +02:00
dc97ab5546 ElementAccess: consider helper to encapsulte access to actual GTK structures (#1134) 2018-04-07 01:00:25 +02:00
eae775b725 ViewSpec: rearrange dependencies to simplify testing
...but still not clear yet what we actually need to access from within the ViewSpecDSL_test
2018-04-05 22:23:34 +02:00
2f899a921c ViewSpec: draft next steps to address
...should implement the generic invocation in ViewLocator,
without actually implementing the backing UI element allocation logic
2018-04-05 19:43:10 +02:00
18a552002d ViewSpec: use mocked LocationSolver to verify operation of the DSL 2018-04-05 01:09:13 +02:00
64d5f868ea ViewSpec: and finally solve the daunting problem of service access
this is f***ng unbelievable.
Its just two lines of code now
VICTORY!
2018-04-04 04:37:13 +02:00
cb6155c85e ViewSpec: now turn the UILocationSolver into yet another global service
feels a bit uncanny after all
can't be *that* easy
2018-04-04 03:59:11 +02:00
4de2ea2abe ViewSpec: get rid of all the lambdas and global vars. LocationQuery is a service now
Harvesting the fruits of the DependencyFactory rework....
2018-04-04 03:48:53 +02:00
71bb2b48b6 ViewSpec: pick up with dependency-injection into the DSL tokens (#1126)
Attempt to find my way back to the point
where the digression regarding dependency-injection started.

As it turns out, this was a valuable digression, since we can rid ourselves
from lots of ad-hoc functionality, which basically does in a shitty way
what DependencyFactory now provides as standard solution


FIRST STEP is to expose the Navigator as generic "LocationQuery" service
through lib::Depend<LocationQuery>
2018-04-04 03:29:26 +02:00
fb8a5333fc DOC: reduce DependencyFactory page in the TiddlyWiki
...since it has been published almost 1:1 on the Lumiera website.
Retain only some technical reference information here
2018-04-04 01:43:24 +02:00
b3c5142c2f DOC: publish the microbenchmark results in the technical documentation section (closes #1086) 2018-04-03 09:08:40 +02:00
6f2ed76d83 Improve the code for proxy generation
more of a layout improvement, to avoid any code duplication.
The mechanics remain the same
 - write an explicit specialisation
 - trigger template intantiation within a dedicated translation unit
2018-04-03 07:45:13 +02:00
db7172df29 DOC: update technical (doxygen) documentation to reflect the integration with lib::Depend 2018-04-03 06:37:36 +02:00
31a2e5879d Fix problem with ambiguous ctor overloads for DependInject::ServiceInstance
while switching various services to the new framework,
I noticed the requirement to create a service handle in not-yet-started mode
and then start it explicitly, maybe even from another thread. Thus I introduced
a no-arg default ctor for that purpose, but overlooked that the forwarding ctor
might also need zero arguments for default constructible service implementation
classes. Thus I've now introduced a marker ENUM for disambiguation
2018-04-03 05:15:33 +02:00
18d0970a86 Rework Interface-Proxy definition to fit with the new scheme
everything works now after the switch.
BUT this solution is ugly, we need to trigger template instantiation explicitly
2018-04-03 05:15:26 +02:00
f24c548443 Reorganise translation units for interface proxies
from now on, we'll have dedicated individual translation units (*cpp)
for each distinct interface proxy. All of these will include the
interfaceproxy.hpp, which now holds the boilerplate part of the code
and *must not be included* in anything else than interfac proxy
translation units. The reason is, we now *definie* (with external linkage)
implementations of the facade::Link ctor and dtor for each distinct
type of interface proxy. This allows to decouple the proxy definition code
from the service implementation code (which is crucial for plug-ins
like the GUI)
2018-04-03 03:14:55 +02:00
1101e1f1db Dismantle the woefully complex interfaceproxy Accessor in favour of lib::Depend
The recently rewritten lib::Depend front-end for service dependencies,
together with the configuration as lib::DependInject::ServiceInstance
provides all the necessary features and is even threadsafe.

Beyond that, the expectation is that also the instantiation of the
interface proxies can be simplified. The proxies themselves however
need to be hand-written as before
2018-04-03 02:44:12 +02:00
4e0d99e928 Demote the Play-Facade to a in-language (C++) Interface to get rid of InterfaceFacadeLink
I am fully aware this change has some far reaching ramifications.
Effectively I am hereby abandoning the goal of a highly modularised Lumiera,
where every major component is mapped over the Interface-System. This was
always a goal I accepted only reluctantly, and my now years of experience
confirm my reservation: it will cost us lots of efforts just for the
sake of being "sexy".
2018-04-03 02:14:45 +02:00
9f3c127240 (WIP) Draft to replace the Interface-Proxy-Binding by lib::Depend
in theory this should be possible and obsolete a lot of dedicated code,
since lib::Depend provides all the intance management and error checking
2018-04-02 08:20:56 +02:00
6fe8e970cb Switch further Service implementations and obsolete SingletonRef alltogether
SingletonRef was only invented because lib::Depend (or lib::Singleton at that time)
offered only on-demand initialisation, but could not attach to an external service.
But this is required for calling out at the implementation side of a
Lumiera Interface into the actual service implementation.

The recently created DependInject::ServiceInstance now fulfils this task way better
and is seamlessly integrated into the lib::Depend front-end
2018-04-02 05:00:01 +02:00
29ee5131f4 Switch first Layer-Separation-Interface to expose the service implementation via lib::Depend
Actually this is on the implementation side only.
Since Layer-Separation-Interfaces route each call through a binding layer,
we get two Service-"Instances" to manage
- on the client side we have to route into the Lumiera Interface system
- on the implementation side the C-Language calls from the Interface system
  need to get to the actual service implementation. The latter is now
  managed and exposed via DependInject::ServiceInstance
2018-04-02 04:19:17 +02:00
be789bea59 Fix funny problem with C header stdbool.h
...which is so kind as to redefine bool, true and false as macros. Yessss!
2018-04-02 03:27:07 +02:00
6460ff8344 Switch basic Application initialisation to the rewritten DependencyFactory
this is the classic case of a singleton object
2018-04-02 02:56:08 +02:00
4669260cd1 Fix setup of the ConfigManager implementation
...still using the FAKE implementation, not a real rules engine.
However, with the new Dependency-Injection framework we need to define
the actual class from the service-provider, not from some service-client.
This is more orthogonal, but we're forced to install a Lifecycle-Hook now,
in order to get this configuration into the system prior to any use
2018-04-02 02:20:54 +02:00
89d93a13e4 Modernise Unknown Exception handler and Exception messages 2018-04-02 01:48:51 +02:00
21e47e014a Modernise Lumiera Error baseclass 2018-04-01 23:45:00 +02:00
d6167c1845 DependencyFactory: reorder destructor to allow for re-entrance
This is borderline yet acceptable;
A service might indeed depend on itself circularly
The concrete example is the Advice-System, which needs to push
the clean-up of AdviceProvicions into a static context. From there
the deleters need to call back into the AdviceSystem, since they have
no wey to find out, if this is an individual Advice being retracted,
or a mass-cleanup due to system shutdown.

Thus the DependencyFactory now invokes the actual deleter
prior to setting the instance-Ptr to NULL.
This sidesteps the whole issue with the ClassLock, which actually
must be already destroyed at that point, according to the C++ standard.
(since it was created on-demand, on first actual usage, *after* the
DependencyFactory was statically initialised). A workaround would be
to have the ctor of DependencyFactory actively pull and allocate the
Monitor for the ClassLock; however this seems a bit overingeneered
to deal with such a borderline issue
2018-04-01 07:06:58 +02:00
bfbcc5de43 simplify ClassLock by use of Meyer's Singleton with zombie check
...and package the ZombieCheck as helper object.
Also rewrite the SyncClassLock_test to perform an
multithreaded contended test to prove the lock is shared and effective
2018-04-01 06:09:01 +02:00
21fdce0dfc a better solution to reject out-of-order static access after shutdown
Static initialisation and shutdown can be intricate; but in fact they
work quite precise and deterministic, once you understand the rules
of the game.

In the actual case at hand the ClassLock was already destroyed, and
it must be destroyed at that point, according to the standard. Simply
because it is created on-demand, *after* the initialisation of the
static DependencyFactory, which uses this lock, and so its destructor
must be called befor the dtor of DependencyFactory -- which is precisely
what happens.

So there is no need to establish a special secure "base runtime system",
and this whole idea is ill-guided. I'll thus close ticket #1133 as wontfix

Conflicts:
	src/lib/dependable-base.hpp
2018-04-01 04:52:50 +02:00
a8273283d1 (WIP) fruitless efforts to build a dependable static environment
My gut feeling tells me that I am on the wrong track alltogether
2018-04-01 04:52:01 +02:00
992056ea69 reduce include dependencies of DelStash
...get rid of some further Boost includes and remove unnecessary disable_if
2018-04-01 00:37:58 +02:00
f0eeafddaa Identified some problems regarding static destruction
When some dependency or singleton violates Lumiera's policy regarding destructors and shutdown,
we are unable to detect this violation reliably and produce a Fatal Error message.
This is due to lib::Depend's de-initialisating being itself tied to template generated
static variables, which unfortunately have a visibility scope beyond the translation unit
responsible for construction and clean-up.
2018-03-31 17:27:13 +02:00
fc546f71b4 Reorganise some tests
Dependency-Injection rather fits into the "fundamentals" section.
It is more than a mere library facility
2018-03-31 17:12:45 +02:00