Hello,
I've a class with multiple boost signals like this
class A
{
private:
boost::signal<void()> m_voidSignal ;
boost::signal<void (const string&)> m_stringSignal ;
public:
boost::signal<void()>& voidSignal() { return m_voidSignal ; }
boost::signal<void (const string&)>& stringSignal { return m_stringSignal ; }
} ;
when i'm connecting signals to slots, I do some thing like this.
A a;
a.voidSignal().connect (...) ;
This works fine. But I've many signals with different signatures. what I want to achieve is a single interface where I want to map every signal to enums and access signal from the enums like this.
class A
{
public:
typedef enum {
VoidSignal, StringSignal ... } ; SignalIds ;
// return type should be deducted automatically from the enum
ReturnType& getSignal (SignalId) ;
...
} ;
So that I can do some thing like this
A a;
a.getSignal (A::VoidSignal).connect (...) ;
a.getSignal (A::StringSignal).connect (...) ;
Basically with a single interface, I want to change the return type automatically. Can I achieve something like this with any of the boost libraries (mpl, fusion etc) ? Any pointers on this would be of great help.
Thanks,
Surya