Closed MoFHeka closed 3 months ago
@MoFHeka Looks like StorageFactory
is implemented with virtual functions rather than proxy
. Is there any consideration for not using proxy
? Could you simplify the code so that we can understand your question better?
I usually create a static InitOnStartupMarker hold a registry class. There's a map in the registry class which key is the plug-in name and value is the constructor. The Lookup function will return the virtual class pointer according the plug-in name from the registry map. Also there's a DeferRegister function which through the static maker in plug-in side code to register the plug-in when load the dynamic library.
Any good idea or example to make it more modern?
Here is a sample:
storage_registration.hpp
:storage_registry.hpp
:storage_registry.cpp
:storage_interface.hpp
:main.cpp
: