diff --git a/src/common/instancehandle.hpp b/src/common/instancehandle.hpp index e69e5d0c0..2214be24f 100644 --- a/src/common/instancehandle.hpp +++ b/src/common/instancehandle.hpp @@ -44,6 +44,7 @@ #include "include/logging.h" #include "lib/error.hpp" #include "lib/nocopy.hpp" +#include "lib/depend-inject.hpp" #include "include/interfaceproxy.hpp" extern "C" { @@ -107,6 +108,9 @@ namespace lumiera { namespace facade { + template + using ServiceHandle = typename lib::DependInject::template ServiceInstance>>; + /** * @internal Helper/Adapter for establishing a link * between an InstanceHandle and a facade interface, @@ -118,39 +122,41 @@ namespace lumiera { */ template struct Link - : util::NonCopyable + : ServiceHandle { - typedef InstanceHandle IH; + using IH = InstanceHandle; + using SH = ServiceHandle; - Link (IH const& iha) { facade::openProxy(iha); } - ~Link() { facade::closeProxy(); } + using SH::SH; - FA& - operator() (IH const&) const + FA* + operator->() const { - return facade::Accessor()(); + return SH::operator->(); } }; /** * @internal when the InstanceHandle isn't associated with a - * facade interface, then this specialisation switches + * facade interface, then this specialisation switches * the facade::Link into "NOP" mode. */ template struct Link : util::NonCopyable { - typedef InstanceHandle IH; + using IH = InstanceHandle; + IH& ih_; - Link (IH const&) { /* NOP */ } - ~Link() { /* NOP */ } - - I& - operator() (IH const& handle) const + Link (IH const& ih) + : ih_{ih} + { } + + I* + operator->() const { - return handle.get(); + return & ih_.get(); } }; @@ -222,7 +228,7 @@ namespace lumiera { /** act as smart pointer providing access through the facade. * @note we don't provide operator* */ - FA * operator-> () const { return &(facadeLink_(*this)); } + FA * operator-> () const { return facadeLink_; } /** directly access the instance via the CL interface */ I& get () const { ENSURE(instance_); return *instance_; } diff --git a/src/common/interfaceproxy.cpp b/src/common/interfaceproxy.cpp index 6128842b9..84ce65a3f 100644 --- a/src/common/interfaceproxy.cpp +++ b/src/common/interfaceproxy.cpp @@ -117,15 +117,33 @@ namespace facade { void openProxy (IHA const& iha) { - Proxy::open(iha); +// Proxy::open(iha); } template void closeProxy () { - Proxy::close(); +// Proxy::close(); } + /////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1086 : new implementation draft below.... + template + class Binding; + + template + class Binding> + : public FA + { + protected: + typedef InstanceHandle IHandle; + typedef Binding IBinding; + + I& _i_; + + Binding (IHandle const& iha) + : _i_(iha.get()) + { } + }; }} // namespace lumiera::facade diff --git a/src/gui/display-interface-proxy.hpp b/src/gui/display-interface-proxy.hpp index 2b0130a37..6ead497c6 100644 --- a/src/gui/display-interface-proxy.hpp +++ b/src/gui/display-interface-proxy.hpp @@ -65,7 +65,7 @@ namespace facade { template<> class Proxy - : public Holder + : public Binding { //----Proxy-Implementation-of-lumiera::Display-------- @@ -83,11 +83,11 @@ namespace facade { public: - Proxy (IHandle const& iha) : THolder(iha) {} + using IBinding::IBinding; }; - template void openProxy (IHandle_Display const&); - template void closeProxy (void); +// template void openProxy (IHandle_Display const&); +// template void closeProxy (void); }} // namespace lumiera::facade diff --git a/src/gui/notification-interface-proxy.hpp b/src/gui/notification-interface-proxy.hpp index c6fa6cd2e..ae08a6686 100644 --- a/src/gui/notification-interface-proxy.hpp +++ b/src/gui/notification-interface-proxy.hpp @@ -63,7 +63,7 @@ namespace facade { template<> class Proxy - : public Holder + : public Binding { using Level = gui::NotifyLevel; @@ -77,12 +77,12 @@ namespace facade { public: - Proxy (IHandle const& iha) : THolder(iha) {} + using IBinding::IBinding; }; - template void openProxy (IHandle_GuiNotification const&); - template void closeProxy (void); +// template void openProxy (IHandle_GuiNotification const&); +// template void closeProxy (void); }} // namespace lumiera::facade diff --git a/src/proc/control/session-command-interface-proxy.hpp b/src/proc/control/session-command-interface-proxy.hpp index a8658ebdf..33c85abed 100644 --- a/src/proc/control/session-command-interface-proxy.hpp +++ b/src/proc/control/session-command-interface-proxy.hpp @@ -39,6 +39,7 @@ /* ==================== SessionCommand =================================== */ #include "include/session-command-facade.h" +#include "include/interfaceproxy.hpp" namespace proc { namespace control { @@ -61,7 +62,7 @@ namespace facade { template<> class Proxy - : public Holder + : public Binding { //----Proxy-Implementation-of-SessionCommand-------- @@ -72,12 +73,12 @@ namespace facade { public: - Proxy (IHandle const& iha) : THolder(iha) {} + using IBinding::IBinding; }; - template void openProxy (IHandle_SessionCommand const&); - template void closeProxy (void); +// template void openProxy (IHandle_SessionCommand const&); +// template void closeProxy (void); }} // namespace lumiera::facade diff --git a/src/proc/play/dummy-player-interface-proxy.hpp b/src/proc/play/dummy-player-interface-proxy.hpp index a4db2b95b..8a66398e6 100644 --- a/src/proc/play/dummy-player-interface-proxy.hpp +++ b/src/proc/play/dummy-player-interface-proxy.hpp @@ -77,7 +77,7 @@ namespace lumiera { template<> class Proxy - : public Holder + : public Binding { //----Proxy-Implementation-of-DummyPlayer-------- typedef lumiera::DummyPlayer::Process Process; @@ -106,12 +106,12 @@ namespace lumiera { public: - Proxy (IHandle const& iha) : THolder(iha) {} + using IBinding::IBinding; }; - template void openProxy (IHandle_DummyPlayer const&); - template void closeProxy (void); +// template void openProxy (IHandle_DummyPlayer const&); +// template void closeProxy (void); } // namespace facade diff --git a/src/proc/play/dummy-player-service.cpp b/src/proc/play/dummy-player-service.cpp index 346f53f62..2dee57464 100644 --- a/src/proc/play/dummy-player-service.cpp +++ b/src/proc/play/dummy-player-service.cpp @@ -235,6 +235,84 @@ namespace proc { } // (End) hidden service impl details +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1086 : find out where the Proxy is implemented +}}//(END)proc::play +#include "include/dummy-player-facade.h" +#include "include/interfaceproxy.hpp" + +namespace lumiera{ + namespace facade { + +//////////////////////////////////////////////////////TICKET #1086 : copy-n-paste from interfaceproxy.cpp + template + class Binding; + + template + class Binding> + : public FA + { + protected: + typedef InstanceHandle IHandle; + typedef Binding IBinding; + + I& _i_; + public: /////////////////////////////////////TICKET #1086 : need to make the inherited ctor public + + Binding (IHandle const& iha) + : _i_(iha.get()) + { } + }; +//////////////////////////////////////////////////////TICKET #1086 : copy-n-paste from interfaceproxy.cpp + + typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0) + , lumiera::DummyPlayer + > IHandle_DummyPlayer; + + + template<> + class Proxy + : public Binding + { + //----Proxy-Implementation-of-DummyPlayer-------- + typedef lumiera::DummyPlayer::Process Process; + typedef proc::play::ProcessImpl ProcessImpl; + + /** @note as an optimisation we hand out a direct reference + * to the implementing process object. While this ref could + * still be passed as handle to the C Language interface, using + * it directly within the client (=GUI) bypasses the C interface + * and thus leaves us only with one level of indirection, + * irrespective if using the C or C++ interface. + * @note in hindsight this turned out as a very bad idea, + * since it complicated the definition of the facade proxy + * and created quite involved library dependency problems. + */ + Process start(LumieraDisplaySlot viewerHandle) override + { + ProcessImplementationLink* pP = static_cast (_i_.startPlay (viewerHandle)); + + if (!pP) + throw lumiera::error::State("failed to start DummyPlayer", lumiera_error()); + + return pP->createHandle(); + } + + + + public: + using IBinding::IBinding; + }; + + +// template void openProxy (IHandle_DummyPlayer const&); +// template void closeProxy (void); + + + } // namespace facade +} +namespace proc { +namespace play { +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1086 : find out where the Proxy is implemented diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 225496b0d..4d92964d1 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -28321,35 +28321,223 @@ - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + +

+ den habe ich nicht mehr über das Interface-System gemappt +

+ + +
+ + + + + +

+ weil mir das ganze C-gefrickel zu blöd geworden ist. +

+

+ Also hat das hier Prototyp-Charakter! +

+ + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + +

+ der Interface-Anbieter implementiert einen konkreten Proxy +

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ das ist ein konzeptionelles Problem. +

+

+ Eigentlich möchte man durch ein Interface Entkoppelung erreichen. +

+

+ +

+

+ Nun ist es so, daß +

+
    +
  • + das Binding BusinessInterface -> InterfaceSystem +
  • +
  • + InterfaceSystem -> Service-Implementierung +
  • +
+

+ an der gleichen Stelle erfolgen +

+ + +
+ + + + + + +
+ + + + + +
+
- +