It is simple to have an object provide multiple signal consumer ports through operator() functions of different signatures. Here is an example:
class SignalIntFloatCollector : public signals::consumer<SignalIntFloatCollector> { public: void operator()(int x) { last_int = x; } void operator()(float x) { last_float = x; } optional<int> last_int; optional<float> last_float; }; // end class SignalIntFloatCollector
In such cases, where the operator() functions differ in their signature, standard connection operators will work out the correct connection:
signals::storage<void ()> banger; signals::storage<void (int)> int_storage(2); signals::storage<void (float)> float_storage(3.3f); SignalIntFloatCollector collector; // ---Connect the dataflow network ----------------------------- // // // ,---------------. void(float) // | int_storage | -------------+ // `--(send_slot)--' | // ^ | // ,--------. void() | +>,-----------. // | banger | --------+ | collector | // `--------' | +>`-----------' // V | // ,--(send_slot)--. void(float) | // | float_storage | -------------+ // `---------------' // // ------------------------------------------------------------- banger | int_storage.send_slot() | float_storage.send_slot(); int_storage >>= collector; float_storage >>= collector; banger(); // this causes int_storage to output 2, and float_storage 3.3 BOOST_CHECK_EQUAL(collector.last_int, optional<int>(2)); BOOST_CHECK_EQUAL(collector.last_float, optional<float>(3.3f));