i want to connect some modules with boost::signals2 to each other. Each module is an object of some class and has its own signal for example:
boost::signals2::signal<void (cv::Mat, int)> outputSignal;
The signatures of the signals and the slots vary from module to module. Therefore the type of the signals and the slots vary. I want the interface of the modules to allow to connect these modules in a generic way.
What i would like is a interfacemethod like module.connect(slot) which i can give any slot and if the signature fits the signature of the module's signal it connects the slot to the module's signal or gives an error if the signatures don't fit. Or i would like the module to return it's signal so slots can directly be connected to the returned signal using signal.connect(slot). But neither the signals nor the slots have the same type for all modules. So i have not found a way to implement such methods in the interface. The parametertype or the returntype need to vary depending on the module's signal.
Since the system should be expandable and new modules can be added with different types of signals and slots they are not known in advance. So it is not sufficient to hard code the types and overload the method.
Does anybody have an idea how i could implement this interface? I am thankful for any suggestions and help.