Hi,

I meant to write "start" method instead of "load". In a CTK plugin, you need to use "start" and "stop", in a CppMicroServices module "load" and "unload". You could mix both, but unless you are really familiar with that subject, I would advise against it.

Best,
Sascha

On 08/18/2015 10:21 AM, Pukhlikov Mikhail wrote:
Thank you.

I can see load methind in Module Activator here: https://github.com/samsmu/MITK/blob/develop/Core/CppMicroServices/core/include/usModuleActivator.h

However with Plugin Activator I only have start and stop: https://github.com/commontk/CTK/blob/master/Libs/PluginFramework/ctkPluginActivator.h

Can I use this Load methid inside plugin?

------------------------------------------------------------------------
Date: Tue, 18 Aug 2015 07:44:01 +0200
From: sascha.zel...@gmail.com
To: mikhail.pukhli...@outlook.com; mitk-users@lists.sourceforge.net
Subject: Re: [mitk-users] Is there way to make some action by some plugin after it's loading

Hi,

I think it depends how the "tool plugin" can be distinguished from other plugins:

Approaches where the plugin needs to be loaded and it actively "registers something"

1. The tool plugin actively calls a singletone method of some other plugin. If you want that call to happen at the earliest time possible, you can either use the constructor of a file-scoped static object or put the call in the plugin's activator load method. 2. The tool plugin makes use of the service registry and registers a service object in its activator load method. The hypervisor plugin would just track such services using the service registry.

Both approaches require the tool plugin to depend on some other entity (the hypervisors singleton method or the service interface class).

For an enumeration of tool plug-ins, they probably do not need to be loaded. They could be tracked by relying on meta data added to the plug-ins. I assume you are working with CTK plugins (you can use similar techniques with CppMicroServices modules)

- Add meta data to your plugin by modifying the manifest_headers.cmake file and adding a new new line, e.g. "set(Provides-Tools 1)". - The hypervisor plugin instantiates a ctkPluginTracker [1] which is notified if new plugins are installed or change state. It can then use the ctkPlugin::getHeaders() [2] method to check if the plugin contains the "Provides-Tools" header.

Depending on your needs the above scheme can get more elaborate and provide more information via meta data or embedded resources.

Best,
Sascha

[1] http://www.commontk.org/docs/html/classctkPluginTracker.html
[2] http://www.commontk.org/docs/html/classctkPlugin.html#a60f6b7f62313a22639d4a52122f8288a

On 08/17/2015 12:14 PM, Pukhlikov Mikhail wrote:

    Hello

    I'm creating plugin which should know the list of available tools
    plugins.
    The idea was that those plugins during application loading will
    call singletone method of hypervisor plugin.
    So I wanted to know if that is possible to have method inside
    plugins to be called during Application startup.

    Thank you

    ------------------------------------------------------------------------
    Date: Fri, 14 Aug 2015 16:41:54 +0200
    From: sascha.zel...@gmail.com <mailto:sascha.zel...@gmail.com>
    To: mitk-users@lists.sourceforge.net
    <mailto:mitk-users@lists.sourceforge.net>
    Subject: Re: [mitk-users] Is there way to make some action by some
    plugin after it's loading

    Hi,

    it's hard to give you proper advice without exactly knowing what
    you are trying to achieve. You cant obviously call a function from
    a plug-in until its shared library is loaded.

    There are different hooks, listeners, etc. but without knowing
    your use case I could just guess...

    Cheers,

    Sascha

    Am 14/08/2015 um 14:09 schrieb Pukhlikov Mikhail:

        Hello.

        I need to make some action by some plugin after it's loading.

        Not when I activate it. Before Activator loading.

        Just when MITK itself starts it enumerates available plugins
        and in that time I need to call some function iside that plugin.

        Thank you.



        
------------------------------------------------------------------------------



        _______________________________________________
        mitk-users mailing list
        mitk-users@lists.sourceforge.net  
<mailto:mitk-users@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/mitk-users



    
------------------------------------------------------------------------------
    _______________________________________________ mitk-users mailing
    list mitk-users@lists.sourceforge.net
    <mailto:mitk-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/mitk-users



------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to