From caf8bfdac1067d92b159fcb1c9554f36c85b0183 Mon Sep 17 00:00:00 2001 From: Pierre Wielders Date: Tue, 2 Jul 2024 09:04:54 +0200 Subject: [PATCH] [OOP] Move the plugin as a whole OOP. (#1679) --- Source/plugins/IShell.h | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Source/plugins/IShell.h b/Source/plugins/IShell.h index d0411d746..de0e09f9a 100644 --- a/Source/plugins/IShell.h +++ b/Source/plugins/IShell.h @@ -1,5 +1,5 @@ /* - * If not stated otherwise in this file or this component's LICENSE file the + * If not stated otherwise in this file or this component's LICENSE file the * following copyright and licenses apply: * * Copyright 2020 Metrological @@ -280,33 +280,42 @@ namespace PluginHost { /* @stubgen:stub */ virtual uint32_t Submit(const uint32_t Id, const Core::ProxyType& response) = 0; - inline void Register(RPC::IRemoteConnection::INotification* sink) + inline Core::hresult Register(RPC::IRemoteConnection::INotification* sink) { + Core::hresult result; + ASSERT(sink != nullptr); ICOMLink* handler(QueryInterface()); - // This method can only be used in the main process. Only this process, can instantiate a new process - ASSERT(handler != nullptr); - - if (handler != nullptr) { + if (handler == nullptr) { + result = Core::ERROR_NOT_SUPPORTED; + } + else { handler->Register(sink); handler->Release(); + result = Core::ERROR_NONE; } + + return (result); } - inline void Unregister(const RPC::IRemoteConnection::INotification* sink) + inline Core::hresult Unregister(const RPC::IRemoteConnection::INotification* sink) { + Core::hresult result; + ASSERT(sink != nullptr); ICOMLink* handler(QueryInterface()); - // This method can only be used in the main process. Only this process, can instantiate a new process - ASSERT(handler != nullptr); - - if (handler != nullptr) { + if (handler == nullptr) { + result = Core::ERROR_NOT_SUPPORTED; + } + else { handler->Unregister(sink); handler->Release(); } + + return (result); } inline void Register(ICOMLink::INotification* sink) { @@ -365,9 +374,6 @@ namespace PluginHost { RPC::IRemoteConnection* connection(nullptr); ICOMLink* handler(QueryInterface()); - // This method can only be used in the main process. Only this process, can instantiate a new process - ASSERT(handler != nullptr); - if (handler != nullptr) { connection = handler->RemoteConnection(connectionId); handler->Release();