Communicate between plugins (tutorial)

Tutorials

basic
your first simulation
advanced

This page describes how to get a plugin from another plugin (C++ only)

If you follow the tutorial, you know that a granOO’s simulation uses plugins that are called and organized from an input file. In some cases, for complex simulations, you may need to communicate between the plugins. It means that you need to catch a plugin instance from another plugin instance.

Plugins are class instances. The Core::Problem singleton class manages the plugin instances. It is in charge to index, to store, to launch… these plugins. So, if you want to catch a given plugin, the Problem singleton class is the right interlocutor. The following c++ code block shows how to retrieve a given plugin.

Core::Problem& prob = Core::Problem::Get();
MyPlugInType& plug = prob.GetPlugin<MyPlugInType>();
plug.DoSomething();