Skip to content

Commit

Permalink
[OOP] Move the plugin as a whole OOP. (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwielders authored Jul 2, 2024
1 parent 252b266 commit caf8bfd
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions Source/plugins/IShell.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -280,33 +280,42 @@ namespace PluginHost {
/* @stubgen:stub */
virtual uint32_t Submit(const uint32_t Id, const Core::ProxyType<Core::JSON::IElement>& 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<ICOMLink>());

// 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<ICOMLink>());

// 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)
{
Expand Down Expand Up @@ -365,9 +374,6 @@ namespace PluginHost {
RPC::IRemoteConnection* connection(nullptr);
ICOMLink* handler(QueryInterface<ICOMLink>());

// 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();
Expand Down

0 comments on commit caf8bfd

Please sign in to comment.