In short: what is the best way to develop and implement a factory + plugin mechanism so that plugins can replace objects in the main application.
We have a code base from which we create our applications. The code base is perfect for 70-95% of applications, which means that in each new application we need to change 5-30% of the default behavior (add new functions, change the default logic, add a graphical interface, etc.).
The implementation is based on plugins: the code base is built into the EXE and DLL, and when the main EXE is launched, we load the DLL, which adds the required functions.
Currently, each plugin provides the following function:
PluginInterface* PluginInit()
{
return new MyCustomizedPluginInterface();
}
Where PluginInterface is defined as:
class PluginInterface {
public:
virtual SomeClass1* customizedSomeClass1() = 0;
virtual SomeClass2* customizedSomeClass2() = 0;
};
SomeClass1/SomeClass2 , .
. , -.
SDK, , :
PluginInterface* PluginInit(GodObject* godObject)
{
FactoryForSomeClasses* factoryForSomeClasses =
godObject->factoryForSomeClasses();
factoryForSomeClasses->setSomeClass1Creator( MyCustomizedSomeClass1::create);
factoryForSomeClasses->setSomeClass2Creator( MyCustomizedSomeClass2::create);
}
, .
/ factory, ?